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

Checkbox#

Component <neo-checkbox> is a three-state checkbox: checked, unchecked, or indeterminate (aria-checked="mixed") for parent rows whose children are partially selected. Participates in a wrapping <label> like a native checkbox.

Default
States
Small size
Disabled
With label
Settings group
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
checkedboolean reflected observedfalseMirrored to aria-checked.
indeterminateboolean reflected observedfalseThree-state mixed indicator.
disabledboolean observedfalseNon-interactive state.
size"sm"noneCompact size. Omit for the default size.

Events #

NameDetailBubblesDescription
neo-checkbox-change{ checked: boolean, indeterminate: boolean }yesFires after a click or Space / Enter activation.

CSS variables #

NameDefaultDescription
--neo-checkbox-size1.15remBox width and height. Drops to 0.875rem at size="sm".
--neo-checkbox-radiuscalc(var(--page-radius, 0.25rem) * 0.5)Corner radius.
--neo-checkbox-border-width1pxBorder width.
--neo-checkbox-bordervar(--btn-border)Border color when unchecked.
--neo-checkbox-bgtransparentBackground when unchecked.
--neo-checkbox-checked-bgvar(--accent)Background when checked or indeterminate.
--neo-checkbox-checked-bordervar(--accent)Border color when checked or indeterminate.
--neo-checkbox-mark-colorvar(--accent-fg)Color of the check / indeterminate mark.
--neo-checkbox-transition-durationcalc(120ms * var(--neo-duration-scale, 1))Duration of the background and mark transitions.
--neo-checkbox-markurl("data:image/svg+xml;utf8,<svg …><polyline points='5 12 10 17 19 7'/></svg>")Mask image for the checked mark. Override to swap the mark shape.
--neo-checkbox-mark-indeterminateurl("data:image/svg+xml;utf8,<svg …><line x1='5' y1='12' x2='19' y2='12'/></svg>")Mask image for the indeterminate mark.

Examples#

States#

Three states: unchecked, checked, indeterminate. Click the box or focus with Tab and toggle with Space. Input on a mixed checkbox resolves it to checked, matching the native rule.

Small size#

The size="sm" variant is a 0.875rem square, for dense rows where the default 1.15rem box would dominate.

Disabled#

disabled blocks pointer events, drops the host from the tab order, and fades it to 50% opacity. Each state still reads correctly.

With label#

Wrapping a checkbox in a <label> makes the whole row clickable: the host forwards clicks on its closest <label> ancestor and moves focus to itself, keeping the keyboard target in sync.

Settings group#

A typical settings panel: each row is its own <label>, with the checkbox on the left and the description on the right. The disabled row still shows its current value but resists interaction.

Examples: Datastar#

Tree selection#

Parent nodes go indeterminate when only some descendants are selected, checked when all are, and unchecked when none are. Each change posts to the server, which recomputes the parents and morphs the tree back into place.

Repository
Source
Read
Write
Deploy
Staging
Production
Billing
Invoices
Plan

Settings

Theme

Default Sunshine Ocean Matrix Rose

Accessibility

Playgrounds

Server Simulator