textarea_documentation.py 690 B

12345678910111213141516171819
  1. from nicegui import ui
  2. from ...model import UiElementDocumentation
  3. class TextareaDocumentation(UiElementDocumentation, element=ui.textarea):
  4. def main_demo(self) -> 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. def more(self) -> None:
  9. @self.demo('Clearable', '''
  10. The `clearable` prop from [Quasar](https://quasar.dev/) adds a button to the input that clears the text.
  11. ''')
  12. def clearable():
  13. i = ui.textarea(value='some text').props('clearable')
  14. ui.label().bind_text_from(i, 'value')