Skip to content

Commit 79bb621

Browse files
committed
Clean up module example
1 parent aab3652 commit 79bb621

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

examples/moduleapp/app.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import shiny.ui_toolkit as st
22
from shiny import *
33

4-
5-
# =============================================================================
4+
# ============================================================
65
# Counter module
7-
# =============================================================================
6+
# ============================================================
87
def counter_module_ui(
98
ns: Callable[[str], str], label: str = "Increment counter"
109
) -> TagChildArg:
11-
return TagList(
10+
return st.div(
11+
{"style": "border: 1px solid #ccc; border-radius: 5px; margin: 5px 0;"},
12+
st.h2("This is " + label),
1213
st.input_action_button(id=ns("button"), label=label),
1314
st.output_text_verbatim(id=ns("out")),
1415
)
@@ -20,7 +21,7 @@ def counter_module_server(
2021
count: reactive.Value[int] = reactive.Value(0)
2122

2223
@reactive.effect()
23-
@event(session.input.button)
24+
@event(input.button)
2425
def _():
2526
count.set(count() + 1)
2627

@@ -33,9 +34,9 @@ def out() -> str:
3334
counter_module = ShinyModule(counter_module_ui, counter_module_server)
3435

3536

36-
# =============================================================================
37-
# App that uses module
38-
# =============================================================================
37+
# ============================================================
38+
# App which uses module
39+
# ============================================================
3940
ui = st.page_fluid(
4041
counter_module.ui("counter1", "Counter 1"),
4142
counter_module.ui("counter2", "Counter 2"),

0 commit comments

Comments
 (0)