textarea_documentation.py 545 B

123456789101112131415161718192021
  1. from nicegui import ui
  2. from . import doc
  3. @doc.demo(ui.textarea)
  4. def main_demo() -> None:
  5. ui.textarea(label='Text', placeholder='start typing',
  6. on_change=lambda e: result.set_text('you typed: ' + e.value))
  7. result = ui.label()
  8. @doc.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.textarea(value='some text').props('clearable')
  13. ui.label().bind_text_from(i, 'value')
  14. doc.reference(ui.textarea)