1
0

main.py 688 B

12345678910111213141516171819
  1. #!/usr/bin/env python3
  2. from nicegui import ui
  3. tree = ui.tree([
  4. {'id': 'numbers', 'icon': 'tag', 'children': [{'id': '1'}, {'id': '2'}]},
  5. {'id': 'letters', 'icon': 'text_fields', 'children': [{'id': 'A'}, {'id': 'B'}]},
  6. ], label_key='id', on_select=lambda e: ui.notify(e.value))
  7. tree.add_slot('default-header', r'''
  8. <div class="row items-center">
  9. <q-icon :name="props.node.icon || 'share'" color="orange" size="28px" class="q-mr-sm" />
  10. <div class="text-weight-bold text-primary">{{ props.node.id }}</div>
  11. </div>
  12. ''')
  13. with tree.add_slot('default-body'):
  14. ui.label('This is some default content.').classes('ml-8 text-weight-light text-black')
  15. ui.run()