Radio Group

@sushindustries/ui

Radios in a fieldset - the one grouping screen readers announce without help.

4 min read
View as MarkdownEdit on GitHub

A set of native radio inputs inside a <fieldset>, for choosing exactly one option from a short list. Reach for it whenever the choice needs to be visible all at once, rather than folded into a select.

Viewport width
Phone22remthe floor, the narrowest this promises to work at
tanstacktanstack add https://adamjurek.com/r/tanstack/radio-group.jsonshadcnpnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/radio-group.json

Why it is built this way

A <fieldset> with a <legend> is the one grouping screen readers announce without any ARIA added by hand, so the group label rides on markup rather than a prop wired to aria-labelledby. The shared radio name falls back to a generated id when none is given, so two groups on the same page never merge into one set by accident.

What it does not do

It does not read well past five or six options - a NativeSelect covers that case in less space. And it is single-choice by construction: more than one answer allowed at once is CheckboxCheckboxA native checkbox with its words attached, painted by accent-color rather than redrawn.@sushindustries/ui · content, not a radio no matter how it's styled.

Install commands are not written here

Anything in packages/ui/registry.ts gets its TanStack and shadcn commands attached automatically, so there is nothing to keep in sync.

Install

tanstack add https://adamjurek.com/r/tanstack/radio-group.json
shell
pnpm dlx shadcn@latest add https://adamjurek.com/r/shadcn/radio-group.json
shell
pnpm add @sushindustries/ui @sushindustries/atoms
shell

What you get

Version0.1.0
Categorycontent · Forms
Filesradio-group.tsx
DependenciesNone
Tagsform, no-deps

No runtime dependencies

It brings nothing with it beyond the stylesheet.