Select
<al-select><ALSelect> REACTbetaReference generated from the custom elements manifest — 19 properties, 4 slots, 2 events.
CODE — HTML / REACT
Guidance
A choice from a known list, rendered as a field the user opens rather than types into. It composes al-input for the field itself and al-dropdown-panel for the options, so it inherits the whole form-field treatment — label, required marker, field note, error note — and adds the open/closed state and keyboard traversal on top.
WHEN TO USE
- The value comes from a set the product knows in advance: a country, a status, an assignee, a plan.
- The list is long enough that showing every option at once would dominate the form, but short enough that the user recognises the option rather than recalling it.
- The list is long enough to need filtering — set
hasSearchand a search field is rendered in the panel header.
WHEN NOT TO USE
- The user may need to enter a value that is not in the list. The field is
isReadonlyby default, so typing an unlisted value is not possible.USE COMBOBOX → - There are only two or three options and the form has room. Showing them all costs one click less and makes the choice visible while filling the rest of the form.USE RADIO-GROUP →
- The choice is a binary on/off for a single setting.USE TOGGLE →
- What is being opened is a list of actions or destinations rather than a value the form will submit.USE MENU →
DO
- Give the panel a search field with
hasSearchonce the list passes roughly ten options — scanning a long unfiltered list is where this control gets slow. - Use
align="top"when the field sits near the bottom of the viewport, so the panel opens into space rather than off-screen. - Set
isErroralongsideerrorNote, exactly as withal-input— the field treatment is inherited, and so is that requirement. - Keep
isReadonlyat its defaulttrueunless you have deliberately built a type-ahead. It is what stops the user typing a value the list cannot honour.
DON’T
- Don't expect the options to exist in the DOM while the select is closed. The dropdown panel is only rendered when the panel is open, so anything that walks the light DOM for options — a test, a form serializer, an autofill heuristic — will find nothing until it is opened.
- Don't stamp
role="option"onto the slotted items. They areal-list-items that render their own<button>, and an interactive role wrapping an interactive control is exactly the pattern the component avoided on purpose. - Don't use this for multi-select without checking what the composed panel actually renders — the component registers
al-checkboxfor that case, but the behaviour is not a documented public prop. - Don't reach for a select when the answer is a date. There is a dedicated picker with the calendar semantics that come with it.
ACCESSIBILITY IN PRACTICE
- The combobox semantics —
role="combobox",aria-expanded,aria-haspopup="listbox"andaria-controls— were added deliberately after a review found the control announced only as "edit text", with nothing saying a list would open. - Those attributes are set on the
<al-input>host element rather than on the<input>inside its shadow root that actually takes focus. Verify the announcement in your target screen reader before relying on it. aria-controlsis emitted only while the panel is open, which is correct — the panel it names does not exist when closed.- The options stay un-roled on purpose.
aria-haspopup="listbox"states the intent without claiming a tree structure the DOM does not have.
CONTENT GUIDELINES
- Label the field with the thing being chosen ("Assignee", "Billing country"), not the act of choosing ("Select an assignee").
- Use
placeholderfor the unselected state and make it a real instruction the user can act on — it is the only text in the field before a choice is made. - Order options by what the user is most likely to want, not alphabetically, unless the list is long enough that alphabetical order is how they will search it.
- Keep option labels parallel in grammar and length so the list can be scanned rather than read.
WHERE THIS CAME FROM
libs/al-web-components/components/select/select.tsThe combobox semantics and the recorded reason they were added — the control previously announced as plain edit text.libs/al-web-components/components/select/select.tsThe field is read-only by default; that default is what makes this a picker rather than a text field.libs/al-web-components/components/select/select.tsThe optional search field rendered into the dropdown panel header.libs/al-web-components/components/select/select.tsThe panel — and therefore every option — is rendered only while open.
Each line above names a file and a literal string that must still appear in it.pnpm gate:guidance re-reads them from this built page, so guidance that has stopped being true fails a check rather than misleading you.
FIGMA PARITY
NO DESIGN-SYSTEM PROJECT TRACKS THIS COMPONENT AGAINST A FIGMA FILE — IT IS EITHER OUTSIDE EVERY PROJECT’S DECLARED SCOPE, OR NOT YET SEEDED INTO ITS PROJECT’S PARITY MANIFEST.
ACCESSIBILITY
The CI gate disables color-contrast globally (libs/al-web-components/story-fixture/src/main.ts), so its result never reaches a test run. It is enabled for this measurement, and reported here whichever way it comes out.
INSTALL
import '@southleft/al-web-components/components/select';
import { ALSelect } from '@southleft/al-react';API — 19 PROPS
SLOTS
EVENTS
PUBLIC METHODS
SOURCE — components/select/select.ts · Atoms/Form/Select