Use FormControl to render a standard radio input field. This component is only meant to be used in the case that you're building a custom radio that is not yet supported by Primer (For example: the color mode selection in Appearance settings)
If you do use this component to build a custom radio, it should always be accompanied by a corresponding <label> to improve support for assistive technologies.
Please use a Checkbox if the user needs to select more than one option in a list
Use the name prop to group together related Radio components in a list.
If you're not building something custom, you should use the RadioGroup component to render a group of radio inputs.
RadioGroupname to group Radio components| Name | Type | Default | Description |
|---|---|---|---|
| value Required | string | A unique value that is never shown to the user | |
| name | string | Required for grouping multiple radios | |
| checked | boolean | Modifies true/false value of the native radio | |
| defaultChecked | boolean | Selects the radio by default in uncontrolled mode | |
| onChange | (event: React.ChangeEvent) => void | A callback function that is triggered when the input state has been changed | |
| disabled | boolean | Modifies the native disabled state of the native checkbox | |
| ref | React.RefObject<HTMLInputElement> | ||
| as | React.ElementType | "input" | The underlying element to render — either a HTML element name or a React component. |
| sx | SystemStyleObject |