33 return < ButtonPrimary onClick={lambda}> Clickable< /ButtonPrimary>
44}
55
6+ #universal DialogShowcase (props) {
7+ state open = true
8+ return < div class="demo-stack" >
9+ < div class="demo-row" >
10+ < ButtonPrimary onClick={() => open = true} style={open ? "display:none;" : "" }> Open dialog</ButtonPrimary>
11+ </div>
12+ <Dialog open={open} style={open ? "" : "display:none;"}>
13+ <H3>Interactive Dialog</H3>
14+ <Text style="margin-top:0.75rem;">This dialog is now controlled by universal state and can be closed without losing SSR readiness.</Text>
15+ <div class="demo-row" style="margin-top:1rem;">
16+ <ButtonPrimary onClick={() => open = false}> Confirm< /ButtonPrimary>
17+ < ButtonGhost onClick={() => open = false}> Close< /ButtonGhost>
18+ < /div>
19+ < /Dialog>
20+ < /div>
21+ }
22+
23+ #universal TabsShowcase (props) {
24+ state active = 0
25+ return < Tabs>
26+ < TabList>
27+ < Tab onClick={() => active = 0 } style={ active == 0 ? "background:var(--chx-primary);color:var(--chx-primary-fg);" : "" }> Overview</Tab>
28+ <Tab onClick={() => active = 1 } style={ active == 1 ? "background:var(--chx-primary);color:var(--chx-primary-fg);" : "" }> Tokens</Tab>
29+ <Tab onClick={() => active = 2 } style={ active == 2 ? "background:var(--chx-primary);color:var(--chx-primary-fg);" : "" }> Usage</Tab>
30+ </TabList>
31+ <TabPanel style={active == 0 ? "" : "display:none;"}>
32+ Overview tab content is interactive and swaps instantly on click.
33+ </TabPanel>
34+ <TabPanel style={active == 1 ? "" : "display:none;"}>
35+ Tokens tab content proves stateful tab switching works under hydration.
36+ </TabPanel>
37+ <TabPanel style={active == 2 ? "" : "display:none;"}>
38+ Usage tab content gives the demo page a real click-driven component example.
39+ </TabPanel>
40+ </Tabs>
41+ }
42+
643func ComponentsPage (page : &mut HtmlPage) {
744 page.appendTitle ("Components - Chemical" )
845 page.defaultPrepare ()
@@ -237,14 +274,7 @@ func ComponentsPage(page : &mut HtmlPage) {
237274 < /Snackbar>
238275 < Progress value="68" >< /Progress>
239276 < /div>
240- < Dialog open={true}>
241- < H3> Dialog Shell< /H3>
242- < Text style="margin-top:0.75rem;" > This is a server-rendered dialog surface. We can layer richer open and close behavior later.< /Text>
243- < div class="demo-row" style="margin-top:1rem;" >
244- < ButtonPrimary> Confirm< /ButtonPrimary>
245- < ButtonGhost> Cancel< /ButtonGhost>
246- < /div>
247- < /Dialog>
277+ < DialogShowcase />
248278 < /div>
249279 < /div>
250280
@@ -257,14 +287,7 @@ func ComponentsPage(page : &mut HtmlPage) {
257287 < AccordionSummary> How does SSR-first hydration help here?< /AccordionSummary>
258288 < AccordionPanel> Markup ships complete on first response, then universal bindings attach without rebuilding the whole subtree.< /AccordionPanel>
259289 < /Accordion>
260- < Tabs>
261- < TabList>
262- < TabActive> Overview< /TabActive>
263- < Tab> Tokens< /Tab>
264- < Tab> Usage< /Tab>
265- < /TabList>
266- < TabPanel> Tab primitives are available as SSR-safe shells and can gain richer active-state behavior later.< /TabPanel>
267- < /Tabs>
290+ < TabsShowcase />
268291 < Pagination>
269292 < PageItem href="#" > Prev< /PageItem>
270293 < PageItemActive href="#" > 1 < /PageItemActive>
0 commit comments