Advanced Forms component
Toggle Count
Theme-aware, responsive toggle count component.
23 props0 slots2 outputsTheme readyResponsive
Interactive playground
Configure Toggle Count
Change any prop and inspect the server-rendered component immediately.
Live preview
page ToggleCountExample {
state items = [
{
"title": "Starter",
"label": "Starter",
"description": "For individuals getting started.",
"monthly": 12,
"annual": 120
},
{
"title": "Team",
"label": "Team",
"description": "For teams working together.",
"monthly": 29,
"annual": 290
}
]
view {
<ToggleCount
secondLabel="Yearly"
ariaLabel="Toggle Count 1 example"
items="{items}"
align="start"
fullWidth="false"
/>
}
}
Event outputInteract with the preview to inspect the typed
payload.Live examples
Designed for real product surfaces
Compare configurations and resize the browser to check responsive behavior.
Recommended
01
Production default
Balanced spacing, hierarchy, and content for the most common product workflow.
Live preview
page ToggleCountExample {
state items = [
{
"title": "Starter",
"label": "Starter",
"description": "For individuals getting started.",
"monthly": 12,
"annual": 120
},
{
"title": "Team",
"label": "Team",
"description": "For teams working together.",
"monthly": 29,
"annual": 290
}
]
view {
<ToggleCount
secondLabel="Yearly"
ariaLabel="Toggle Count 1 example"
items="{items}"
align="start"
fullWidth="false"
/>
}
}
Dense UI
02
Compact application
A tighter variation for dashboards, side panels, tables, and operational interfaces.
Live preview
page ToggleCountExample {
state items = [
{
"title": "Starter",
"label": "Starter",
"description": "For individuals getting started.",
"monthly": 12,
"annual": 120
},
{
"title": "Team",
"label": "Team",
"description": "For teams working together.",
"monthly": 29,
"annual": 290
}
]
view {
<ToggleCount
size="sm"
variant="secondary"
secondLabel="Yearly"
ariaLabel="Toggle Count 2 example"
items="{items}"
align="center"
fullWidth="false"
/>
}
}
Extended
03
Rich configuration
A more expressive variation using additional data, stronger emphasis, and optional states.
Live preview
page ToggleCountExample {
state items = [
{
"title": "Starter",
"label": "Starter",
"description": "For individuals getting started.",
"monthly": 12,
"annual": 120
},
{
"title": "Team",
"label": "Team",
"description": "For teams working together.",
"monthly": 29,
"annual": 290
}
]
view {
<ToggleCount
size="lg"
variant="success"
secondLabel="Yearly"
ariaLabel="Toggle Count 3 example"
items="{items}"
/>
}
}
Component outputs
Receive every typed component output
Use declarative output handlers in .wrn files or register a direct output handler from JavaScript. The canonical API exposes payload and does not require event.detail.
@changeFires when the component's committed value or selection changes.@toggleFires when the component changes between open and closed or on and off states.<ToggleCount
@change='console.log(payload)'
@toggle='console.log(payload)'
/>import { registerOutputHandler } from "@wrnexus/csr/outputs"
const component = document.querySelector("[data-ui-component=\"ToggleCount\"], [data-component=\"ToggleCount\"]")
if (component) registerOutputHandler(component, "change", (payload) => {
console.log("change", payload)
})
if (component) registerOutputHandler(component, "toggle", (payload) => {
console.log("toggle", payload)
})Component API
Props and configuration
All content and behavior shown above is supplied through these props and slots.
| Prop | Type | Default | Required |
|---|---|---|---|
size | string | "default" | No |
color | string | "primary" | No |
variant | string | "segmented" | No |
class | string | "" | No |
name | string | "billing-cycle" | No |
value | string | "monthly" | No |
firstValue | string | "monthly" | No |
firstLabel | string | "Monthly" | No |
secondValue | string | "annual" | No |
secondLabel | string | "Annual" | No |
ariaLabel | string | "Billing frequency" | No |
items | unknown[] | [] | No |
currency | string | "$" | No |
suffix | string | "" | No |
firstValueKey | string | "monthly" | No |
secondValueKey | string | "annual" | No |
emptyValue | string | "—" | No |
align | string | "end" | No |
fullWidth | boolean | true | No |
disabled | boolean | false | No |
animate | boolean | true | No |
animationDuration | number | 450 | No |
animationSteps | number | 18 | No |