Option

The Option component provides a reusable pattern for option in the interface.

Checkbox

A basic checkbox option with a label, name, and value — the default option type.

Radio buttons

Radio buttons sharing the same name attribute form a group where only one option can be selected at a time.

Pre-checked state

Setting the checked parameter to true renders the option pre-selected on load, for both checkbox and radio types.

Required

Setting required to true adds HTML5 validation attributes so the field must be interacted with before the form can be submitted.

Disabled

Adding the is-disabled class via classList together with the disabled HTML attribute visually disables the option and prevents interaction.

Invalid state

Adding the is-invalid class via classList applies danger-color styling to the box border and label text to signal a validation error.

Valid state

Adding the is-valid class via classList applies success-color styling to the box border and label text to confirm a correct selection.

Small size

Adding the c-option--sm modifier class via classList renders a smaller checkbox box and label font size.

Custom name

The name parameter sets the HTML name attribute on the input; when omitted, the name is derived automatically from the label text.

Value

The value parameter sets the data submitted with the form when the option is checked, allowing multiple checkboxes to share a name while returning distinct values.

Card appearance

Adding c-option--card via classList renders the option as a clickable card with border, hover, checked and focus states. Put c-option__description and c-option__aside (with --success, --danger or --warning) in the label HTML for a secondary line and a tag. The tag sits to the right of the text and moves below it when the card is narrower than 32.5em (container query). Wrap label text containing other markup in one element when using an aside.

Card appearance with checkboxes

The card appearance works for checkboxes too, with or without description and aside.

API

Parameter Default Type Description
checkbox string -
string -
false boolean -
string -
false boolean -
null ?string -

CSS API

Variable Default Type Values Description
var(--base) range - Main unit that drives radius and spacing scales.
var(--border-radius) range - Border Radius
var(--color--primary) color - Primary
var(--color--surface) color - Surface
var(--color--danger) color - Danger
var(--color--success) color - Success
var(--font-size-100) range - Base font size.
var(--color--surface-contrast) color - Used for text and icons on surface backgrounds with less contrast.
var(--color--danger-contrast) color - Danger Contrast
var(--space) range - Base spacing unit. Used for padding and margin inside components.
var(--border-width) range - Size
var(--corner-shape) select square, round, squircle, circular, bevel, scoop Corner Shape
var(--duration-160) range - For compact controls and icon changes.
var(--ease-out) select - Default deceleration curve for entering and settling interface elements.
var(--color--surface-alt) color - Manual companion token for subtle surface backgrounds.
var(--color--surface-border) color - Manual companion token for borders on surface elements.
var(--color--surface-contrast-muted) color - Derived muted contrast for text and icons on surface backgrounds.
var(--color--focus) color - Focus
var(--color--success-contrast) color - Success Contrast
var(--color--warning) color - Warning
var(--color--warning-contrast) color - Warning Contrast
var(--font-size-80) range - Two steps below base in the type scale.
var(--font-size-90) range - One step below base in the type scale.
var(--font-weight-normal) select 100, 200, 300, 400, 500, 600, 700, 800, 900 Normal Weight
var(--font-weight-bold) select 100, 200, 300, 400, 500, 600, 700, 800, 900 Bold Weight
var(--line-height-heading) range - Heading Line Height