Eidetic

Selection Card

Forms
Selection

Card-based selection component for radio-style single choice options.

Preview

Select a display density option

Display Density

Selected: comfortable

Without Icons

Simple text-only selection cards

Theme Preference

Custom Active Badge

Customize the badge shown on selected items

Choose a plan

Disabled State

Options that cannot be selected

Props

Component API reference

SelectionCard

PropTypeDefaultDescription
id*stringUnique identifier
label*stringMain label text
descriptionstringOptional description text
iconReactNodeIcon element to display
selectedbooleanfalseWhether option is selected
disabledbooleanfalseWhether option is disabled
activeBadgestring'Active'Badge text when selected
onClick(id: string) => voidClick handler

SelectionCardGroup

PropTypeDefaultDescription
children*ReactNodeSelectionCard components
valuestringCurrently selected value
onChange(value: string) => voidSelection change handler
labelstringGroup label text
classNamestringAdditional CSS classes

Usage

Import and implementation examples

import { SelectionCard, SelectionCardGroup } from '@/components/ui/selection-card'
import { Layout, Minimize2, Maximize2 } from 'lucide-react'
// Using SelectionCardGroup for automatic state management
<SelectionCardGroup
value={selected}
onChange={setSelected}
label="Choose an option"
>
<SelectionCard
id="option-1"
label="Option One"
description="First option description"
icon={<Layout className="w-5 h-5" />}
/>
<SelectionCard
id="option-2"
label="Option Two"
description="Second option description"
icon={<Minimize2 className="w-5 h-5" />}
/>
</SelectionCardGroup>
// Individual cards with manual state
<SelectionCard
id="single"
label="Single Card"
description="Manually controlled"
selected={isSelected}
onClick={(id) => setIsSelected(true)}
activeBadge="Selected"
/>

Features

Built-in functionality

  • Icon support: Optional icon container with automatic styling
  • Active indicator: Circular checkbox with check icon when selected
  • Custom badge: Customizable badge text for selected state
  • Full-width clickable: Entire card is the click target
  • Group component: SelectionCardGroup for automatic state management
  • Disabled state: Visual indication and interaction prevention
  • Dark mode: Full dark mode support with adjusted colors

Accessibility

Accessibility considerations

ARIA Attributes

SelectionCardGroup uses role="radiogroup"Cards use role="radio" with aria-checkedDisabled state uses aria-disabled

Keyboard Navigation

KeyAction
TabNavigate between cards
Arrow keysMove selection within group
Enter / SpaceSelect focused card

Notes

  • Focus ring visible on keyboard navigation
  • Selected state clearly indicated visually
  • Disabled cards skip in tab order

Related Components