text_elements.py 825 B

12345678910111213141516171819202122232425262728
  1. from nicegui import ui
  2. from ..tools import load_demo, section_intro_demo
  3. name = 'text_elements'
  4. title = 'Text Elements'
  5. def intro() -> None:
  6. @section_intro_demo(name, title, '''
  7. NiceGUI provides a set of text elements to display text and other content.
  8. The most basic element is the `ui.label`, which can be used to display a simple text.
  9. But there are also more advanced elements, such as `ui.markdown`, `ui.mermaid` and `ui.html`.
  10. ''')
  11. def label():
  12. ui.label('Hello, world!')
  13. ui.markdown('This is **Markdown**.')
  14. ui.html('This is <strong>HTML</strong>.')
  15. def content() -> None:
  16. load_demo(ui.label)
  17. load_demo(ui.link)
  18. load_demo(ui.chat_message)
  19. load_demo(ui.element)
  20. load_demo(ui.markdown)
  21. load_demo(ui.mermaid)
  22. load_demo(ui.html)