Default checkbox
Use a checkbox for an independent yes-or-no choice.
<Checkbox
id="checkbox-1"
name="checkboxField"
label="Accept notifications"
placeholder="Enter checkbox"
value="terms"
values='[]'
options='[]'
checked="true"
/>
// Generated by scripts/generate-showcase.mjs. Do not edit directly.
page CheckboxDetail {
layout = "showcase"
state playground_size = ctx.url.searchParams.get("pg_size") ?? "default"
state playground_color = ctx.url.searchParams.get("pg_color") ?? "primary"
state playground_id = ctx.url.searchParams.get("pg_id") ?? "checkbox-1"
state playground_name = ctx.url.searchParams.get("pg_name") ?? "checkboxField"
state playground_label = ctx.url.searchParams.get("pg_label") ?? "Accept notifications"
state playground_hiddenLabel = ctx.url.searchParams.get("pg_hiddenLabel") ?? "false"
state playground_placeholder = ctx.url.searchParams.get("pg_placeholder") ?? "Enter checkbox"
state playground_variant = ctx.url.searchParams.get("pg_variant") ?? "normal"
state playground_icon = ctx.url.searchParams.get("pg_icon") ?? ""
state playground_iconPosition = ctx.url.searchParams.get("pg_iconPosition") ?? "start"
state playground_value = ctx.url.searchParams.get("pg_value") ?? "terms"
state playground_values = ctx.url.searchParams.get("pg_values") ?? "[]"
state playground_options = ctx.url.searchParams.get("pg_options") ?? "[]"
state playground_checked = ctx.url.searchParams.get("pg_checked") ?? "true"
state playground_indeterminate = ctx.url.searchParams.get("pg_indeterminate") ?? "false"
state playground_orientation = ctx.url.searchParams.get("pg_orientation") ?? "vertical"
state playground_card = ctx.url.searchParams.get("pg_card") ?? "false"
state playground_rightAligned = ctx.url.searchParams.get("pg_rightAligned") ?? "false"
state playground_list = ctx.url.searchParams.get("pg_list") ?? "false"
state playground_helperText = ctx.url.searchParams.get("pg_helperText") ?? ""
state playground_cornerHint = ctx.url.searchParams.get("pg_cornerHint") ?? ""
state playground_error = ctx.url.searchParams.get("pg_error") ?? ""
state playground_inline = ctx.url.searchParams.get("pg_inline") ?? "false"
state playground_readonly = ctx.url.searchParams.get("pg_readonly") ?? "false"
state playground_disabled = ctx.url.searchParams.get("pg_disabled") ?? "false"
state playground_required = ctx.url.searchParams.get("pg_required") ?? "false"
state playground_class = ctx.url.searchParams.get("pg_class") ?? ""
seo {
title = "Checkbox"
description = "Theme-aware, responsive checkbox component."
}
view {
Theme-aware, responsive checkbox component. Change any prop and inspect the server-rendered component immediately.Checkbox
Configure Checkbox
<Checkbox
id="checkbox-1"
name="checkboxField"
label="Accept notifications"
placeholder="Enter checkbox"
value="terms"
values='[]'
options='[]'
checked="true"
/>
Compare configurations and resize the browser to check responsive behavior.
Use a checkbox for an independent yes-or-no choice.
<Checkbox
id="checkbox-1"
name="checkboxField"
label="Accept notifications"
placeholder="Enter checkbox"
value="terms"
values='[]'
options='[]'
checked="true"
/>
Represent a partially selected group with the mixed state.
<Checkbox
id="checkbox-2"
name="checkboxField"
label="Accept notifications"
placeholder="Enter checkbox"
variant="outlined"
icon="icon-[lucide--sparkles]"
value="terms"
values='[]'
options='[]'
indeterminate="true"
/>
Disable a checkbox when its choice is unavailable.
<Checkbox
id="checkbox-3"
name="checkboxField"
label="Accept notifications"
placeholder="Enter checkbox"
variant="floating"
icon="icon-[lucide--circle-user-round]"
iconPosition="end"
value="terms"
values='[]'
options='[]'
disabled="true"
/>
Render passed options as a named checkbox group.
<Checkbox
size="sm"
id="checkbox-4"
name="checkboxField"
label="Notification preferences"
placeholder="Enter checkbox"
variant="pill"
value="terms"
values='[
"product"
]'
options='[
{
"label": "Product updates",
"value": "product",
"description": ""
},
{
"label": "Account activity",
"value": "account",
"description": ""
},
{
"label": "Partner offers",
"value": "partners",
"description": ""
}
]'
orientation="horizontal"
/>
Add supporting copy to clarify each choice.
<Checkbox
id="checkbox-5"
name="checkboxField"
label="Notification preferences"
placeholder="Enter checkbox"
value="terms"
values='[
"product"
]'
options='[
{
"label": "Product updates",
"value": "product",
"description": "News about features and improvements."
},
{
"label": "Account activity",
"value": "account",
"description": "Important security and billing alerts."
},
{
"label": "Partner offers",
"value": "partners",
"description": "Relevant offers from trusted partners."
}
]'
readonly="true"
/>
Present multiple choices as selectable horizontal cards.
<Checkbox
id="checkbox-6"
name="checkboxField"
label="Notification preferences"
placeholder="Enter checkbox"
value="terms"
values='[
"product"
]'
options='[
{
"label": "Product updates",
"value": "product",
"description": "News about features and improvements."
},
{
"label": "Account activity",
"value": "account",
"description": "Important security and billing alerts."
},
{
"label": "Partner offers",
"value": "partners",
"description": "Relevant offers from trusted partners."
}
]'
orientation="horizontal"
card="true"
/>
Stack selectable checkbox cards vertically.
<Checkbox
id="checkbox-7"
name="checkboxField"
label="Notification preferences"
placeholder="Enter checkbox"
value="terms"
values='[
"product"
]'
options='[
{
"label": "Product updates",
"value": "product",
"description": "News about features and improvements."
},
{
"label": "Account activity",
"value": "account",
"description": "Important security and billing alerts."
},
{
"label": "Partner offers",
"value": "partners",
"description": "Relevant offers from trusted partners."
}
]'
card="true"
inline="true"
/>
Place checkbox controls at the far edge of their labels.
<Checkbox
id="checkbox-8"
name="checkboxField"
label="Notification preferences"
placeholder="Enter checkbox"
value="terms"
values='[
"product"
]'
options='[
{
"label": "Product updates",
"value": "product",
"description": "News about features and improvements."
},
{
"label": "Account activity",
"value": "account",
"description": "Important security and billing alerts."
},
{
"label": "Partner offers",
"value": "partners",
"description": "Relevant offers from trusted partners."
}
]'
rightAligned="true"
cornerHint="Optional"
/>
Separate checkbox options with list dividers.
<Checkbox
id="checkbox-9"
name="checkboxField"
label="Notification preferences"
placeholder="Enter checkbox"
value="terms"
values='[
"product"
]'
options='[
{
"label": "Product updates",
"value": "product",
"description": "News about features and improvements."
},
{
"label": "Account activity",
"value": "account",
"description": "Important security and billing alerts."
},
{
"label": "Partner offers",
"value": "partners",
"description": "Relevant offers from trusted partners."
}
]'
list="true"
/>
Combine list styling with a horizontal layout.
<Checkbox
id="checkbox-10"
name="checkboxField"
label="Notification preferences"
placeholder="Enter checkbox"
value="terms"
values='[
"product"
]'
options='[
{
"label": "Product updates",
"value": "product",
"description": "News about features and improvements."
},
{
"label": "Account activity",
"value": "account",
"description": "Important security and billing alerts."
},
{
"label": "Partner offers",
"value": "partners",
"description": "Relevant offers from trusted partners."
}
]'
orientation="horizontal"
list="true"
/>
Validate required checkbox choices with @wrnexus/validation.
<Checkbox
id="checkbox-11"
name="validatedField"
label="Notification preferences"
placeholder="Enter checkbox"
value="terms"
values='[
"product"
]'
options='[
{
"label": "Product updates",
"value": "product",
"description": "News about features and improvements."
},
{
"label": "Account activity",
"value": "account",
"description": "Important security and billing alerts."
},
{
"label": "Partner offers",
"value": "partners",
"description": "Relevant offers from trusted partners."
}
]'
helperText="Select at least one notification type."
required="true"
/>
Public events declared by this component. Custom events bubble from the component root and expose state through event.detail.
@inputFires immediately as the component value changes.@changeFires when the component value or selection changes.@focusFires when the component receives focus.@blurFires when focus leaves the component.@invalidFires when the component emits the invalid event.const component = document.querySelector('[data-wrn-events]')
component.addEventListener('input', (event) => {
console.log(event.detail)
})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 |
id | string | "" | No |
name | string | "" | No |
label | string | "Checkbox" | No |
hiddenLabel | boolean | false | No |
placeholder | string | "" | No |
variant | string | "normal" | No |
icon | string | "" | No |
iconPosition | string | "start" | No |
value | string | "on" | No |
values | string | [] | No |
options | string | [] | No |
checked | boolean | false | No |
indeterminate | boolean | false | No |
orientation | string | "vertical" | No |
card | boolean | false | No |
rightAligned | boolean | false | No |
list | boolean | false | No |
helperText | string | "" | No |
cornerHint | string | "" | No |
error | string | "" | No |
inline | boolean | false | No |
readonly | boolean | false | No |
disabled | boolean | false | No |
required | boolean | false | No |
class | string | "" | No |