Skip to Content
Notion UI

Radio Group

Selects one option from a group of labeled choices.

Radio Group Default

boolean

The preview renders each plan as a selectable card. The same primitives also support plain labels.

import { RadioGroup, RadioGroupItem } from "@notion-kit/ui/primitives";

<RadioGroup aria-label="Plan" name="plan" defaultValue="plus">
  <label>
    <RadioGroupItem value="free" />
    Free
  </label>
  <label>
    <RadioGroupItem value="plus" />
    Plus
  </label>
</RadioGroup>;

Installation

pnpm add @notion-kit/ui

Anatomy

RadioGroup owns the selected value and keyboard navigation. Each RadioGroupItem has a unique value within the group. The item includes its own selection indicator and hidden form input.

A wrapping <label> supplies each item's accessible name. The group's accessible name comes from aria-label or aria-labelledby. The group name identifies the selected value in form submissions.

Examples

Controlled selection

value and onValueChange expose the selection to application state. defaultValue sets the initial selection when the group manages its own state.

import { useState } from "react";

import { RadioGroup, RadioGroupItem } from "@notion-kit/ui/primitives";

export default function PlanPicker() {
  const [plan, setPlan] = useState("plus");
  return (
    <RadioGroup aria-label="Plan" value={plan} onValueChange={setPlan}>
      <label>
        <RadioGroupItem value="free" />
        Free
      </label>
      <label>
        <RadioGroupItem value="plus" />
        Plus
      </label>
    </RadioGroup>
  );
}

Disabled items

Use the preview's disabled control to toggle the whole group. An item-level disabled prop prevents selection of that option. A group-level disabled prop disables the entire group.

<RadioGroup aria-label="Plan" defaultValue="free">
  <label>
    <RadioGroupItem value="free" />
    Free
  </label>
  <label>
    <RadioGroupItem value="enterprise" disabled />
    Enterprise
  </label>
</RadioGroup>

API reference

RadioGroup

Accepts Base UI's RadioGroup.Props and renders a grid container. Uses Base UI Radio Group props.

Prop

Type

RadioGroupItem

Accepts Base UI's Radio.Root.Props. Renders a radio control, its indicator, and a hidden input. Uses Base UI Radio root props.

Prop

Type

The selected item exposes data-checked. A card label can use has-data-[checked]:border-blue to style its selected state.

On this page