Radio Button
The Radio Button component allows users to select a single option from a group.
Usage
Default
const options = ["a", "b", "c"];
const [selected, setSelected] = useState("b");
<div style={{ display: "flex", gap: "1rem" }}>
{options.map((opt) => (
<RadioButton
key={opt}
theme="secondary"
label={Option}
value={opt}
checked={selected === opt}
onChange={setSelected}
/>
))}
</div>Props
| Type | Description | |
|---|---|---|
| aria-describedby | string | Identifies the element (or elements) that describe this radio button. |
| aria-invalid | boolean | "true" | "false" | Marks the radio button as invalid for accessibility. |
| aria-label | string | Provides an accessible label when no visible label is present. |
| aria-labelledby | string | Identifies the element (or elements) that label this radio button. Usually not needed when using the built-in `label` prop, but available for advanced cases. |
| aria-required | boolean | "true" | "false" | Indicates whether this radio button is required as part of a group. |
| checked | boolean | Whether this radio button is currently checked. |
| className | string | Additional CSS class names for custom styling. |
| data-testid | string | Optional test ID for testing frameworks. |
| disabled | boolean | Whether the radio button is disabled. |
| label | string | The label text displayed next to the radio button. |
| onChange | (value: string) => void | Callback triggered when the radio button's value changes. |
| rounding | RoundingType | Rounding of the radio button. One of: "none" | "small" | "medium" | "large" | "full" |
| shadow | ShadowType | Shadow style of the radio button. One of: "none" | "light" | "medium" | "strong" | "intense" |
| state | StateType | State of the radio button. One of: "success" | "error" | "warning" | "disabled" | "" |
| theme | ThemeType | Theme applied for styling. One of: "primary" | "secondary" | "tertiary" | "quaternary" | "clear" |
| value | string | The value associated with this radio button. |