Radio
A group of mutually exclusive choices with arrow-key navigation.
RadioView sourceExample
The preview is interactive. The code below it is the docs demo source; demo-only layout classes can be omitted in application code.
import { Cell } from "retend";
import { Radio } from "innate-ui";
type Choice = "one" | "two";
export function RadioDemo() {
const selected = Cell.source<Choice>("one");
return (
<Radio name="radio-demo" value={selected} onChange={(value) => selected.set(value)}>
<Radio.Legend>Select option</Radio.Legend>
<Radio.Item value="one">Option 1</Radio.Item>
<Radio.Item value="two">
<span>Option 2</span>
<small>Another choice</small>
</Radio.Item>
</Radio>
);
}API reference
This table is generated from Innate UI's exported TypeScript declarations and JSDoc. Native element attributes inherited by a prop type are not repeated here.
RadioProps
| Prop | Type | Default |
|---|---|---|
namerequiredNative radio-group name shared by every item. | string | — |
valuerequiredCurrently selected item value. | JSX.ValueOrCell<Value> | — |
childrenrequired`Radio.Legend` and `Radio.Item` children. | JSX.Children | — |
orientationLayout and accessible orientation of the group. | JSX.ValueOrCell<RadioOrientation> | "vertical" |
invalidWhether the radio group is in an invalid state. Inherits from `Field`. | JSX.ValueOrCell<boolean> | false |
ariaDescribedByIds of elements that describe the radio group. | JSX.ValueOrCell<string | undefined> | — |
ariaLabelledByIds of elements that label the radio group. | JSX.ValueOrCell<string | undefined> | — |
onChangeCalled when a different item is selected. | (value: Value) => void | — |
RadioItemProps
| Prop | Type | Default |
|---|---|---|
valuerequiredValue selected when this radio item is chosen. | Value | — |
childrenrequiredRadio label content. | JSX.Children | — |
disabledWhether the radio item is disabled. | JSX.ValueOrCell<boolean> | false |