<select-control>

A wrapper element that augments a <select> with previous/next controls.

Import

Import and register the <select-control> custom element, upgrading any instances already in the DOM:

import SelectControl from '../../literal/documentation/templates/select-control.js';

Use

The <select-control> element wraps a <select>, augmenting it with styleable previous/next buttons and left/right arrow keyboard behaviour:

<select-control>
    <select>...</select>
</select-control>

Default content of previous and next buttons may be overridden with HTML assigned to the previous-button and next-button slots:

<select-control>
    <span slot="previous-button"></span>
    <span slot="next-button"></span>
    <select>...</select>
</select-control>

Note that the element itself is not a custom form element (it has no value property and does not set any form data in its internals).

Parts

::part(previous-button)

::part(next-button)

Variables

--button-width

.5rem; Width of decrement/increment buttons.

Slots

slot="previous-button"

Replace default content of the decrement button ("◀") with custom HTML.

slot="next-button"

Replace default content of the increment button ("▶") with custom HTML.

Contribute

Support development: Sponsor


Built by Stephen Band for Cruncher logo Cruncher.

Documentation set in Euclid and Martian Mono. Fonts used for documentation not included as part of the license covering the use of select-control.