Bedform UIControls
Radio
The base component for Radio Group.
Usage
import { Radio } from "@bedform/ui/radio";
<Radio name="mode" value="survival" defaultChecked>
Survival
</Radio>;Group radios in a Radio Group. Radio is also exported from @bedform/ui/radio-group.
Colors
<Radio color="primary" defaultChecked>Primary</Radio>
<Radio color="secondary" defaultChecked>Secondary</Radio>
<Radio color="destructive" defaultChecked>Destructive</Radio>
<Radio color="dungeons" defaultChecked>Dungeons</Radio>
<Radio color="legends" defaultChecked>Legends</Radio>
<Radio color="realms" defaultChecked>Realms</Radio>
<Radio color="gold" defaultChecked>Gold</Radio>States
<Radio name="mode" value="survival" defaultChecked>
Survival
</Radio>
<Radio name="mode" value="hardcore" disabled>
Hardcore
</Radio>Radios with the same name and form are mutually exclusive.
Events
Selecting a new option dispatches native input and change events, so onChange works as it does on any input.
API
Radio renders a native radio input inside a label, and its children become the label text. It accepts every attribute of a radio input, such as checked, defaultChecked, disabled, name, required and value, and its ref points to the input.
| Prop | Type | Default |
|---|---|---|
color | "primary" | "secondary" | "destructive" | "dungeons" | "legends" | "realms" | "gold" | "primary" |
labelClassName | string | — |
CSS variables
| Variable | Purpose |
|---|---|
--ore-radio-unit | Base size unit |
--ore-radio-background | Unselected background |
--ore-radio-highlight | Unselected highlight |
--ore-radio-border | Border color |
--ore-radio-indicator-light | Indicator light color |
--ore-radio-indicator-dim | Indicator midtone color |
--ore-radio-indicator-dark | Indicator dark color |
--ore-radio-active-background | Selected background |
--ore-radio-active-background-hover | Selected hover background |
--ore-radio-active-background-pressed | Selected pressed background |
--ore-radio-active-highlight | Selected highlight |
--ore-radio-active-highlight-hover | Selected hover highlight |
--ore-radio-active-highlight-pressed | Selected pressed highlight |
Accessibility
The native radio input provides radio semantics, form behavior, and validation. Use arrow keys to move within a same-name group and Space to select the focused option.