input_documentation.py 754 B

123456789101112131415161718
  1. from nicegui import ui
  2. from ..documentation_tools import text_demo
  3. def main_demo() -> None:
  4. ui.input(label='Text', placeholder='start typing',
  5. on_change=lambda e: result.set_text('you typed: ' + e.value),
  6. validation={'Input too long': lambda value: len(value) < 20})
  7. result = ui.label()
  8. def more() -> None:
  9. @text_demo('Auto complete input', ' The `autocomplete` feature provides suggestions as you type, making input easier and faster. The parameter `options` is a list of strings that contains the available options that will appear.')
  10. async def autocompleteinput():
  11. options = ['AutoComplete', 'NiceGUI', 'Awesome']
  12. ui.input(label='Text', placeholder='start typing', autocomplete=options)