@@ -47,51 +47,6 @@ def ui(fn: Callable[P, R]) -> Callable[Concatenate[str, P], R]:
4747 parameters accepted by `fn`. When called, it returns UI elements with input/output
4848 IDs automatically namespaced using the provided module `id`.
4949
50-
51- Example
52- -------
53-
54- ```python
55- from shiny import App, module, reactive, render, ui
56-
57-
58- @module.ui
59- def counter_ui(label: str = "Increment counter") -> ui.TagChild:
60- return ui.card(
61- ui.h2("This is " + label),
62- ui.input_action_button(id="button", label=label),
63- ui.output_code(id="out"),
64- )
65-
66-
67- @module.server
68- def counter_server(input, output, session, starting_value: int = 0):
69- count: reactive.value[int] = reactive.value(starting_value)
70-
71- @reactive.effect
72- @reactive.event(input.button)
73- def _():
74- count.set(count() + 1)
75-
76- @render.code
77- def out() -> str:
78- return f"Click count is {count()}"
79-
80-
81- app_ui = ui.page_fluid(
82- counter_ui("counter1", "Counter 1"),
83- counter_ui("counter2", "Counter 2"),
84- )
85-
86-
87- def server(input, output, session):
88- counter_server("counter1")
89- counter_server("counter2")
90-
91-
92- app = App(app_ui, server)
93- ```
94-
9550 See Also
9651 --------
9752 * Shiny Modules documentation: https://shiny.posit.co/py/docs/modules.html
@@ -131,50 +86,6 @@ def server(
13186 followed by any arguments expected by `fn`. When called, it will register
13287 the module's server logic in a namespaced context.
13388
134- Example
135- -------
136-
137- ```python
138- from shiny import App, module, reactive, render, ui
139-
140-
141- @module.ui
142- def counter_ui(label: str = "Increment counter") -> ui.TagChild:
143- return ui.card(
144- ui.h2("This is " + label),
145- ui.input_action_button(id="button", label=label),
146- ui.output_code(id="out"),
147- )
148-
149-
150- @module.server
151- def counter_server(input, output, session, starting_value: int = 0):
152- count: reactive.value[int] = reactive.value(starting_value)
153-
154- @reactive.effect
155- @reactive.event(input.button)
156- def _():
157- count.set(count() + 1)
158-
159- @render.code
160- def out() -> str:
161- return f"Click count is {count()}"
162-
163-
164- app_ui = ui.page_fluid(
165- counter_ui("counter1", "Counter 1"),
166- counter_ui("counter2", "Counter 2"),
167- )
168-
169-
170- def server(input, output, session):
171- counter_server("counter1")
172- counter_server("counter2")
173-
174-
175- app = App(app_ui, server)
176- ```
177-
17889 See Also
17990 --------
18091 * Shiny Modules documentation: https://shiny.posit.co/py/docs/modules.html
0 commit comments