Skip to content

Commit c4c86c2

Browse files
Introduce a "Map of NiceGUI" (#4128)
This PR adds an overview of the NiceGUI namespace to the documentation page. - [x] It's still a draft, because I'm planning to add links to the individual documentation pages where possible. - [x] And although I like the blue color to highlight the code snippets, it can be confused with links. So maybe we find a better way to highlight them. --------- Co-authored-by: Rodja Trappe <[email protected]>
1 parent 9f95ba7 commit c4c86c2

File tree

2 files changed

+317
-1
lines changed

2 files changed

+317
-1
lines changed

nicegui/ui_run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def run(*,
9090
:param binding_refresh_interval: time between binding updates (default: `0.1` seconds, bigger is more CPU friendly)
9191
:param reconnect_timeout: maximum time the server waits for the browser to reconnect (default: 3.0 seconds)
9292
:param message_history_length: maximum number of messages that will be stored and resent after a connection interruption (default: 1000, use 0 to disable)
93-
:param fastapi_docs: enable FastAPI's automatic documentation with Swagger UI, ReDoc, and OpenAPI JSON (bool or dictionary as described `here<https://fastapi.tiangolo.com/tutorial/metadata/>`_, default: `False`)
93+
:param fastapi_docs: enable FastAPI's automatic documentation with Swagger UI, ReDoc, and OpenAPI JSON (bool or dictionary as described `here <https://fastapi.tiangolo.com/tutorial/metadata/>`_, default: `False`)
9494
:param show: automatically open the UI in a browser tab (default: `True`)
9595
:param on_air: tech preview: `allows temporary remote access <https://nicegui.io/documentation/section_configuration_deployment#nicegui_on_air>`_ if set to `True` (default: disabled)
9696
:param native: open the UI in a native window of size 800x600 (default: `False`, deactivates `show`, automatically finds an open port)

website/documentation/content/overview.py

Lines changed: 316 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
section_testing,
1515
section_text_elements,
1616
)
17+
from ...style import subheading
1718

1819
doc.title('*NiceGUI* Documentation', 'Reference, Demos and more')
1920

@@ -151,3 +152,318 @@ def create_tiles():
151152
if page.title:
152153
ui.label(page.title.replace('*', '')).classes(replace='text-2xl')
153154
ui.markdown(description).classes(replace='bold-links arrow-links')
155+
156+
157+
@doc.ui
158+
def map_of_nicegui():
159+
ui.separator().classes('mt-6')
160+
subheading('Map of NiceGUI', anchor_name='map-of-nicegui')
161+
ui.add_css('''
162+
.map-of-nicegui a code {
163+
font-weight: bold;
164+
}
165+
''')
166+
ui.markdown('''
167+
This overview shows the structure of NiceGUI.
168+
It is a map of the NiceGUI namespace and its contents.
169+
It is not exhaustive, but it gives you a good idea of what is available.
170+
An ongoing goal is to make this map more complete and to add missing links to the documentation.
171+
172+
#### `ui`
173+
174+
UI elements and other essentials to run a NiceGUI app.
175+
176+
- [`ui.element`](/documentation/element): base class for all UI elements
177+
- customization:
178+
- `.props()` and [`.default_props()`](/documentation/element#default_props): add Quasar props and regular HTML attributes
179+
- `.classes()` and [`.default_classes()`](/documentation/element#default_classes): add Quasar, Tailwind and custom HTML classes
180+
- [`.tailwind`](/documentation/section_styling_appearance#tailwind_css): convenience API for adding Tailwind classes
181+
- `.style()` and [`.default_style()`](/documentation/element#default_style): add CSS style definitions
182+
- [`.tooltip()`](/documentation/tooltip): add a tooltip to an element
183+
- [`.mark()`](/documentation/element_filter#markers): mark an element for querying with an [ElementFilter](/documentation/element_filter)
184+
- interaction:
185+
- [`.on()`](/documentation/generic_events): add Python and JavaScript event handlers
186+
- `.update()`: send an update to the client (mostly done automatically)
187+
- `.run_method()`: run a method on the client side
188+
- `.get_computed_prop()`: get the value of a property that is computed on the client side
189+
- hierarchy:
190+
- `with ...:` nesting elements in a declarative way
191+
- `__iter__`: an iterator over all child elements
192+
- `ancestors`: an iterator over the element's parent, grandparent, etc.
193+
- `descendants`: an iterator over all child elements, grandchildren, etc.
194+
- `slots`: a dictionary of named slots
195+
- `add_slot`: fill a new slot with NiceGUI elements or a scoped slot with template strings
196+
- [`clear`](/documentation/section_page_layout#clear_containers): remove all child elements
197+
- [`move`](/documentation/element#move_elements): move an element to a new parent
198+
- `remove`: remove a child element
199+
- `delete`: delete an element and all its children
200+
- `is_deleted`: whether an element has been deleted
201+
- elements:
202+
- [`ui.aggrid`](/documentation/aggrid)
203+
- [`ui.audio`](/documentation/audio)
204+
- [`ui.avatar`](/documentation/avatar)
205+
- [`ui.badge`](/documentation/badge)
206+
- [`ui.button`](/documentation/button)
207+
- [`ui.button_group`](/documentation/button_group)
208+
- [`ui.card`](/documentation/card), `ui.card_actions`, `ui.card_section`
209+
- [`ui.carousel`](/documentation/carousel), `ui.carousel_slide`
210+
- [`ui.chat_message`](/documentation/chat_message)
211+
- [`ui.checkbox`](/documentation/checkbox)
212+
- [`ui.chip`](/documentation/chip)
213+
- [`ui.circular_progress`](/documentation/circular_progress)
214+
- [`ui.code`](/documentation/code)
215+
- [`ui.codemirror`](/documentation/codemirror)
216+
- [`ui.color_input`](/documentation/color_input)
217+
- [`ui.color_picker`](/documentation/color_picker)
218+
- [`ui.column`](/documentation/column)
219+
- [`ui.context_menu`](/documentation/context_menu)
220+
- [`ui.date`](/documentation/date)
221+
- [`ui.dialog`](/documentation/dialog)
222+
- [`ui.dropdown_button`](/documentation/button_dropdown)
223+
- [`ui.echart`](/documentation/echart)
224+
- [`ui.editor`](/documentation/editor)
225+
- [`ui.expansion`](/documentation/expansion)
226+
- [`ui.grid`](/documentation/grid)
227+
- [`ui.highchart`](/documentation/highchart)
228+
- [`ui.html`](/documentation/html)
229+
- [`ui.icon`](/documentation/icon)
230+
- [`ui.image`](/documentation/image)
231+
- [`ui.input`](/documentation/input)
232+
- [`ui.interactive_image`](/documentation/interactive_image)
233+
- `ui.item`, `ui.item_label`, `ui.item_section`
234+
- [`ui.joystick`](/documentation/joystick)
235+
- [`ui.json_editor`](/documentation/json_editor)
236+
- [`ui.knob`](/documentation/knob)
237+
- [`ui.label`](/documentation/label)
238+
- [`ui.leaflet`](/documentation/leaflet)
239+
- [`ui.line_plot`](/documentation/line_plot)
240+
- [`ui.linear_progress`](/documentation/linear_progress)
241+
- [`ui.link`](/documentation/link), `ui.link_target`
242+
- [`ui.list`](/documentation/list)
243+
- [`ui.log`](/documentation/log)
244+
- [`ui.markdown`](/documentation/markdown)
245+
- [`ui.matplotlib`](/documentation/matplotlib)
246+
- [`ui.menu`](/documentation/menu), `ui.menu_item`
247+
- [`ui.mermaid`](/documentation/mermaid)
248+
- [`ui.notification`](/documentation/notification)
249+
- [`ui.number`](/documentation/number)
250+
- [`ui.pagination`](/documentation/pagination)
251+
- [`ui.plotly`](/documentation/plotly)
252+
- [`ui.pyplot`](/documentation/pyplot)
253+
- [`ui.radio`](/documentation/radio)
254+
- [`ui.range`](/documentation/range)
255+
- [`ui.restructured_text`](/documentation/restructured_text)
256+
- [`ui.row`](/documentation/row)
257+
- [`ui.scene`](/documentation/scene), [`ui.scene_view`](/documentation/scene#scene_view)
258+
- [`ui.scroll_area`](/documentation/scroll_area)
259+
- [`ui.select`](/documentation/select)
260+
- [`ui.separator`](/documentation/separator)
261+
- [`ui.skeleton`](/documentation/skeleton)
262+
- [`ui.slider`](/documentation/slider)
263+
- [`ui.space`](/documentation/space)
264+
- [`ui.spinner`](/documentation/spinner)
265+
- [`ui.splitter`](/documentation/splitter)
266+
- [`ui.stepper`](/documentation/stepper), `ui.step`, `ui.stepper_navigation`
267+
- [`ui.switch`](/documentation/switch)
268+
- [`ui.tabs`](/documentation/tabs), `ui.tab`, `ui.tab_panels`, `ui.tab_panel`
269+
- [`ui.table`](/documentation/table)
270+
- [`ui.textarea`](/documentation/textarea)
271+
- [`ui.time`](/documentation/time)
272+
- [`ui.timeline`](/documentation/timeline), `ui.timeline_entry`
273+
- [`ui.toggle`](/documentation/toggle)
274+
- [`ui.tooltip`](/documentation/tooltip)
275+
- [`ui.tree`](/documentation/tree)
276+
- [`ui.upload`](/documentation/upload)
277+
- [`ui.video`](/documentation/video)
278+
- special layout [elements](/documentation/page_layout):
279+
- `ui.header`
280+
- `ui.footer`
281+
- `ui.drawer`, `ui.left_drawer`, `ui.right_drawer`
282+
- `ui.page_sticky`
283+
- special functions and objects:
284+
- [`ui.add_body_html`](/documentation/section_pages_routing#add_html_to_the_page) and
285+
[`ui.add_head_html`](/documentation/section_pages_routing#add_html_to_the_page): add HTML to the body and head of the page
286+
- [`ui.add_css`](/documentation/add_style#add_css_style_definitions_to_the_page),
287+
[`ui.add_sass`](/documentation/add_style#add_sass_style_definitions_to_the_page) and
288+
[`ui.add_scss`](/documentation/add_style#add_scss_style_definitions_to_the_page): add CSS, SASS and SCSS to the page
289+
- [`ui.clipboard`](/documentation/clipboard): interact with the browser's clipboard
290+
- [`ui.colors`](/documentation/colors): define the main color theme for a page
291+
- `ui.context`: get the current UI context including the `client` and `request` objects
292+
- [`ui.dark_mode`](/documentation/dark_mode): get and set the dark mode on a page
293+
- [`ui.download`](/documentation/download): download a file to the client
294+
- [`ui.keyboard`](/documentation/keyboard): define keyboard event handlers
295+
- [`ui.navigate`](/documentation/navigate): let the browser navigate to another location
296+
- [`ui.notify`](/documentation/notification): show a notification
297+
- [`ui.on`](/documentation/generic_events#custom_events): register an event handler
298+
- [`ui.page_title`](/documentation/page_title): change the current page title
299+
- [`ui.query`](/documentation/query): query HTML elements on the client side to modify props, classes and style definitions
300+
- [`ui.run`](/documentation/run) and `ui.run_with`: run the app (standalone or attached to a FastAPI app)
301+
- [`ui.run_javascript`](/documentation/run#run_custom_javascript_on_the_client_side): run custom JavaScript on the client side (can use `getElement()`, `getHtmlElement()`, and `emitEvent()`)
302+
- [`ui.teleport`](/documentation/teleport): teleport an element to a different location in the HTML DOM
303+
- [`ui.timer`](/documentation/timer): run a function periodically or once after a delay
304+
- `ui.update`: send updates of multiple elements to the client
305+
- decorators:
306+
- [`ui.page`](/documentation/page): define a page (in contrast to the automatically generated "auto-index page")
307+
- [`ui.refreshable`](/documentation/refreshable), `ui.refreshable_method`: define refreshable UI containers
308+
(can use [`ui.state`](/documentation/refreshable#refreshable_ui_with_reactive_state))
309+
310+
#### `app`
311+
312+
App-wide storage, mount points and lifecycle hooks.
313+
314+
- [`app.storage`](/documentation/storage):
315+
- `app.storage.tab`: stored in memory on the server, unique per tab
316+
- `app.storage.client`: stored in memory on the server, unique per client connected to a page
317+
- `app.storage.user`: stored in a file on the server, unique per browser
318+
- `app.storage.general`: stored in a file on the server, shared across the entire app
319+
- `app.storage.browser`: stored in the browser's local storage, unique per browser
320+
- [lifecycle hooks](/documentation/section_action_events#events):
321+
- `app.on_connect()`: called when a client connects
322+
- `app.on_disconnect()`: called when a client disconnects
323+
- `app.on_startup()`: called when the app starts
324+
- `app.on_shutdown()`: called when the app shuts down
325+
- `app.on_exception()`: called when an exception occurs
326+
- [`app.shutdown()`](/documentation/section_action_events#shut_down_nicegui): shut down the app
327+
- static files:
328+
- [`app.add_static_files()`](/documentation/section_pages_routing#add_a_directory_of_static_files),
329+
`app.add_static_file()`: serve static files
330+
- [`app.add_media_files()`](/documentation/section_pages_routing#add_directory_of_media_files),
331+
`app.add_media_file()`: serve media files (supports streaming)
332+
- [`app.native`](/documentation/section_configuration_deployment#native_mode): configure the app when running in native mode
333+
334+
#### `html`
335+
336+
[Pure HTML elements](/documentation/html#other_html_elements):
337+
338+
`a`,
339+
`abbr`,
340+
`acronym`,
341+
`address`,
342+
`area`,
343+
`article`,
344+
`aside`,
345+
`audio`,
346+
`b`,
347+
`basefont`,
348+
`bdi`,
349+
`bdo`,
350+
`big`,
351+
`blockquote`,
352+
`br`,
353+
`button`,
354+
`canvas`,
355+
`caption`,
356+
`cite`,
357+
`code`,
358+
`col`,
359+
`colgroup`,
360+
`data`,
361+
`datalist`,
362+
`dd`,
363+
`del_`,
364+
`details`,
365+
`dfn`,
366+
`dialog`,
367+
`div`,
368+
`dl`,
369+
`dt`,
370+
`em`,
371+
`embed`,
372+
`fieldset`,
373+
`figcaption`,
374+
`figure`,
375+
`footer`,
376+
`form`,
377+
`h1`,
378+
`header`,
379+
`hgroup`,
380+
`hr`,
381+
`i`,
382+
`iframe`,
383+
`img`,
384+
`input_`,
385+
`ins`,
386+
`kbd`,
387+
`label`,
388+
`legend`,
389+
`li`,
390+
`main`,
391+
`map_`,
392+
`mark`,
393+
`menu`,
394+
`meter`,
395+
`nav`,
396+
`object_`,
397+
`ol`,
398+
`optgroup`,
399+
`option`,
400+
`output`,
401+
`p`,
402+
`param`,
403+
`picture`,
404+
`pre`,
405+
`progress`,
406+
`q`,
407+
`rp`,
408+
`rt`,
409+
`ruby`,
410+
`s`,
411+
`samp`,
412+
`search`,
413+
`section`,
414+
`select`,
415+
`small`,
416+
`source`,
417+
`span`,
418+
`strong`,
419+
`sub`,
420+
`summary`,
421+
`sup`,
422+
`svg`,
423+
`table`,
424+
`tbody`,
425+
`td`,
426+
`template`,
427+
`textarea`,
428+
`tfoot`,
429+
`th`,
430+
`thead`,
431+
`time`,
432+
`tr`,
433+
`track`,
434+
`u`,
435+
`ul`,
436+
`var`,
437+
`video`,
438+
`wbr`
439+
440+
#### `background_tasks`
441+
442+
Run async functions in the background.
443+
444+
- `create()`: create a background task
445+
- `create_lazy()`: prevent two tasks with the same name from running at the same time
446+
447+
#### `run`
448+
449+
Run IO and CPU bound functions in separate threads and processes.
450+
451+
- [`run.cpu_bound()`](/documentation/section_action_events#running_cpu-bound_tasks): run a CPU-bound function in a separate process
452+
- [`run.io_bound()`](/documentation/section_action_events#running_i_o-bound_tasks): run an IO-bound function in a separate thread
453+
454+
#### `observables`
455+
456+
Observable collections that notify observers when their contents change.
457+
458+
- `ObservableCollection`: base class
459+
- `ObservableDict`: an observable dictionary
460+
- `ObservableList`: an observable list
461+
- `ObservableSet`: an observable set
462+
463+
#### `testing`
464+
465+
Write automated UI tests which run in a headless browser (slow) or fully simulated in Python (fast).
466+
467+
- [`Screen`](/documentation/section_testing#screen_fixture) fixture: start a real (headless) browser to interact with your application
468+
- [`User`](/documentation/section_testing#user_fixture) fixture: simulate user interaction on a Python level (fast)
469+
''').classes('map-of-nicegui arrow-links bold-links')

0 commit comments

Comments
 (0)