// Generated by scripts/generate-showcase.mjs. Do not edit directly.
page ButtonGroupDetail {
layout = "showcase"
state playground_items = JSON.parse(ctx.url.searchParams.get("pg_items") ?? "[{\"label\":\"Day\",\"value\":\"day\"},{\"label\":\"Week\",\"value\":\"week\"},{\"label\":\"Month\",\"value\":\"month\"}]")
state playground_value = ctx.url.searchParams.get("pg_value") ?? "week"
state playground_size = ctx.url.searchParams.get("pg_size") ?? "md"
state playground_color = ctx.url.searchParams.get("pg_color") ?? "primary"
state playground_variant = ctx.url.searchParams.get("pg_variant") ?? "default"
state playground_orientation = ctx.url.searchParams.get("pg_orientation") ?? "horizontal"
state playground_responsive = (ctx.url.searchParams.get("pg_responsive") ?? "false") === "true"
state playground_attached = (ctx.url.searchParams.get("pg_attached") ?? "true") === "true"
state playground_selectable = (ctx.url.searchParams.get("pg_selectable") ?? "true") === "true"
state playground_toolbar = (ctx.url.searchParams.get("pg_toolbar") ?? "false") === "true"
state playground_disabled = (ctx.url.searchParams.get("pg_disabled") ?? "false") === "true"
state playground_ariaLabel = ctx.url.searchParams.get("pg_ariaLabel") ?? "Button group"
state playground_class = ctx.url.searchParams.get("pg_class") ?? ""
seo {
title = "Button Group"
description = "Theme-aware, responsive button group component."
}
view {
Components / Base / Button Group
Interactive playground Configure Button Group Change any prop and inspect the server-rendered component immediately.
Live preview
page ButtonGroupExample {
state items = [
{
"label": "Day",
"value": "day"
} ,
{
"label": "Week",
"value": "week"
} ,
{
"label": "Month",
"value": "month"
}
]
view {
<ButtonGroup
items="{ items} "
value="week"
selectable="true"
/>
}
}
Event output Interact 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.
page ButtonGroupExample {
state items = [
{
"label": "Day",
"value": "day"
} ,
{
"label": "Week",
"value": "week"
} ,
{
"label": "Month",
"value": "month"
}
]
view {
<ButtonGroup
items="{ items} "
value="week"
selectable="true"
/>
}
}
page ButtonGroupExample {
state items = [
{
"label": "Day",
"value": "day"
} ,
{
"label": "Week",
"value": "week"
} ,
{
"label": "Month",
"value": "month"
}
]
view {
<ButtonGroup
items="{ items} "
value="week"
size="sm"
selectable="true"
/>
}
}
page ButtonGroupExample {
state items = [
{
"label": "Day",
"value": "day"
} ,
{
"label": "Week",
"value": "week"
} ,
{
"label": "Month",
"value": "month"
}
]
view {
<ButtonGroup
items="{ items} "
value="week"
attached="false"
selectable="true"
/>
}
}
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.
@clickFires when the interactive surface is activated.
@selectFires when an item, option, card, or result is selected.
@changeFires when the component's committed value or selection changes.
<ButtonGroup
@click='console.log(payload)'
@select='console.log(payload)'
@change='console.log(payload)'
/> Direct output handlers.js import { registerOutputHandler } from "@wrnexus/csr/outputs"
const component = document.querySelector("[data-ui-component=\"ButtonGroup\"], [data-component=\"ButtonGroup\"]")
if (component) registerOutputHandler(component, "click", (payload) => {
console.log("click", payload)
} )
if (component) registerOutputHandler(component, "select", (payload) => {
console.log("select", payload)
} )
if (component) registerOutputHandler(component, "change", (payload) => {
console.log("change", payload)
} )
Component API Props and configuration All content and behavior shown above is supplied through these props and slots.
Prop Type Default Required itemsunknown[] []No valuestring ""No sizestring "md"No colorstring "primary"No variantstring "default"No orientationstring "horizontal"No responsiveboolean falseNo attachedboolean trueNo selectableboolean falseNo toolbarboolean falseNo disabledboolean falseNo ariaLabelstring "Button group"No classstring ""No
}
}