Radio group
One choice among a few, all visible. The chosen box holds a square.
import { RadioGroup } from "@forgeron/ui";import { RadioGroup } from "@forgeron/ui";
export default function Default() {
return (
<RadioGroup
label="Who can open this tool"
defaultValue="team"
options={[
{ value: "me", label: "Only me" },
{ value: "team", label: "My team", hint: "Sales, 6 people" },
{ value: "workspace", label: "Everyone in the workspace" },
]}
/>
);
}import { RadioGroup } from "@forgeron/ui";
export default function Row() {
return (
<RadioGroup
label="Billing"
direction="row"
defaultValue="monthly"
options={[
{ value: "monthly", label: "Monthly" },
{ value: "yearly", label: "Yearly" },
]}
/>
);
}API → Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | — | The question, said once (legend). |
options | { value, label, hint?, disabled? }[] | — | The choices. |
value / defaultValue | string | — | Controlled or not. |
onChange | (value: string) => void | — | On a new choice. |
direction | "column" | "row" | "column" | Stacked or side by side. |
name | string | — | Made up when absent. |
className | string | — | Extra classes. |