CraftUI

Radio Group

Ore UI's diamond radio buttons, stacked or in a row.

Installation

npx shadcn@latest add @runqora/craft-radio-group

Usage

import { Radio, RadioGroup } from "@/components/craft/radio-group";

<RadioGroup aria-label="Difficulty" defaultValue="normal">
  <Radio label="Easy" value="easy" />
  <Radio label="Normal" value="normal" />
  <Radio label="Hard" value="hard" />
</RadioGroup>;

Examples

Horizontal and controlled

Camera: third person

Props

RadioGroup

Prop

Type

Radio

Prop

Type

Accessibility

  • Tab moves into the group, onto the selected option. The arrow keys move between options and select them, skipping disabled ones.
  • Name the group with aria-label, or with aria-labelledby pointing at a heading.
  • Clicking a label selects its option.
  • The selected option has a gem in its center as well as its green color.

Customization

For radios with longer descriptions, leave out label and lay out your own label element around a Radio, as Radio is the whole control.

Dependencies

Source

On this page