Your next page is taking shape...

Opening Your Next Page…

Loading the guide and preparing its examples for you to explore. The page will appear here automatically when it’s ready, so you can keep this view open without refreshing.

Made for Preact. Built to be yours.

Forms & Input

Selectable Card

Card-style radio options for plan pickers, delivery choices, and other single-select layouts. Make the expected input clear before someone interacts, and keep the current value, help text and validation feedback connected. Import it from @/components/kamod-ui/selectable-card.

Source · API reference · Theming · Styles


Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width

Installation

Import SelectableCard from @/components/kamod-ui/selectable-card and wrap it in RadioGroup.

Install PackagesTerminal
pnpm add @kamod-ch/ui

Copy an example with @kamod-ch/ui or the matching @kamod-ch/ui/… subpath. The code block switches between those two installs. Connect The Global Theme CSS and Tailwind Source Detection before your first render.

Usage

Use SelectableCard when you want radio semantics with a larger click target. Keep the option text inside the card so the radio gets a clear accessible name. Use defaultValue for uncontrolled groups, or value with onValueChange when the parent owns state.

Import SetupTypeScript
import { SelectableCard } from "@kamod-ch/ui";

Choose a complete composition from the examples below; required child components and props vary by pattern.

Component Examples & Variants

Explore Selectable Card in Different Contexts, from the starting pattern to the compositions below. Begin with Demo, then compare the examples that match your content, state and layout. These are working patterns to adapt, not a list of interchangeable variant values: check the API Reference before using a prop or combining behaviors. Look at the surrounding labels, supporting text and spacing as well as the component itself.

Read the Result and Its Implementation Together. Use each showcase’s Code view to inspect imports and composition, or its Prompt view to prepare a setup or adaptation brief. Try the narrow preview and local theme controls before connecting real data, and use Reset to return an example to its initial state. Keep layout changes in class utilities where appropriate; follow the Component Styles Guide for hierarchy and the Theming Guide for shared surfaces and colors. The Accessibility Notes explain what to preserve when making those changes.

Demo

Compare Options with More Context than a Short Label. Use SelectableCard for radio-like infrastructure choices that benefit from a title and supporting details. The card surface makes comparison easier while the selected value still represents one option in a shared decision.

Keep the group question clear, use stable option identifiers and avoid adding nested actions that compete with selecting the card.

src/components/SelectableCardExample.tsx18 lines
import { RadioGroup, SelectableCard } from "@kamod-ch/ui";

export const Example = () => (
  <RadioGroup defaultValue="kubernetes" class="grid max-w-md gap-3">
    <SelectableCard value="kubernetes">
      <div class="grid gap-1">
        <p class="text-sm font-medium leading-none">Kubernetes</p>
        <p class="text-sm text-muted-foreground">Best for clustered workloads and autoscaling.</p>
      </div>
    </SelectableCard>
    <SelectableCard value="virtual-machine">
      <div class="grid gap-1">
        <p class="text-sm font-medium leading-none">Virtual machine</p>
        <p class="text-sm text-muted-foreground">Good for predictable apps and direct control.</p>
      </div>
    </SelectableCard>
  </RadioGroup>
);

Disabled State

Explain the Unavailable Option without Hiding It. Disable a selectable card when its option cannot currently be chosen. Keep its content in the same structure as available choices so readers can compare the alternatives and understand the reason for the restriction.

Keep that reason readable outside an inaccessible action, and ensure the active selection remains valid if available choices change during the workflow.

Interactive Live Preview
Try it. Make it yours.
Setting the scene...

Interactive preview

Live Preact example Local preview theme · Responsive styles follow the preview widthFull width
API reference

Props and Data

Configure Selectable Card using the contracts below. Read the documented options alongside the Source Definitions to understand which values your application supplies and which details the component owns. Start with a prop or helper, then follow its type link to inspect the declaration without leaving the page.

Props, slots and variants for this component.

API reference
Your API, from source

Type cards are extracted from this checkout’s TypeScript source at build time. Props inherited through HTMLAttributes, Omit or variant helpers remain references in those declarations; their fields are not flattened here. Match the reference to your installed version, and check a package’s exports before writing an import type. A type exported by a source file is not necessarily re-exported by @kamod-ch/ui.

Component Props

