1
0

expansion_documentation.py 792 B

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