Switch Cards
A component that presents a group of selectable cards, allowing users to choose between mutually exclusive options. Each card provides visual feedback for its selection state and can contain both title and descriptive content.
Can be controlled or uncontrolled
Full keyboard navigation
Architecture
Reference
-
Switch Cards
The root container that manages the state and behavior of the switch cards group. Coordinates the interaction between individual items and maintains the overall selection state.
-
Attributes
- aria-labelstring/default: -
Defines an accessible label for the switch when a visible label is not present.
- default-valueboolean/default: false
The initial selected values when the switch cards are rendered. Use when you do not need to control the selection state.
- valuestring/default: on
The controlled selected values of the switch cards. Must be used in conjunction with
onValueChange
.
-
-
Events
- onValueChange
Event handler called when the selection state of any switch card changes.
-
-
-
Item
The container for an individual selectable card option. Manages the selection state and visual presentation of a single choice within the group.
-
Attributes
- aria-labelstring/default: -
Defines an accessible label for the individual switch card when a visible label is not present or when additional context is needed.
- valuestring/default: -
A unique identifier for the switch card. Used to track and control the selection state.
-
-
-
Title
The container for the card's title content. Provides proper styling and layout for the main heading of each switch card.
-
Description
The container for the card's descriptive content. Allows for additional details or context to be displayed below the title.
Keyboard
- Space
Toggles the switch between checked and unchecked states.
- Enter
Toggles the switch between checked and unchecked states.