abaabil

Radio

2nd lightest of the eight, by js weight

A single <input type="radio">, themed through CSS custom properties, meant to be used inside a RadioGroup rather than standalone.

Example (a11y tier)

Delivery methodReady in 1 hour at the downtown location.

Import

import Radio from 'abaabil/radio'         // structure only
import Radio from 'abaabil/radio/styled'  // + CSS
import Radio, { RadioGroup } from 'abaabil/radio/a11y'  // + label/description/shared name

Why RadioGroup matters: the shared name

Radio buttons only behave as one group, mutually exclusive selection and arrow-key navigation between them, when they share the same native name attribute. Radios with different (or missing) names each act as their own independent group of one, and nothing visible tells you this went wrong: they still render, still look identical, and each one still toggles on click. The bug only shows up as "I can select two of these at once" or "arrow keys don't move between them", usually reported by a keyboard or screen reader user long after the markup shipped.

RadioGroup removes the chance to get this wrong: it generates a shared name with useId and provides it through context, so every Radio rendered inside automatically picks it up. Passing an explicit name to RadioGroup (as in the example above) is optional and only useful for reading the group's value from native form submission.

Props

PropTypeDefaultTierDescription
classNamestringallMerged with the base class.
labelstringa11yAccessible name, rendered as a real <label>. The platform does not supply one.
descriptionstringa11yRendered text, wired via aria-describedby.
namestringinherited from RadioGroupa11yOverrides the name inherited from an enclosing RadioGroup.
idstringa11yOverrides the generated input id.
...propsallEverything else (value, checked, defaultChecked, onChange, aria-describedby, ...) lands on the <input>.

RadioGroup accepts label (rendered as the <legend>), name (the shared group name; generated via useId when omitted), and className, plus any other prop, which spreads onto the <fieldset>.