expansion_documentation.py 660 B

12345678910111213141516171819
  1. from nicegui import ui
  2. from ..documentation_tools import text_demo
  3. def main_demo() -> None:
  4. with ui.expansion('Expand!', icon='work').classes('w-full'):
  5. ui.label('inside the expansion')
  6. def more() -> None:
  7. @text_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!')