RadioGroup

Lets users choose one option from a mutually exclusive set. Use it when all available choices should remain visible.

React

Ready

Figma

React examples

Default

Fly the shortest safe route home.

Hold position until told otherwise.

Descend at the current position.

import {
  Field,
  FieldContent,
  FieldDescription,
  FieldLabel,
  RadioGroup,
  RadioGroupItem,
} from "@kela-systems/ui-components";

const actions = [
  { value: "dock", label: "Return to dock", description: "Fly the shortest safe route home." },
  { value: "hover", label: "Hover in place", description: "Hold position until told otherwise." },
  { value: "land", label: "Land now", description: "Descend at the current position." },
];

export default function RadioGroupDefault() {
  return (
    <RadioGroup aria-label="On signal loss" defaultValue="dock" className="w-full max-w-xs">
      {actions.map((action) => (
        <Field key={action.value} orientation="horizontal">
          <RadioGroupItem id={`action-${action.value}`} value={action.value} />
          <FieldContent>
            <FieldLabel htmlFor={`action-${action.value}`}>{action.label}</FieldLabel>
            <FieldDescription>{action.description}</FieldDescription>
          </FieldContent>
        </Field>
      ))}
    </RadioGroup>
  );
}

Props

RadioGroup

No props of its own. It also takes the props of Base UI's radio-group.

RadioGroupItem

No props of its own. It also takes the props of Base UI's radio.

Read this page as Markdown

Search ARK

Find a page, a primitive or a component.