Radio Button

<esp-radio-button>

A radio button control for choosing one option from a set. Uses Tabler SVG icons for selected and unselected states. Should be used inside an esp-radio-button-group for single-select behavior.

Slots

<esp-radio-button> has a slot:

Default

The label text for the radio button.

Attributes

<esp-radio-button> has the following attributes:

checked

checked has a default value of false.

Whether the radio button is in the selected state.

value

value has a default value of "".

The value associated with this radio button. Used by esp-radio-button-group to track which option is selected.

disabled

disabled has a default value of false.

Controls whether the radio button is disabled.

Methods

<esp-radio-button> has the following methods:

focus

Focus the radio button control.

traverseToClosest

Traverse up the DOM tree to find the closest element that matches the selector. This method is aware of shadow DOM boundaries and will traverse through them to find the element.

Events

<esp-radio-button> emits the following events:

value-changed

value-changed is of type CustomEvent<{ checked: boolean; value: string }>.

Fired when the radio button is selected. The detail contains the new checked state and the radio button value.

CSS Properties

<esp-radio-button> has the following CSS properties:

--esp-radio-button-size

The width and height of the radio icon. Defaults to var(--esp-size-normal-to-medium).

--esp-radio-button-icon-color

The stroke color of the radio icon. Defaults to var(--esp-color-text).

--esp-radio-button-focus-shadow

The color of the focus ring shadow. Defaults to var(--esp-color-shadow).

--esp-field-background

Background color of the shared field shell. Defaults to var(--esp-color-layer-2).

--esp-field-border-color

Border color of the shared field shell. Defaults to var(--esp-color-border).

--esp-field-border-width

Border width of the shared field shell. Defaults to 1px.

--esp-field-text-color

Text color used inside the shared field shell. Defaults to var(--esp-color-text).

--esp-field-hover-bg

Hover background color of the shared field shell. Derived from --esp-field-background.

--esp-field-focus-bg

Focus background color of the shared field shell. Derived from --esp-field-background.

--esp-field-focus-shadow

Shadow color used for shared field focus treatment. Defaults to var(--esp-color-shadow).

Where does this show?