Skip to main content

Radio

Use cases:

  • Selecting exactly one from multiple options in the same input

Example

Radio

Declaration

<rapid-radio>Radio</rapid-radio>

Usage

@customElement({
name: 'my-element',
template: html`
<rapid-radio
checked="true"
@change="${(x) => x.changeRadio()}"
:value="${sync((x) => x.radioValue)}">
Radio
</rapid-radio>
`,
})
export class MyElement extends GenesisElement {
@observable radioValue: string;
changeRadio() {
console.log(this.radioValue);
}
}

API

Property and attribute binding examples for Genesis Component syntax.

NameTypeDescriptionExample
checkedbooleanSets or retrieves the current state of the component. Default: false
<rapid-radio checked>
disabledbooleanSimilar to readonly, but with a blur on the component
<rapid-radio disabled>
valuestringSets a value for the component. Not visible to the user
<rapid-radio
value=${sync((x) => x.radioValue)}>
readonlybooleanIf true, the user cannot change the value of this checkbox (which is greyed out)
<rapid-radio readonly>

Properties

This component doesn't have any properties which are not also controlled via attributes.

Slots

SlotUse
checked-indicatorThe checked indicator

Parts

PartDescription
controlThe element representing the visual radio control
labelThe label
checked-indicatorThe checked indicator (requires the default checked-indicator slot to be present)

Events fired

NameDescription
@changeFires the event when the radio component changes its state

Events listened to

This component doesn't listen to any events.

Further details

This component is an implementation of an HTML radio element.