SwipeUI

Radio group

Mutually exclusive named choices with rows or card presentation.

npx @swipeui/cli add radio-group
Variant
Preset
Material
Scheme
Feel
Real free component with a browser animation bridge. Native motion, haptics and materials need a device.

When to use it

  • Choosing exactly one option where every option should be visible, such as delivery speed or plan size.
  • Options with a short description under each label.
  • Survey questions with a handful of answers.
  • Settings where comparing options side by side helps.

When not to use it

  • More than about six options. Use Select or Combobox.
  • Several choices at once. Use Checkbox or Chip group.
  • Two or three short options that switch a view. Use Segmented control.
  • Instant on/off. Use Switch.

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-group
  • Adds components/swipeui/ui/use-radio-group.ts, components/swipeui/ui/radio-group.tsx and 14 shared helpers.
  • Installs react-native-reanimated, react-native-gesture-handler, react-native-worklets, uniwind, clsx, tailwind-merge, expo-haptics, class-variance-authority, react-native-svg. In Expo apps it uses npx expo install so versions match your SDK.

Usage

app/checkout.tsx
import { RadioGroup } from '@/components/swipeui/ui/radio-group';

<RadioGroup 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

RadioGroupProps

PropTypeDefaultDescription
optionsreadonly RadioOption<T>[]—

Choices in reading order.

value?T | null—

Controlled selection.

defaultValue?T | nullnull

Initial selection.

onValueChange?((value: T | null) => void)—

Reports a new selection.

orientation?"horizontal" | "vertical"'vertical'

Reading axis.

variant?"cards" | "rows"'rows'

Compatibility alias; cards renders RadioCards.

appearance?"inset" | "rows"'rows'

Grouped filled surface or separate rows.

highlight?SelectionHighlightMode'glide'

Measured row highlight.

slideToPick?booleantrue

Hold a row and slide to choose.

holdDelay?number350

Hold delay in milliseconds.

typeahead?booleantrue

Letter navigation on the web.

disabled?booleanfalse

Disable every row.

haptics?boolean | SelectionHapticstrue

Per-event selection feedback.

motion?MotionOverridethe app feel

Selection and dot motion.

messages?Partial<SelectionMessages>English

Built-in strings.

accessibilityLabel?string—

Spoken group name.

className?string—

Root classes.

style?StyleProp<ViewStyle>—

Root style.

testID?string—

Identifier; rows append their value.

Native view/input props not listed here pass through where the exported TypeScript type allows them.

Radio group settings

PropDoesDefault
hapticsEnables selection or press feedbacktrue
motionOverrides the app's motion feelApp feel

| appearance | Separate rows or a grouped inset surface | rows | | highlight | One measured gliding row highlight; snaps on resize | glide | | slideToPick | Hold a row then slide across choices | true | | holdDelay | Time before sliding activates, in milliseconds | 350 | | typeahead | Jump by typed option names | true | | orientation | Vertical rows or horizontal wrapping | vertical | | variant | Compatibility alias; cards renders RadioCards | rows | | disabled | Prevent every selection | false | | messages | Translate the unavailable hint | English |

Composition and behavior

  • options each have a value, label, optional description and disabled.
  • orientation stacks vertically or wraps horizontally; variant is rows or cards.
  • Control with value and onValueChange, or defaultValue.

Behavior and gestures

  • Tap an option to select it; the dot fills in with a selection tick.
  • Tapping the selected option again keeps it selected; radios can't be turned off.
  • Disabled options dim and can't be picked, while the rest still work.
  • The rows variant lists options plainly; the cards variant outlines each option.

Accessibility

  • The set is a radio group and each option a radio with checked state.
  • Descriptions are read as each option's hint.
  • Name the group with accessibilityLabel, such as "Delivery speed".
  • Each option is at least 44 points tall.

Motion

  • Uses the select, toggle and press motion roles, so it follows your app's feel. Pass motion to tune this one instance.
  • The dot fills with the toggle role; the cards variant moves a selection ring with the select role.
  • Reduce Motion changes selection instantly.

Performance

  • Plain row frames are retained for hit-testing; animation styles live in the highlight leaf.

Notes for AI

  • Give options unique values; null means nothing selected.

Compatibility

Runs onSupported
Expo SDK 57Yes
Expo SDK 58Yes
React Native CLI (with Expo modules)Yes
Expo GoYes
iOSYes
AndroidYes

This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.

Related items