agentic-ui logoagentic-ui

Radio

A single radio button with an optional label. Compose with RadioGroupRoot or a raw base-ui RadioGroup for custom group layouts.

With RadioGroupRoot

import { Radio } from "@brijbyte/agentic-ui/radio";
import { RadioGroupRoot } from "@brijbyte/agentic-ui/radio-group";
import "@brijbyte/agentic-ui/radio.css";
import "@brijbyte/agentic-ui/radio-group.css";

export default function HighLevelDemo() {
  return (
    <RadioGroupRoot defaultValue="staging" aria-label="Deployment target">
      <Radio value="production">Production</Radio>
      <Radio value="staging">Staging</Radio>
      <Radio value="preview">Preview</Radio>
      <Radio value="local" disabled>
        Local
      </Radio>
    </RadioGroupRoot>
  );
}

Composed: RadioGroupRoot + styled parts

import { Radio, RadioRoot, RadioIndicator } from "@brijbyte/agentic-ui/radio";
import { RadioGroupRoot } from "@brijbyte/agentic-ui/radio-group";
import "@brijbyte/agentic-ui/radio.css";
import "@brijbyte/agentic-ui/radio-group.css";

export default function ComposedDemo() {
  return (
    // Raw RadioGroupRoot for full control (name, required, form integration)
    <RadioGroupRoot defaultValue="ssd" name="storage" aria-label="Storage type">
      <Radio value="ssd">SSD — fast, lower capacity</Radio>
      <Radio value="hdd">HDD — slower, higher capacity</Radio>
      {/* Composed manually for a custom layout */}
      {/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
      <label style={{ display: "flex", alignItems: "center", gap: "var(--space-2)", cursor: "pointer" }}>
        <RadioRoot value="nvme">
          <RadioIndicator />
        </RadioRoot>
        <span style={{ fontFamily: "var(--font-mono)", fontSize: "var(--font-size-sm)", color: "var(--color-primary)" }}>
          NVMe — fastest, premium
        </span>
      </label>
    </RadioGroupRoot>
  );
}

API Reference

A single radio button with an optional label.
Must be placed inside <RadioGroup> or a raw base-ui RadioGroup.

PropTypeDefault
value*string

Value submitted with the form and matched against the group's value.

childrenReactNode

Label rendered next to the button.

disabledboolean
readOnlyboolean
requiredboolean
idstring

Override the auto-generated element id.

classNamestring

Styled Parts

base-ui docs ↗

Pre-styled wrappers around the corresponding base-ui parts. All base-ui props are forwarded.

CSS Class Names

Available as keys on the RadioStyles object. Each key maps to a hashed CSS module class name at runtime.

indicatoritemlabelradio