number_documentation.py 558 B

12345678910111213141516171819
  1. from nicegui import ui
  2. from ..documentation_tools import text_demo
  3. def main_demo() -> None:
  4. ui.number(label='Number', value=3.1415927, format='%.2f',
  5. on_change=lambda e: result.set_text(f'you entered: {e.value}'))
  6. result = ui.label()
  7. def more() -> None:
  8. @text_demo('Clearable', '''
  9. The `clearable` prop from [Quasar](https://quasar.dev/) adds a button to the input that clears the text.
  10. ''')
  11. def clearable():
  12. i = ui.number(value=42).props('clearable')
  13. ui.label().bind_text_from(i, 'value')