Select <select>
Selects are used to pick a single option from a dropdown list. Commonly used in forms for choosing categories, countries, or any predefined set of values.
Built on the Customizable Select API (appearance: base-select). Where unsupported it degrades to a native <select> — so always keep meaningful text in each <option>.
<select>Options
Basic
Add class="l-select" to a native <select> and class="l-select-item" to each <option>.
Code
<select
class="l-select"
aria-label="Plan"
>
<option
class="l-select-item"
value="free"
>
Free
</option>
<option
class="l-select-item"
value="pro"
>
Pro
</option>
<option
class="l-select-item"
value="team"
>
Team
</option>
</select>Rich options
Put any HTML inside an <option>. Wrap a .l-select-item-title over a .l-select-item-description in .l-select-item-text (add a .l-select-item-media image or icon before it if needed). A <button><selectedcontent></button> trigger mirrors the chosen option — the description is hidden there to keep it compact.
Code
<select
class="l-select"
aria-label="Merge method"
>
<button>
<selectedcontent></selectedcontent>
</button>
<option
class="l-select-item"
value="squash"
selected
>
<span class="l-select-item-text">
<span class="l-select-item-title">Squash and merge</span>
<span class="l-select-item-description">
The 1 commit from this branch will be added to the base branch.
</span>
</span>
</option>
<option
class="l-select-item"
value="rebase"
>
<span class="l-select-item-text">
<span class="l-select-item-title">Rebase and merge</span>
<span class="l-select-item-description">
The 1 commit from this branch will be rebased and added to the base branch.
</span>
</span>
</option>
</select>Accessibility
Criteria
- Disabled state
Native
disabledattribute prevents interaction and announces as disabledWCAG4.1.2
Keyboard interactions
API reference
Importing
@import 'luxen-ui/css/select';Attributes & Properties
data-sizexs | sm | md | lg | xlAttribute- Control height on the shared
--l-size-control-*scale (defaultmd). disabledAttribute- Disables the select.
requiredAttribute- Marks the field as required.
multipleAttribute- Allows multiple selections.
Events
changeEvent- Fires when an option is selected.
inputEvent- Fires when the value changes.
CSS classes
.l-selectClass- Base select element with
appearance: base-select. .l-select-itemClass- Option styling with checkmark indicator.
.l-select-item-mediaClass- Leading image/icon inside a rich option.
.l-select-item-textClass- Column wrapper stacking title + description.
.l-select-item-titleClass- Primary label of a rich option.
.l-select-item-descriptionClass- Secondary line of a rich option (hidden in the trigger).
CSS custom properties
--heightdefault:var(--l-form-control-height)Custom property- Control height (set via
data-sizeor directly). --border-radiusdefault:var(--l-form-control-border-radius)Custom property- Trigger border radius.
--caret-colordefault:var(--l-form-control-placeholder-color)Custom property- Chevron color.
--caret-icondefault:mdi:chevron-downCustom property- Chevron mask image; override with any
url()to re-skin.