Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

Components / Core

ChoiceCard

A large, card-shaped radio or checkbox, for choices that deserve more room than a plain Radio ("1440p", "Quiet build"). It is a real <input> inside a <label>, so arrow keys, Space, forms and screen readers work like any radio or checkbox. Group radios with the same name, inside a FieldSet with a legend.

import { ChoiceCard } from "@stylhero/ui";

Example

Code
import { ChoiceCard, Stack, StarIcon } from "@stylhero/ui";

function ChoiceCardExample() {
  return (
    <Stack gap={3}>
      <ChoiceCard name="plan" value="basic" label="Basic" description="One project, community support" defaultChecked />
      <ChoiceCard name="plan" value="pro" label="Pro" description="Unlimited projects, email support" />
      <ChoiceCard type="checkbox" label="Yearly billing" description="Two months free" icon={<StarIcon />} />
    </Stack>
  );
}

Props

PropTypeDefaultDescription
label required ReactNode -
description ReactNode - Smaller text under the label, e.g. a price or what the option means.
icon ReactNode - Shown before the text, e.g. a Lucide icon. Decorative: hidden from screen readers.
type "radio" | "checkbox" "radio" "radio" (default) picks one of a group with the same name; "checkbox" toggles.

Also takes every <input> attribute (id, style, data-*, aria-*, event handlers…), passed to that element. Takes a ref.

Keyboard

KeyDoes
Space / Arrow keysSame as a native checkbox or radio

Accessibility

  • The whole card is the label of a native input, so it's announced and toggled like one.

Generated from src/components/ChoiceCard.tsx. Something wrong or missing? Open an issue.