@usevyre/react@usevyre/vue

Radio

A controlled single-choice group. RadioGroup owns the selected value; render it data-driven with anoptions array, or composable with<Radio> children for custom content. Usesrole="radiogroup" with native radio inputs for full keyboard and screen-reader support. For multi-select useCheckbox; for a compact picker use Select.


Options array

The quickest form — pass options withvalue / label / optionaldescription and disabled. Bind withvalue + onChange (or v-model in Vue).

Selected: pro

import { useState } from "react";
import { RadioGroup } from "@usevyre/react";

const [plan, setPlan] = useState("pro");

<RadioGroup
  value={plan}
  onChange={setPlan}
  options={[
    { value: "free", label: "Free", description: "For hobby projects" },
    { value: "pro",  label: "Pro",  description: "For small teams" },
    { value: "ent",  label: "Enterprise", description: "SSO, audit log, SLA" },
    { value: "legacy", label: "Legacy (unavailable)", disabled: true },
  ]}
/>

Composable

Pass <Radio> children instead of optionswhen you need custom layout or content per option. The selected value and grouping still come from RadioGroup.

import { useState } from "react";
import { RadioGroup, Radio } from "@usevyre/react";

const [val, setVal] = useState("b");

<RadioGroup value={val} onChange={setVal} orientation="horizontal">
  <Radio value="a" label="Option A" />
  <Radio value="b" label="Option B" />
  <Radio value="c" label="Option C" />
</RadioGroup>

RadioGroup props

Props

PropTypeDefaultDescription
value / v-modelstringSelected value (controlled). React: value + onChange; Vue: v-model.
defaultValuestringInitial value for uncontrolled use (React only).
onChange / @update:modelValue(value: string) => voidCalled with the newly selected value.
namestringautoRadio input name; auto-generated if omitted.
disabledbooleanfalseDisables the entire group.
size"sm" | "md""md"Control size.
orientation"vertical" | "horizontal""vertical"Layout direction.
options{ value; label?; description?; disabled? }[]Data-driven options. Omit to pass <Radio> children instead.

Radio props

Props

PropTypeDefaultDescription
valuestringThis option's value (required). Must be unique in the group.
labelstringVisible label.
descriptionstringSecondary muted text under the label.
disabledbooleanfalseDisables just this option.