Radio group is a container for radio inputs and is used where two or more radio inputs are required. A radio group can accomodate two styles of radio inputs — a radio icon or radio button.
npm install @nib-components/radio-group
As a form input, @nib-components/form-control must wrap this component to provide an accessible label, help text, and validation styling. Note: You will also need to install the peerDependencies @nib/icons and @nib-components/theme.
import RadioGroup from '@nib-components/radio-group';
<RadioGroup/> is wrapped in a
<FormControl/>, all FormControl props such as
disabled will be passed down to this component. This includes the
label which will align with the
for attribute on the
All props passed directly to
<RadioGroup/> will be applied to the underlying
<input> as attributes.
|object||Two structures are supported. Both are an object, with keys mapping to the option value. The property value maps to either the checkbox label as string, or an object with |
|boolean||Whether the labels are bold. If a subtitle is provided for an option, the default value changes to |
|string or number||The selected value.|
|string or React component||The component used to render a radio.|
Radio inputs are used when there are a number of options available and the user may select only one option at any time. Selecting one radio input deselects the others.
Subtitles are optional and should be used to provide more context to the option. Subtitles should be added to all options in the group, or none. Otherwise, alignment will suffer, especially if rendering the options inline.
When a user is able to select multiple options at once use Checkbox.
Order radio options from most likely to least likely to be selected.
When there are 6 or more options consider using a Select.