Radio

Props from Radio.Group that also appear in Radio will be overridden by Radio.Group's. In general, you should never use Radio without a Radio.Group.

Jackie's code dump of examples that can be cleaned up later:

const [value, setValue] = useState('female');
const handleChange = (e) => {
setValue(e.target.value);
};
<Radio.Group
marginTop="50px"
name="gender"
onChange={handleChange}
value={value}
>
<Radio id="male" value="male">
Male
</Radio>
<Radio id="female" value="female">
Female
</Radio>
<Radio id="other" value="other">
Other
</Radio>
</Radio.Group>
<Radio.Group vertical marginTop="50px" name="colors">
<Radio id="blue" value="blue">
Blue
</Radio>
<Radio color="#f00" defaultChecked id="red" value="red">
Red
</Radio>
<Radio error="warning" id="purple" value="purple">
Purple
</Radio>
<Radio disabled id="green" value="green">
Green
</Radio>
</Radio.Group>
<Radio.Group
defaultValue="red2"
disabled
vertical
marginTop="50px"
name="secondColors"
>
<Radio id="blue2" value="blue2">
Blue
</Radio>
<Radio id="red2" value="red2">
Red
</Radio>
<Radio id="purple2" value="purple2">
Purple
</Radio>
<Radio id="green2" value="green2">
Green
</Radio>
</Radio.Group>
<Radio.Group
defaultValue="blue3"
error="error"
vertical
marginTop="50px"
name="thirdColors"
>
<Radio id="blue3" value="blue3">
Blue
</Radio>
<Radio id="red3" value="red3">
Red
</Radio>
<Radio id="purple3" value="purple3">
Purple
</Radio>
<Radio id="green3" value="green3">
Green
</Radio>
</Radio.Group>

Common Props

Radio includes COMMON common props. Radio.Group includes COMMON, FLEX, and BORDER props. Read Common Props for details and API. These common props will override component props such as the color.

Radio Component Props

Prop nameTypeDefaultDescription
checkedBooleanWhether the radio is selected or not.
childrenNodeThe label of the Radio.
defaultCheckedBooleanWhether it is initially selected or not. This should not be used when checked and onChange is used or when it's Radio.Group has value and onChange set.
disabledBooleanfalseDisable input
errordefault | error | warning | success'default'Set the error state
idStringInput ID. This should always be set for accessibility purposes.
nameStringHTML name attribute (used for grouping) - this is unnecessary to set when using Radio.Group.
onChangeFuncCallback to execute on user input
themeObjectBridge ThemeUse to override default bridge theme
valueAnyThe value used to compare to see if it is selected

Radio.Group Component Props

Prop nameTypeDefaultDescription
childrenNodeThese should be Radio components to be grouped together
defaultValueAnyThe default value (out of the children Radios) to be selected. This should not be used when value and onChange are used
disabledBooleanfalseDisable input for all children
errordefault | error | warning | success'default'Set the error state for all children
nameStringHTML name attribute for all children
onChangeFuncCallback to execute on user input
themeObjectBridge ThemeUse to override default bridge theme
valueAnyThe value to be currently selected
verticalBooleanfalseEnable vertical grouping