Efniv0.1

Components

Radio group

One of many. Reach for it over a Select when the options can fit on screen and their labels are equally weighted.

When to useto pick one of a small, fully visible set of options — up to about five.

Import

import { RadioGroup, RadioGroupItem } from "@ravnhq/efni/radio-group"

Density selector

<RadioGroup value={value} onValueChange={setValue}>
  <label htmlFor="density-compact">
    <RadioGroupItem value="compact" id="density-compact" />
    <Label htmlFor="density-compact">Compact</Label>
  </label>
  …
</RadioGroup>

Inline

<RadioGroup defaultValue="table">
  <RadioGroupItem value="table" id="view-table" />
  <Label htmlFor="view-table">Table</Label>
  …
</RadioGroup>

Do & don't

Use RadioGroup when the whole option set fits on screen — readers compare labels at a glance.

Don't hide 3 mutually exclusive options behind a Select — one click is faster than two.

Accessibility

KeyAction
TabFocus enters the checked item (or the first).
ArrowUp / ArrowDownMove selection within the group.
SpaceSelect the focused item (if not already).
  • The group behaves as a single tab stop — Tab moves past it once the selection is set.
  • Wrap each item in a Label with htmlFor so clicking the text selects the radio.

Guidelines

Do
  • Order options by frequency or natural order (compact/comfortable/spacious).
  • Set a defaultValue so keyboard users don't Tab into an empty group.
  • Group visually — each item should read as part of a set, not floating.
Don't
  • Don't use RadioGroup for a boolean — that's a Switch.
  • Don't stack more than five options — use Select or Combobox.
  • Don't skip labels — the dot alone means nothing.

Props

PropTypeDefaultDescription
valueValue—The controlled value of the radio item that should be currently selected. To render an uncontrolled radio group, use the defaultValue prop instead.
defaultValueValue—The uncontrolled value of the radio button that should be initially selected. To render a controlled radio group, use the value prop instead.
onValueChange((value: Value, eventDetails: RadioGroup.ChangeEventDetails) => void)—Callback fired when the value changes.
RadioGroupItem.valueValue—The unique identifying value of the radio in a group.
…propsRadioGroupPrimitive.Props—Everything RadioGroup passes to the element it renders.