Skip to content

Radio button

Use radio buttons where users must make a single selection.

Code

Variants

Option 1 Help or instructional text goes here Option 2 Disabled off Disabled on
<certara-form-group label="Enabled group" variant="fieldset" error="Error message">
<certara-radio layout="stacked" name="example-01">
Option 1
<span slot="help">
Help or instructional text goes here
</span>
</certara-radio>
<certara-radio layout="stacked" name="example-01">
Option 2
</certara-radio>
</certara-form-group>
<certara-form-group label="Disabled Group" variant="fieldset">
<certara-radio layout="stacked" name="example-02" disabled>
Disabled off
</certara-radio>
<certara-radio layout="stacked" name="example-02" disabled checked>
Disabled on
</certara-radio>
</certara-form-group>

certara-radio

Properties

PropertyAttributeDescriptionTypeDefault
checkedcheckedbooleanfalse
disableddisabledbooleanfalse
layoutlayout"inline" | "stacked"'inline'
namenamestringundefined
sizesize"md" | "sm"'md'
valuevalueany'on'

Events

EventDescriptionType
certaraBlurStandard event emitted when radio is blurredCustomEvent<void>
certaraChangeStandard event emitted when radio is toggledCustomEvent<CheckboxChangeEventDetail<any>>
certaraFocusStandard event emitted when radio is focusedCustomEvent<void>

Slots

SlotDescription
Content for the label
"error"Error text that sits below the label
"help"Help text that sits below the label

Dependencies

Depends on

Graph

graph TD;
certara-radio --> certara-checkbox
certara-checkbox --> certara-help-block
style certara-radio fill:#f9f,stroke:#333,stroke-width:4px

In Practice

Radio buttons should:

  • Always be used with an associated label component.
  • Be part of a list of radio buttons that:
    • Include at least two or more choices.
    • Are used to have users select only one option.
    • Include mutually exclusive options — this means that each option must be independent from every other option in the list. For example: Red, blue, and yellow are mutually exclusive. Red, blue, yellow, red/blue are not mutually exclusive.
    • List options in a rational order that makes logical sense.
    • Have a default option selected whenever possible.

Content guidelines

Labels

  • Keep radio labels short and descriptive.
  • Start all radio buttons labels with a capital letter.
  • Don’t include punctuation after radio button labels.

Accessibility

Keyboard support

  • Move focus to each radio using the tab key (or shift + tab when tabbing backwards)
  • To interact with the radio when it has keyboard focus, press the space key

Design resources

View component in Figma