Note: There are deprecated versions of this component. Switch to a version of the docs older than 10.0.x to view their docs.
Examples
Check out the Usage section for details about how and when to use the RadioGroup
and Radio
components.
Basic radio group
Radio
cannot be used alone, outside of the RadioGroup
context. RadioGroup
should receive only Radio
components as children. The label
prop is mandatory in both components and the value
prop is required for the Radio
component only.
<RadioGroup label="This is a group">
<Radio
label="option 1"
value="1"
/>
<Radio
label="option 2"
value="2"
/>
</RadioGroup>
Disabled radio vs disabled radio group
Both components provide a disabled
property. However, when set to true
at the RadioGroup
level, it overrides any disable configuration from the Radio
level. If there is any disabled={false}
prop setting among the Radio
options, but the RadioGroup
sets it to disabled={true}
, all options are disabled.
<RadioGroup
label="This is a group"
disabled={true}>
<Radio
label="option 1"
value="1"
disabled={false}
/>
<Radio
label="option 2"
value="2"
disabled={false}
/>
</RadioGroup>
Predefined option
It is possible to define what option is initially selected by passing the value
prop to the the initialValue
property of the RadioGroup
.
<RadioGroup
label="This is a group with second option selected initially"
initialValue="2">
<Radio
label="option 1"
value="1"
/>
<Radio
label="option 2 is initially selected"
value="2"
/>
</RadioGroup>
Horizontal group
The RadioGroup
component allows for the display of options in horizontal distribution by setting the horizontal
property to true
.
<RadioGroup
label="This is a group"
horizontal={true}>
<Radio
label="option 1"
value="1"
disabled={false}
/>
<Radio
label="option 2"
value="2"
disabled={false}
/>
</RadioGroup>
RadioGroup validations
The RadioGroup
component does not provide a specific validation logic but it provides a way to include the developer validation and use the stateMessages
property to display any required error message.
This is an example of handling validation when the onChange
event is triggered.
export function RadioValidation() {
const [groupValidationMessages, setGroupValidationMessages] = useState({});
const onChange = useCallback((e, newValue) => {
setGroupValidationMessages({});
if (newValue == '1') {
setGroupValidationMessages({
error: ['Only second option can be marked'],
});
}
}, []);
return (
<RadioGroup
label="Do not select the forbidden option"
onChange={onChange}
stateMessages={groupValidationMessages}>
<Radio
label="Do not select the forbidden option"
value="1"
/>
<Radio
label="This option can be selected"
value="2"
/>
</RadioGroup>
);
}
RadioGroup
has a value
property which can be used for the controlled component scenario:
export function RadioControlled() {
const [updatedValue, setNewValue] = useState('first given value');
const onChange = (e, newValue) => {
setNewValue(newValue.value);
};
return (
<div>
<Select
label="Choose a value to be assigned"
secondaryLabel="This value will be the option chosen below"
onChange={onChange}>
<SelectOption
value={{
id: '1',
label: 'Option 1',
value: '1',
}}
/>
<SelectOption
value={{
id: '2',
label: 'Option 2',
value: '2',
}}
/>
</Select>
<br />
<RadioGroup
label="Changes with the above"
value={updatedValue}>
<Radio
label="Option 1"
value="1"
disabled={true}
/>
<Radio
label="Option 2"
value="2"
disabled={true}
/>
</RadioGroup>
</div>
);
}
Using ref to set focus
RadioGroup
and certain other inputs, allow you to use a ref
property to access some native behaviors. However, only some features are exposed. In this case, when the button is clicked, the focus is automatically set in the input below.
<RadioGroup
label="This is a group with second option selected initially"
initialValue="2">
<Radio
label="option 1"
value="1"
/>
<Radio
label="option 2 is initially selected"
value="2"
/>
</RadioGroup>
Note: There are deprecated versions of this component. Switch to a version of the docs older than 10.0.x to view their docs.
Usage
Overview
A radio group displays a set of mutually exclusive options from which a person may select exactly one.
When to use
When selecting a single option from a small set of mutually exclusive options (5 or fewer).
When not to use
- When there are multiple options to select independently of each other. Use the checkbox component instead.
- There's a large number of options (6 or more) from which users can choose. Use the dropdown component instead.
- The user may select zero of the options or change their mind and unselect an option. In cases like this, consider using the checkbox component. You can also choose to add a None of the above option to the radio button group instead.
Note: To display a set of mutually exclusive options from which a person can select exactly one, use radio buttons instead of checkboxes.
Sources: Nielsen Norman Group, USWDS
Anatomy

- Radio group label: Explains the purpose of the radio group.
- Helper text (optional): Gives additional context for the radio group.
- Radio button input: Indicates the appropriate state. By default an option is selected.
- Radio button label: Describes the information that is to be selected or unselected.
- Tooltip icon (optional): Serves to disambiguate the context for a given radio button. The tooltip appears when hovered.
Alignment and placement
A radio group can be arranged vertically or horizontally depending on the page structure. By default, radio buttons are arranged vertically for easier reading.
As is the case with all input components, the label for the radio group can appear at the top (default) or on the left of the input itself.

