Skip to content
Harness Design System Harness Design System Harness Design System

CardSelect

beta

The CardSelect component provides an accessible and customizable card-based selection interface. It supports both single and multiple selection modes, making it suitable for forms, settings, and decision workflows.

Usage

import { CardSelect } from "@harnessio/ui/components";
// ...
return (
<CardSelect.Root type="single">
<CardSelect.Item value="option-1" icon="branch">
<CardSelect.Title>Option 1</CardSelect.Title>
<CardSelect.Description>With an icon</CardSelect.Description>
</CardSelect.Item>
<CardSelect.Item value="option-2" logo="jira">
<CardSelect.Title>Option 2</CardSelect.Title>
<CardSelect.Description>With a logo</CardSelect.Description>
</CardSelect.Item>
</CardSelect.Root>
)

Selection Modes

The CardSelect supports two selection types:

Orientation

Cards can be arranged horizontally or vertically:

Gap

Control the gap between cards using the gap prop:

Icons and Logos

Cards can display either an icon or a logo:

Disabled

Cards can be disabled either individually or as a group:

API Reference

Root

The CardSelect.Root is the top-level wrapper that controls selection state.

<CardSelect.Root
type="single" // Required: 'single' or 'multiple'
value={selectedValue} // [OPTIONAL] For controlled usage
defaultValue={defaultValue} // [OPTIONAL] For selecting item initially
onValueChange={handleChange} // [OPTIONAL] Selection change handler
orientation="horizontal" // [OPTIONAL] Card layout direction
gap="md" // [OPTIONAL] Space between cards
disabled={false} // [OPTIONAL] Disable all selections
>
{/* CardSelect.Item components */}
</CardSelect.Root>
PropRequiredDefaultType
typetrue'single' | 'multiple'
valuefalseundefined | []unknown | unknown[]
defaultValuefalseundefinedunknown | unknown[]
onValueChangefalseundefined(val: unknown) => void | (val: unknown[]) => void
orientationfalse'vertical''horizontal' | 'vertical'
gapfalse'md''sm' | 'md' | 'lg'
disabledfalsefalseboolean

Item

Represents an individual selectable card option.

<CardSelect.Item
value="unique-id" // Required: Unique identifier
icon="branch" // [OPTIONAL] Icon to display
logo="gitlab" // [OPTIONAL] Logo instead of icon
disabled={false} // [OPTIONAL] Disable this item
>
{/* CardSelect.Title and CardSelect.Description */}
</CardSelect.Item>
PropRequiredDefaultType
valuetruestring
iconfalsestring
logofalsestring
disabledfalsefalseboolean

Title

Displays the main heading for a card item.

<CardSelect.Title>
Option Title
</CardSelect.Title>
PropRequiredDefaultType
childrentrueReactNode

Description

Provides additional details for a card item.

PropRequiredDefaultType
childrentrueReactNode