1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import solara from solara.lab import Tab, Tabs @solara.component def Page(): counter, set_counter = solara.use_state(0) index = solara.use_reactive(0) contents = ["First"] def add_tab(): contents.append("Second") set_counter(counter + 1) index.set(len(contents) - 1) solara.Button("Add", on_click=add_tab) # MyTabs(index, contents) # @solara.component # def MyTabs(index, contents): print("Render 1") with Tabs(index): for tab in contents: with Tab(tab): print("Render 2") solara.Text(tab)