Default selection
Configure one of the radio buttons, usually the first, to be selected by default. This selection expedites the task by communicating to the user that they are required to choose an option in this set. Providing a default selection is recommended for most use cases.
There are some instances, however, when preselecting a default value is presumptuous and might result in an incorrect input. Consider the content and the default selection, how users will react to it, and the effect the selection will have on the user and the organization in both the short and long term. Avoid default selections that are presumptuous, pushy, offensive, or alienating.
Source: Nielsen Norman Group
Use a logical order to help users find the option they're looking for. For example:
- from most common to least common option
- from least to most risky option
- from simplest to most complex operation
Avoid putting selection options in alphabetical order. This is language dependent and doesn't localize well.
Content
General writing guidelines
- Use sentence case for all aspects of designing Guidewire product interfaces. Don't use title case.
- Use present tense verbs and active voice in most situations.
- Use common contractions to lend your copy a more natural and informal tone.
- Use plain language. Avoid unnecessary jargon and complex language.
- Keep words and sentences short.
Use for mutually exclusive options
Radio buttons and checkboxes are not interchangeable. Use radio buttons to select a single option from a small set of mutually exclusive options (5 or fewer). Use checkboxes when there are lists of options and the user may select any number of choices, including zero, one, or several.
Use radio buttons when only one item can be selected.
Don't use radio buttons when multiple items can be selected.
Radio groups must have a label that describes what the list of options represents. A radio group without a label is ambiguous and not accessible.
Use the group label to state the category of the grouping or describe what actions to take below.
Do include a label that clearly describes what the list of options represents.
Don't assume that the options are self-explanatory without a label.
Limit the radio button's text label to a single line. We recommend using one to three words for radio button labels.
Don't truncate radio button label text with an ellipsis (...). If the label is too long for the horizontal space available, consider rewording it. You can also wrap long radio button labels to a second line. This is preferable to truncation.
Do keep radio button label text concise. If necessary, wrap to a second line.
Don't truncate radio button label text with an ellipsis.
Give distinct, comprehensive options
Users can only make one selection from a radio group. This means that each choice must be clear and distinct. Avoid overlapping options.
Do make sure that options are clearly distinct.
Don't provide options that have overlapping values.
Make sure that the options you provide are comprehensive so that users can make a selection. If it's impossible to be comprehensive, offer a button labeled Other, supplemented by a type-in field.
Source: Nielsen Norman Group
Do make sure that options are comprehensive.
Don't provide an incomplete set of options.
User error text to guide users
Radio groups can include error messages to show that a selection is required to move forward, or that a selection that was made is invalid.
Use sentence case for error text. Write 1-2 short, complete sentences that end with a period.
Do use error text to guide the user and show them a solution.
Don't write ambiguous error messages or leave users guessing as to how to resolve a problem.
Mark required fields
Use an asterisk (*) to indicate required fields. The asterisk precedes the field label. This helps users to easily locate which fields are required by scanning just the left-most character of the label.
You can only add an asterisk to the radio group, not individual options.
Do use an asterisk to indicate that a field is required.
Don't use an asterisk to denote anything that is optional.
Use sentence case
Group labels and radio button labels appear in sentence case.
Refer to the UI text style guide for more information on how to implement sentence case.
Behaviors
States
The radio button component has 2 main states: selected and unselected. The default view of a radio button group is to preselect one of the radio buttons.
Users can only select one radio button at a time. When a user makes a new selection, the previous choice is automatically deselected.
Selected state | Unselected state |
---|
 |  |
Radio buttons also have states for enabled, hover, focus, active, disabled, and error.
Visual | State | Description |
---|
 | Enabled | Indicates to the user that the element is enabled for interaction (default). |
 | Hover | Indicates that the user has placed a cursor over the element (desktop only). |
 | Focus | Indicates that the user has highlighted the element, typically using an input method such as a keyboard or voice. |
 | Active | Indicates that the user is clicking or tapping the element. |
 | Disabled | Communicates to the user that the element is not currently available for interaction. |
 | Error | Indicates that there has been an error related to this element. For example, a selection needs to be made in order to move forward, or a selection is invalid. |
Interactions
Mouse
To select or unselect radio buttons, users click either the radio button or the label.
Keyboard
Users navigate between radio buttons using the arrow keys. To select a radio button, users press ENTER or SPACE.
Screenreader
The radio button group implements the html <input type="radio">
, supplemented with WAI ARIA to provide meaning for blind users. The group is designated as such with role='radiogroup', while aria-checked
toggles between 'true' and 'false', depending on the state of the radio button. Labels and radio buttons are programmatically associated via a 'for/id' association. The default aria-required
value of 'false' toggles to 'true' when the required checkbox is checked in Storybook.
Accessibility
This component adheres to the following criteria for color and zoom accessibility:
- Color: The contrast ratio of textual elements against their background is above 4.5:1 as per WCAG 2.0 AA requirements.
- Zoom: All content and functionality is visible at 200%.
This component has been validated to meet the WCAG 2.0 AA accessibility guidelines. However, changes made by the content author can affect accessibility conformance. For example:
- When a radio group does not have a default selected the focus should move to the first radio button in the group.
- Labels should be presented after the radio button.