Client component

Checkbox Card

A card-shaped checkbox: the whole surface is the click target, with room for a title, description and leading addon. It joins Checkbox.Group exactly like Checkbox does: give it a value inside a group and selection accumulates.

Import#

import { CheckboxCard, Checkbox } from "astralis-ui";

Usage#

Put the cards inside a Checkbox.Group and give each a value: the group owns the selection, so defaultValue, value/onValueChange and disabled all work exactly as they do for plain checkboxes. On its own, a card is a single checkbox with the native checked/defaultChecked API.

addon puts an icon or avatar beside the copy, and size="sm" tightens the card for dense settings lists. Because each card is a real checkbox, the group submits with a native form and every card is its own tab stop.

Props#

Extends the native checkbox input's props, plus:

PropTypeDefaultDescription
childrenReactNodeNoneCard title.
descriptionReactNodeNoneSecondary line under the title.
addonReactNodeNoneLeading slot for an icon or avatar.
checked / defaultChecked / onChangeboolean / boolean / (event) => voidNoneThe native checkbox API. Inside a Checkbox.Group, pass value instead.
valuestringNoneIdentifies the card inside a Checkbox.Group.
indicatorbooleantrueShows a tick in the corner while checked.
size"sm" | "md" | "lg""md"Padding and text scale.
colorSchemeall 15 schemes"brand"Hue of the checked card.
invalidbooleanfalseError styling and aria-invalid.
disabledbooleanfalseBlocks interaction. Inherited from a Checkbox.Group or Field.

Keyboard#

KeyAction
Tab / Shift+TabMove to the next / previous card
SpaceToggle the focused card

For single selection, use Radio Card.