A wider screen, please

This page features interactive demos and side-by-side code samples that need at least 340 pixels of horizontal space. Please widen your browser window, or rotate your device, to continue.

Morpheus v0.1.0
v0.1.0

Radio group#

Component <neo-radio-group> is a set of mutually-exclusive <neo-radio> options. The host owns selection and roving-tabindex. Activation is manual by default (like <neo-tabs>): arrow keys move focus and Enter / Space commit; add auto-activate to select on arrow. Wrap a radio in a <label> to make the whole row clickable.

Default
Horizontal
Rich rows
Disabled
Auto-activate
Deactivate Rename Duplicate
Delete
New state Toggle autoplay
HTML CSS

The selected state's markup and its scoped CSS. The CSS is wrapped in <style>@scope { ... }</style> and applies to the preview only. Edits change the preview above, applied live while Sync is on, or when you click Patch or Replace. Patch morphs the preview; Replace swaps it outright.

Replace Patch

Signals

Datastar signals declared in the selected state's markup. Change a value to drive the preview, applied live while Sync is on, or when you click Patch.

Patch

Reference#

Attributes #

NameTypeDefaultDescription
valuestring reflected observednoneSelected radio value. Set to empty string to clear.
disabledboolean observedfalseDisables every nested <neo-radio>.
orientation"horizontal" | "vertical"verticalLayout axis.
auto-activatebooleanfalseBy default activation is manual: arrow keys move focus and Enter / Space commit the selection (like <neo-tabs>). Set auto-activate to select a radio as soon as an arrow key focuses it.

Slots #

NameDescription
default<neo-radio> children, typically wrapped in <label>.

Events #

NameDetailBubblesDescription
neo-radio-group-change{ value: string }yesFires after the selection changes.

CSS variables #

NameDefaultDescription
--neo-radio-size1.15remRadio diameter. Drops to 0.875rem at size="sm".
--neo-radio-border-width1pxBorder width.
--neo-radio-bordervar(--btn-border)Border color when unchecked.
--neo-radio-bgtransparentBackground when unchecked.
--neo-radio-checked-bgvar(--accent)Background when checked.
--neo-radio-checked-bordervar(--accent)Border color when checked.
--neo-radio-dot-colorvar(--accent-fg)Color of the inner dot.
--neo-radio-dot-scale0.45Inner dot size as a fraction of the radio.
--neo-radio-transition-durationcalc(120ms * var(--neo-duration-scale, 1))Duration of the background and dot transitions.
--neo-radio-group-gapcalc(var(--page-spacing, 0.25rem) * 2)Gap between radios in the group.

Examples#

Horizontal#

With orientation="horizontal" the group lays out on a single row, wrapping if it overflows. Suited to short binary or trinary choices.

Rich rows#

Each radio's body can be multi-line markup: the radio sits in its own column while the label column holds a title plus a muted caption, as on a plan-picker settings page.

Disabled#

disabled on the host disables every nested radio and skips them in arrow navigation, regardless of per-radio state. The selected value is preserved, so the form still submits a meaningful answer if the gate later opens.

Auto-activate#

With auto-activate an arrow key selects the focused radio immediately, the classic radio-group behaviour. By default arrows only move focus and Enter / Space commit.

The difference is keyboard-only: Tab into the group, then press an arrow key: the selection moves at once, with no Enter or Space. Clicking behaves the same in every mode.

Settings

Theme

Default Sunshine Ocean Matrix Rose

Accessibility

Playgrounds

Server Simulator