Selectable radio
Pick one option from a few, each a card with a line of explanation and an icon.
Installation
npm i @uisatin/uiimport { SelectableRadio } from '@uisatin/ui/selectable-radio'About 20.7 kB of JavaScript, minified and gzipped, with what it imports (React aside). The stylesheet is one file for every component.
npx shadcn@latest add https://uisatin.dev/r/selectable-radio.json https://uisatin.dev/r/radio.jsonAdds selectable-radio.tsx, radio.tsx and selectable-card.tsx to components/ui and installs radix-ui.
First time with Satin? Set it up once, styles and fonts included, with the installation guide.
API Reference
The SelectableRadio component is a radio item of a RadioGroup drawn as a whole card, with no circle: the card is the radio and the selected one takes the primary border.
| Prop | Type | Default |
|---|---|---|
value | string | — |
title | ReactNode | — |
description | ReactNode | — |
icon | ReactNode | — |
size | "sm""md" | "md" |
disabled | boolean | false |
className | string | — |
ref | Ref<HTMLElement> | — |
...props | ComponentProps<typeof RadioGroup.Item>Other attributes go to the Radix RadioGroup.Item part | — |
Accessibility
Each card is a Radix radio: a button with role="radio" and aria-checked, labelled by its title and described by its description. The icon tile is hidden. Put the cards in a RadioGroup and name the group.
| Key | Action |
|---|---|
| Tab | Moves into the group, onto the checked card (or the first), and out again. |
| ↑or↓or←or→ | Moves to the previous or next card and checks it, wrapping at the ends. |
| Space | Checks the focused card. |
Something wrong or missing on this page?
Report a problemSuggest an improvement