1
0

select_documentation.py 790 B

123456789101112131415161718192021222324252627
  1. from nicegui import ui
  2. from ..documentation_tools import text_demo
  3. def main_demo() -> None:
  4. select1 = ui.select([1, 2, 3], value=1)
  5. select2 = ui.select({1: 'One', 2: 'Two', 3: 'Three'}).bind_value(select1, 'value')
  6. def more() -> None:
  7. @text_demo('Search-as-you-type', '''
  8. You can activate `with_input` to get a text input with autocompletion.
  9. The options will be filtered as you type.
  10. ''')
  11. def search_as_you_type():
  12. continents = [
  13. 'Asia',
  14. 'Africa',
  15. 'Antarctica',
  16. 'Europe',
  17. 'Oceania',
  18. 'North America',
  19. 'South America',
  20. ]
  21. ui.select(options=continents, with_input=True,
  22. on_change=lambda e: ui.notify(e.value)).classes('w-40')