Radio cards
Selectable radio cards with a measured sliding selection ring.
npx @swipeui/cli add radio-cardsWhen to use it
- Picking a plan, shipping option or payment method where each choice deserves a card with a description.
- Onboarding questions with a few rich answers.
- Comparisons where the selected card should clearly stand out with a ring.
When not to use it
- Long lists. Use Select or a list.
- Multiple choices. Use Chip group or checkboxes.
- Plain options without descriptions. Radio group's rows variant is lighter.
Installation
Run this from your app's root. If SwipeUI isn't set up yet, run npx @swipeui/cli init first; it sets up Uniwind, the theme tokens and the cn helper.
npx @swipeui/cli add radio-cards- Adds
components/swipeui/ui/use-radio-cards.ts,components/swipeui/ui/radio-cards.tsxand 13 shared helpers. - Installs react-native-reanimated, uniwind, react-native-worklets, clsx, tailwind-merge, expo-haptics, class-variance-authority, react-native-svg, react-native-gesture-handler. In Expo apps it uses
npx expo installso versions match your SDK.
Usage
import { RadioCards } from '@/components/swipeui/ui/radio-cards';
<RadioCards options={plans} />;Examples
Use the variant and appearance controls in the live specimen to compare the documented states. The application owns validation, operation results and persistence.
API reference
RadioCardsProps
| Prop | Type | Default | Description |
|---|---|---|---|
options | | — | Cards in reading order. |
value? | | — | Controlled selection. |
defaultValue? | | | Initial selection. |
onValueChange? | | — | Reports a newly selected card. |
layout? | | | Grid, full-width stack, or settle-select carousel. |
minColumnWidth? | | | Minimum grid column width in points. |
indicator? | | | Drawn selected mark. |
highlight? | | | Gliding ring or no ring. |
orientation? | | — | Legacy reading axis; vertical maps to stack, horizontal to grid. |
disabled? | | | Disable every card. |
typeahead? | | | Typed label navigation. |
haptics? | | | Selection and carousel detent channels. |
motion? | | | Ring and mark motion. |
messages? | | | Built-in unavailable hint. |
accessibilityLabel? | | — | Spoken group name. |
className? | | — | Root classes. |
style? | | — | Root style. |
testID? | | — | Identifier; each card appends its value. |
Native view/input props not listed here pass through where the exported TypeScript type allows them.
Cards can supply a decorative background node; titles stay bold and badges sit at the bottom end. Grid surfaces stretch to match the selected ring.
Radio cards settings
| Prop | Does | Default |
|---|---|---|
| haptics | Enables selection or press feedback | true |
| motion | Overrides the app's motion feel | App feel |
| layout | Responsive grid, full-width stack or settle-select carousel | grid |
| minColumnWidth | Minimum grid column width, in points | 156 |
| indicator | Drawn dot, check or no mark | dot |
| highlight | Gliding resizing ring; snaps on layout | glide |
| typeahead | Jump by typing the label | true |
| disabled | Disable all cards | false |
| messages | Translate built-in hints | English |
| orientation | Legacy vertical stack or horizontal grid | Unset |
Composition and behavior
The carousel selects at momentum end. Scrolling past a card does not select it. Taps and keyboard navigation remain available. Options accept meta for rich content, badge, icon and disabledReason.
- Radio group with the cards variant and a sliding selection ring.
- Cards use your card radius, so presets reshape them.
Behavior and gestures
- Tap a card to select it; a selection ring slides to it with a light tick.
- Tapping the selected card keeps it selected.
- Disabled cards dim and can't be picked.
Accessibility
- Works like Radio group: a radio group of radios with checked state and descriptions as hints.
- Each card is a single, large target.
- Name the group with accessibilityLabel.
Motion
- Uses the
select,toggleandpressmotion roles, so it follows your app's feel. Passmotionto tune this one instance. - The ring measures each card and slides with the select spring.
- Reduce Motion moves it instantly.
Performance
- A preset of Radio group with the same cost.
Notes for AI
- Write short descriptions so cards stay even in height.
Compatibility
| Runs on | Supported |
|---|---|
| Expo SDK 57 | Yes |
| Expo SDK 58 | Yes |
| React Native CLI (with Expo modules) | Yes |
| Expo Go | Yes |
| iOS | Yes |
| Android | Yes |
This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.