Select
Usage
Include CSS
Import Tailwind and one full A3S UI style bundle.
Or import only the base CSS, Select component CSS, and one style pack.
Using CDN or bundler imports? See the Installation page.
Include JavaScript
Copy or serve the full A3S UI JavaScript bundle.
Or copy or serve the A3S UI runtime and Select script.
Using CDN or bundler imports? See the Installation page.
Add your select HTML
HTML structure
<div class="select">Select root. Add
data-placeholderto show placeholder text when no value is selected. Supportsdata-close-on-select="true"for multiple select anddata-format="object"for serialized object values.<button type="button">- Trigger button. Use
aria-haspopup="listbox",aria-expanded, andaria-controls. <div data-popover aria-hidden="true">Popover content. Supports
data-sideanddata-alignthrough the shared Popover rules.<div role="listbox">Options container. Add
aria-multiselectable="true"for multiple selection.<div role="option" data-value="..." data-label="...">- Selectable option.
data-valueis submitted.data-labelis optional and controls the selected display label anddata-format="object"label; when omitted, A3S UI uses trimmed text content. <hr role="separator">Optional- Separator between groups or options.
<div role="group">Optional- Option group. Use
aria-labelledbyto connect it to its heading. <span role="heading">Optional- Group heading.
<input type="hidden">- Submitted value. Empty value means no selection when the root has
data-placeholder. Single select stores a string; multiple select stores a JSON array. Withdata-format="object", values are serialized as{ value, label }objects.
JavaScript API
Examples
Groups
Scrollable
A select with many items that scrolls.
Disabled
Invalid
Please select a valid fruit.