expansion_documentation.py 635 B

12345678910111213141516171819202122
  1. from nicegui import ui
  2. from . import doc
  3. @doc.demo(ui.expansion)
  4. def main_demo() -> None:
  5. with ui.expansion('Expand!', icon='work').classes('w-full'):
  6. ui.label('inside the expansion')
  7. @doc.demo('Expansion with Custom Header', '''
  8. Instead of setting a plain-text title, you can fill the expansion header with UI elements by adding them to the "header" slot.
  9. ''')
  10. def expansion_with_custom_header():
  11. with ui.expansion() as expansion:
  12. with expansion.add_slot('header'):
  13. ui.image('https://nicegui.io/logo.png').classes('w-16')
  14. ui.label('What a nice GUI!')
  15. doc.reference(ui.expansion)