Components / Core
Radio
Give radios in a group the same name, or use RadioGroup.
import { Radio } from "@stylhero/ui";
Example
Code
import { Radio, Stack } from "@stylhero/ui";
function RadioExample() {
return (
<Stack gap={2}>
<Radio name="ship" value="standard" label="Standard" hint="3 to 5 days" defaultChecked />
<Radio name="ship" value="express" label="Express" hint="Next day" />
</Stack>
);
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label required |
ReactNode |
- | |
hint |
ReactNode |
- | Smaller text under the label. |
Also takes every <input> attribute (id, style, data-*, aria-*, event handlers…), passed to that element. Takes a ref.
Keyboard
| Key | Does |
|---|---|
| Arrow keys | Move to and select the next radio with the same name |
Accessibility
- A native radio inside its
<label>.
Generated from src/components/Checkbox.tsx. Something wrong or missing? Open an issue.