Primary action
The standard high-emphasis action for forms and product workflows.
<Button
label="Save & Submit"
as="button"
type="submit"
/>
// Generated by scripts/generate-showcase.mjs. Do not edit directly.
page ButtonDetail {
layout = "showcase"
state playground_label = ctx.url.searchParams.get("pg_label") ?? "Save & Submit"
state playground_loadingLabel = ctx.url.searchParams.get("pg_loadingLabel") ?? "Loading…"
state playground_description = ctx.url.searchParams.get("pg_description") ?? ""
state playground_as = ctx.url.searchParams.get("pg_as") ?? "button"
state playground_href = ctx.url.searchParams.get("pg_href") ?? ""
state playground_target = ctx.url.searchParams.get("pg_target") ?? ""
state playground_rel = ctx.url.searchParams.get("pg_rel") ?? ""
state playground_type = ctx.url.searchParams.get("pg_type") ?? "submit"
state playground_variant = ctx.url.searchParams.get("pg_variant") ?? "default"
state playground_color = ctx.url.searchParams.get("pg_color") ?? "primary"
state playground_size = ctx.url.searchParams.get("pg_size") ?? "default"
state playground_disabled = (ctx.url.searchParams.get("pg_disabled") ?? "false") === "true"
state playground_loading = (ctx.url.searchParams.get("pg_loading") ?? "false") === "true"
state playground_pill = (ctx.url.searchParams.get("pg_pill") ?? "false") === "true"
state playground_fullWidth = (ctx.url.searchParams.get("pg_fullWidth") ?? "false") === "true"
state playground_icon = ctx.url.searchParams.get("pg_icon") ?? ""
state playground_iconPosition = ctx.url.searchParams.get("pg_iconPosition") ?? "start"
state playground_ariaLabel = ctx.url.searchParams.get("pg_ariaLabel") ?? ""
state playground_ariaPressed = ctx.url.searchParams.get("pg_ariaPressed") ?? ""
state playground_ariaExpanded = ctx.url.searchParams.get("pg_ariaExpanded") ?? ""
state playground_ariaControls = ctx.url.searchParams.get("pg_ariaControls") ?? ""
state playground_title = ctx.url.searchParams.get("pg_title") ?? ""
state playground_autofocus = (ctx.url.searchParams.get("pg_autofocus") ?? "false") === "true"
state playground_controlClass = ctx.url.searchParams.get("pg_controlClass") ?? ""
state playground_class = ctx.url.searchParams.get("pg_class") ?? "showcase-instance showcase-instance--1"
seo {
title = "Button"
description = "Theme-aware, responsive button component."
}
view {
Theme-aware, responsive button component. Change any prop and inspect the server-rendered component immediately.Button
Configure Button
<Button
label="Save & Submit"
as="button"
type="submit"
/>payload.
Compare configurations and resize the browser to check responsive behavior.
The standard high-emphasis action for forms and product workflows.
<Button
label="Save & Submit"
as="button"
type="submit"
/>
A compact link button with an end icon and restrained emphasis.
<Button
label="Learn more"
as="a"
href="#button-demo"
variant="outline"
size="sm"
icon="icon-[lucide--arrow-right]"
iconPosition="end"
/>
A large secondary action using the optional pill shape.
<Button
label="Upgrade plan"
as="button"
variant="secondary"
size="lg"
pill="true"
/>
An icon-only control with its accessible name supplied through props.
<Button
label="Open settings"
as="button"
variant="ghost"
size="icon"
icon="icon-[lucide--settings]"
ariaLabel="Open settings"
/>
A destructive treatment for irreversible or high-risk operations.
<Button
label="Delete project"
as="button"
variant="destructive"
icon="icon-[lucide--trash-2]"
/>
A low-chrome action that behaves and reads like an inline link.
<Button
label="Read documentation"
as="a"
href="#button-demo"
variant="link"
/>
The button owns its busy state, loading label, spinner, and disabled behavior.
<Button
label="Publish"
loadingLabel="Publishing…"
as="button"
loading="true"
/>
A visibly and semantically disabled control.
<Button
label="Unavailable action"
as="button"
variant="outline"
disabled="true"
/>
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.@focusFires when the interactive control receives focus.@blurFires when focus leaves the interactive control.<Button
@click='console.log(payload)'
@focus='console.log(payload)'
@blur='console.log(payload)'
/>import { registerOutputHandler } from "@wrnexus/csr/outputs"
const component = document.querySelector("[data-ui-component=\"Button\"], [data-component=\"Button\"]")
if (component) registerOutputHandler(component, "click", (payload) => {
console.log("click", payload)
})
if (component) registerOutputHandler(component, "focus", (payload) => {
console.log("focus", payload)
})
if (component) registerOutputHandler(component, "blur", (payload) => {
console.log("blur", payload)
})All content and behavior shown above is supplied through these props and slots.
| Prop | Type | Default | Required |
|---|---|---|---|
label | string | "Button" | No |
loadingLabel | string | "Loading…" | No |
description | string | "" | No |
as | string | "" | No |
href | string | "" | No |
target | string | "" | No |
rel | string | "" | No |
type | string | "button" | No |
variant | string | "default" | No |
color | string | "primary" | No |
size | string | "default" | No |
disabled | boolean | false | No |
loading | boolean | false | No |
pill | boolean | false | No |
fullWidth | boolean | false | No |
icon | string | "" | No |
iconPosition | string | "start" | No |
ariaLabel | string | "" | No |
ariaPressed | string | "" | No |
ariaExpanded | string | "" | No |
ariaControls | string | "" | No |
title | string | "" | No |
autofocus | boolean | false | No |
controlClass | string | "" | No |
class | string | "" | No |