Radio
<wa-radio>
Radios allow the user to select a single option from a group.
This component must be used as a child of <wa-radio-group>. Please see the Radio Group docs to see examples of this component in action.
Slots
Jump to heading
Learn more about using slots.
| Name | Description |
|---|---|
| (default) | The radio's label. |
Attributes & Properties
Jump to heading
Learn more about attributes and properties.
| Name | Description | Reflects | |
|---|---|---|---|
formform |
The string pointing to a form's id.
Type
string | nullDefault
null |
|
|
valuevalue |
The radio's value. When selected, the radio group will receive this value.
Type
string |
|
|
appearanceappearance |
The radio's visual appearance.
Type
'default' | 'button'Default
'default' |
|
|
sizesize |
The radio's size. When used inside a radio group, the size will be determined by the radio group's size so this
attribute can typically be omitted.
Type
'small' | 'medium' | 'large'Default
'medium' |
|
|
disableddisabled |
Disables the radio.
Type
booleanDefault
false |
Events
Jump to heading
Learn more about events.
| Name | Description |
|---|---|
blur |
Emitted when the control loses focus. |
focus |
Emitted when the control gains focus. |
CSS custom properties
Jump to heading
Learn more about CSS custom properties.
| Name | Description |
|---|---|
--checked-icon-color |
The color of the checked icon.
|
--checked-icon-scale |
The size of the checked icon relative to the radio.
|
Custom States
Jump to heading
Learn more about custom states.
| Name | Description | CSS selector |
|---|---|---|
checked |
Applied when the control is checked. |
:state(checked)
|
disabled |
Applied when the control is disabled. |
:state(disabled)
|
CSS parts
Jump to heading
Learn more about CSS parts.
| Name | Description | CSS selector |
|---|---|---|
control |
The circular container that wraps the radio's checked state. |
::part(control)
|
checked-icon |
The checked icon. |
::part(checked-icon)
|
label |
The container that wraps the radio's label. |
::part(label)
|
Dependencies
Jump to heading
This component automatically imports the following elements. Sub-dependencies, if any exist, will also be included in this list.
Importing
Jump to heading
Autoloading components via projects is the recommended way to import components. If you prefer to do it manually, use one of the following code snippets.
Let your project code do the work! Sign up for free to use a project with your very own CDN — it's the fastest and easiest way to use Web Awesome.
To manually import this component from NPM, use the following code.
import '@awesome.me/webawesome/dist/components/radio/radio.js';
To manually import this component from React, use the following code.
import WaRadio from '@awesome.me/webawesome/dist/react/radio';