dreamstack/examples/callback-demo.ds

24 lines
760 B
Text
Raw Normal View History

-- DreamStack Callback Demo
-- Tests component event callbacks
import { Card } from "../registry/components/card"
import { Button } from "../registry/components/button"
let count = 0
let message = "Click a button"
view main = column [
text "🔗 Component Callbacks" { variant: "title" }
text "Components can trigger parent actions" { variant: "subtitle" }
Card { title: "Using Button Component", subtitle: "callback props" } [
text "Count: {count}" { variant: "title" }
text message { variant: "subtitle" }
row [
Button { label: "+1", onClick: count += 1, variant: "primary" }
Button { label: "-1", onClick: count -= 1, variant: "secondary" }
Button { label: "Reset", onClick: count = 0, variant: "ghost" }
]
]
]