Radio button
Use radio buttons where users must make a single selection.
Code
Variants
certara-radio
Properties
Property | Attribute | Description | Type | Default |
---|---|---|---|---|
checked | checked | boolean | false | |
disabled | disabled | boolean | false | |
layout | layout | "inline" | "stacked" | 'inline' | |
name | name | string | undefined | |
size | size | "md" | "sm" | 'md' | |
value | value | any | 'on' |
Events
Event | Description | Type |
---|---|---|
certaraBlur | Standard event emitted when radio is blurred | CustomEvent<void> |
certaraChange | Standard event emitted when radio is toggled | CustomEvent<CheckboxChangeEventDetail<any>> |
certaraFocus | Standard event emitted when radio is focused | CustomEvent<void> |
Slots
Slot | Description |
---|---|
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
Enabled Group
Error message
Disabled Group
Define source
Error message
Upload with
Data Package Type
Error message
Upload with
Data Package Type
Error message
Symbols prefixed by underscore ("_")
When referencing/naming Symbol with a form input, any argument/option/variable that are endemic to the input itself (i.e. "id", "placeholder", "required") are **not** preceded by an _underscore. In other cases, an _underscore precedes to denote it affects the output of a container/parent element, or a sibling.
@standardRadio(myForm(""), Symbol("_label") -> "", Symbol("id") -> "", Symbol("_inline") -> false, Symbol("_help") -> "", Symbol("_helpLink") -> Symbol("disabled") -> false, Symbol("checked") -> false, Symbol("class") -> "", Symbol("_class") -> "",)
NameTypeDescriptionDefault valueCopy
- _labelstringText that describes the control. Will be both visible and clickable.blank
- idstring (required)adds an id to the
input
and a for attribute to the associated labellabel
blank - _inlineboolean
true
invokes the inline visual permutationfalse - disabledbooleanSets the field as to appear disabled, users will not be able to interact with the text field.false
- checkedbooleanspecifies that the
input
element should be pre-selected (checked) when the page loads.false - classstringadds
class=""
to the inputblank - _classstringadds
class=""
to the container div (.form-check
)blank - _helpstringoutputs additional help or instructional textblank
- _helpLinkhtml block (no quotes)appends a link to help or instructional textblank
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