Read each option with its owning component. The
marker identifies required fields verified in that declaration. A ? means a field can be omitted; it does not promise a fallback value. Existing documented defaults remain alongside the descriptions. For callbacks, check the argument and return types before connecting your own state or services.
@kamod-ch/ui/selectable-card7.1 KB min · 2.1 KB gzipSignals: none

SelectableCard

SelectableCardProps

SelectableCard documented props
Prop / typeDescription
children
ComponentChild[] | ComponentChildSelectableCardProps

Configure children for SelectableCard. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
class
stringSelectableCardProps

Configure class for SelectableCard. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
disabled
boolean | SignalLike<boolean | undefined>SelectableCardProps

Configure disabled for SelectableCard. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
onChange
GenericEventHandler<HTMLInputElement>SelectableCardProps

Configure onChange for SelectableCard. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—
value
Signalish<string | number | undefined> & stringSelectableCardProps

Configure value for SelectableCard. Compare its accepted type with the Usage Guidance before supplying a value.

Default
—

Data Type Reference

Expand a card to inspect and copy the exact declaration. The code header identifies its repository file; follow imported or inherited types in the Implementation Source when you need the complete dependency chain. Required-field summaries cover fields declared directly in that type. Source-only helpers and inferred schema outputs describe the local implementation, not additional props you can pass to every component.

SelectableCard Props

3 declared fields
SelectableCardProps
Exported Source Declaration from SelectableCard.tsx. Referenced types retain their original names; inspect that file for imports and supporting definitions. Inspect the Complete Definition of SelectableCardProps before adapting it.
Required fields
value

Accessibility

Build the Complete Interaction, Including the Parts Outside Selectable Card. The notes below distinguish the current implementation from the labels, content and behavior your application supplies. Start with the Live Preview, check the Props and Data Reference, and test the finished composition with real content rather than assuming that an unchanged visual example covers every use case.

Built-in Behavior and Defaults

SelectableCard is a card-shaped native radio option for RadioGroup. The hidden input carries checked state and the surrounding label contains the visible card content. Selection styling is distinct from keyboard focus and must be checked separately.

Labels and Relationships

Keep a short option title at the start, followed by the details needed to compare choices. Name the parent RadioGroup's question. Avoid putting independent links or buttons inside the card label; place detail actions outside the selectable surface.

Keyboard and Focus

Use the native radio group interaction rather than adding click-only card selection. The current card styling suppresses default input outlines, so provide and verify a visible focus-within treatment on the card when integrating it.

States and Integration Details

A selected border is not sufficient feedback for an unselected card that has keyboard focus. Long card descriptions can also make names verbose; use an explicit title association on the input where needed and keep supporting information discoverable.

Verify the Complete Interaction

Check Behavior as Well as Markup. Work through these scenarios in the application where the component will be used. Automated checks can help find structural problems; also review the reading experience with a screen reader, keyboard focus and the actual feedback from your application.

  1. Tab into the group and move selection with arrow keys while watching the focused card.
  2. Confirm the chosen card is announced as a checked radio, not as a generic clickable container.
  3. Compare cards at narrow widths and enlarged text without truncating prices, restrictions or focus feedback.

Recheck the result after changing Theme Tokens, translations or class overrides. Include text enlargement, narrow layouts and reduced-motion settings where animation is present. Inspect the Component Source when a behavior differs from your expectation; a role or state attribute does not implement keyboard interaction by itself.

For background, read the WAI-ARIA Authoring Guidance and Keyboard Interface Guidance. These explain the patterns; verify browser and assistive-technology behavior for the implementation and audience you actually support.

Take the Next Useful Step

You have the pieces. Put them into one real interaction, keep its state in one place, and check the result with the content your application will actually show.

Connect the Foundation

Return to Choose and Compose Components to connect this reference to a working screen. Keep global CSS in one entrypoint and import only the components that screen needs.

Build the Surrounding Screen

Find a neighboring interaction in the Component Library, or start with a complete Block. Replace sample content and destinations before refining the layout; a local class change can stay with the composition.

Make the Result Hold Up

Use shared theme roles for changes that belong everywhere. Then review the whole journey: keyboard focus, long labels, narrow screens and a clear way to recover when something fails.

Keep a link to the source and note your intentional changes. Your next edit should begin with a clear decision, not another search.