Skip to content

Commit 3a94186

Browse files
Document the script mode (zauberzeug#5299)
### Motivation We can't talk about not using the script mode in zauberzeug#5297, if we did not document what that even is. ### Implementation Add a small section on what is script mode in the documentation. ### Progress - [x] I chose a meaningful title that completes the sentence: "If applied, this PR will..." - [x] The implementation is complete. - [x] Pytests have been added (or are not necessary). - [x] Documentation has been added (or is not necessary). --------- Co-authored-by: Falko Schindler <[email protected]>
1 parent 712d056 commit 3a94186

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

website/documentation/content/section_pages_routing.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@
2121
doc.intro(sub_pages_documentation)
2222

2323

24+
@doc.demo('Script Mode', '''
25+
While generally you would either use `@ui.page` decorators or a root function to create pages,
26+
it is cumbersome when making quick prototypes or demos.
27+
In such cases, you can use "script mode" by simply writing code at the top level of a script.
28+
The code will be executed once per client connection, and the interface will be created for that client.
29+
''')
30+
def script_mode_demo():
31+
ui.label('No @ui.page, no root function, but still a working page!')
32+
33+
34+
doc.text('', 'Note: Many of the demos in this documentation are written in script mode for conciseness.')
35+
36+
2437
@doc.auto_execute
2538
@doc.demo('Parameter injection', '''
2639
Thanks to FastAPI, a page function accepts optional parameters to provide

0 commit comments

Comments
 (0)