From d57ee5ece5184fab7dd5338b0155f787c5533b5c Mon Sep 17 00:00:00 2001 From: Rodja Trappe Date: Sat, 23 Nov 2024 05:40:17 +0100 Subject: [PATCH] add html module description to ui.html documentation --- .../content/html_documentation.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/website/documentation/content/html_documentation.py b/website/documentation/content/html_documentation.py index 9047724f1..cd1bf4af1 100644 --- a/website/documentation/content/html_documentation.py +++ b/website/documentation/content/html_documentation.py @@ -15,4 +15,25 @@ def demo_inline() -> None: ui.html('This is emphasized.', tag='em') +@doc.demo('Other HTML Elements', ''' + There is also an `html` module that allows you to insert other HTML elements like ``, `
`, `

`, etc. + It is equivalent to using the `ui.element` method with the `tag` argument. + + Like with any other element, you can add classes, style, props, tooltips and events. + One convenience is that the keyword arguments are automatically added to the element's `props` dictionary. +''') +def other_html_elements(): + from nicegui import html, ui + + with html.section().style('font-size: 120%'): + html.strong('This is bold.') \ + .classes('cursor-pointer') \ + .on('click', lambda: ui.notify('Bold!')) + html.hr() + html.em('This is italic.').tooltip('Nice!') + with ui.row(): + html.img().props('src=https://placehold.co/60') + html.img(src='https://placehold.co/60') + + doc.reference(ui.html)