Select
A dropdown for choosing one option from a list in a form.
<arc-select>Overview
Select replaces the native <select> with a dropdown styled by ARC UI's tokens. Its options are <arc-option> children. Use it for one choice from a list in a form: a person to assign, a category, a status, a locale. For several choices use MultiSelect. For three or fewer options, RadioGroup shows them all at once. To filter a long list as you type, use Combobox.
Enter, Space or an arrow key opens the list. The arrows move through it and wrap at the ends, Home and End jump to the first and last option, Enter picks, and Escape closes. Typing letters jumps to the first option that starts with them, and pressing the same letter again cycles through the matches, as in a native select.
Guidelines
Do
- Give it a visible `label`. The placeholder disappears once a value is chosen
- Write a placeholder that names the choice, like "Choose a team member...", not "Select..."
- Keep option labels short, ideally under 40 characters
- Order options alphabetically, by frequency, or by workflow step
- Pre-select a default when there is a sensible one
Don't
- Don't use it to move between views. Use NavigationMenu or Tabs
- Don't disable it without saying why in helper text or a tooltip
Features
- Focus stays on the trigger while `aria-activedescendant` tracks the highlighted option, so screen readers announce it
- The highlighted option scrolls into view in a long list
- An `<arc-option>` with `disabled` stays visible but is skipped by the keyboard and can't be picked
- Disabled drops the control to 50% opacity and blocks pointer events
Preview
Usage
This component needs JavaScript. Use the Web Component or a framework wrapper.
<script type="module" src="@arclux/arc-ui"></script>
<!-- Basic select -->
<arc-select label="Assign to team member" placeholder="Choose a person...">
<arc-option value="alice-chen">Alice Chen</arc-option>
<arc-option value="bob-martinez">Bob Martinez</arc-option>
<arc-option value="carol-nguyen">Carol Nguyen</arc-option>
<arc-option value="david-okafor">David Okafor</arc-option>
<arc-option value="eva-johansson">Eva Johansson</arc-option>
</arc-select>
<!-- Pre-selected value -->
<arc-select label="Status" value="in-progress">
<arc-option value="open">Open</arc-option>
<arc-option value="in-progress">In Progress</arc-option>
<arc-option value="review">In Review</arc-option>
<arc-option value="done">Done</arc-option>
</arc-select>
<!-- In a native form -->
<form action="/api/assign" method="post">
<arc-select name="assignee" label="Assignee" placeholder="Pick someone...">
<arc-option value="alice">Alice</arc-option>
<arc-option value="bob">Bob</arc-option>
</arc-select>
<button type="submit">Save</button>
</form>
<script>
document.querySelector('arc-select')
.addEventListener('arc-change', (e) => {
console.log('Selected:', e.detail.value, e.detail.label);
});
</script>import { Select, Option } from '@arclux/arc-ui-react';
import { useState } from 'react';
function TeamAssigner() {
const [assignee, setAssignee] = useState('');
return (
<Select
label="Assign to team member"
placeholder="Choose a person..."
value={assignee}
onArcChange={(e) => setAssignee(e.detail.value)}
>
<Option value="alice-chen">Alice Chen</Option>
<Option value="bob-martinez">Bob Martinez</Option>
<Option value="carol-nguyen">Carol Nguyen</Option>
<Option value="david-okafor">David Okafor</Option>
<Option value="eva-johansson">Eva Johansson</Option>
</Select>
);
}
function StatusPicker() {
return (
<Select label="Status" value="in-progress">
<Option value="open">Open</Option>
<Option value="in-progress">In Progress</Option>
<Option value="review">In Review</Option>
<Option value="done">Done</Option>
</Select>
);
}<script setup>
import { Select, Option } from '@arclux/arc-ui-vue';
import { ref } from 'vue';
const assignee = ref('');
</script>
<template>
<Select
label="Assign to team member"
placeholder="Choose a person..."
:value="assignee"
@arc-change="assignee = $event.detail.value"
>
<Option value="alice-chen">Alice Chen</Option>
<Option value="bob-martinez">Bob Martinez</Option>
<Option value="carol-nguyen">Carol Nguyen</Option>
<Option value="david-okafor">David Okafor</Option>
<Option value="eva-johansson">Eva Johansson</Option>
</Select>
</template><script>
import { Select, Option } from '@arclux/arc-ui-svelte';
let status = 'open';
</script>
<Select label="Task status" value={status}
on:arc-change={(e) => status = e.detail.value}>
<Option value="open">Open</Option>
<Option value="in-progress">In Progress</Option>
<Option value="review">In Review</Option>
<Option value="done">Done</Option>
<Option value="closed">Closed</Option>
</Select>import { Component } from '@angular/core';
import { Select, Option } from '@arclux/arc-ui-angular';
@Component({
imports: [Select, Option],
template: `
<arc-select label="Assign to team member" placeholder="Choose a person..."
[value]="assignee" (arc-change)="assignee = $event.detail.value">
<arc-option value="alice-chen">Alice Chen</arc-option>
<arc-option value="bob-martinez">Bob Martinez</arc-option>
<arc-option value="carol-nguyen">Carol Nguyen</arc-option>
<arc-option value="david-okafor">David Okafor</arc-option>
<arc-option value="eva-johansson">Eva Johansson</arc-option>
</arc-select>
`,
})
export class AssignmentComponent {
assignee = '';
}import { Select, Option } from '@arclux/arc-ui-solid';
import { createSignal } from 'solid-js';
function CategoryPicker() {
const [category, setCategory] = createSignal('');
return (
<Select label="Category" placeholder="Choose a category..."
value={category()} onArcChange={(e) => setCategory(e.detail.value)}>
<Option value="bug">Bug Report</Option>
<Option value="feature">Feature Request</Option>
<Option value="docs">Documentation</Option>
<Option value="question">Question</Option>
</Select>
);
}import { Select, Option } from '@arclux/arc-ui-preact';
import { useState } from 'preact/hooks';
function LocalePicker() {
const [locale, setLocale] = useState('en');
return (
<Select label="Language" value={locale}
onArcChange={(e) => setLocale(e.detail.value)}>
<Option value="en">English</Option>
<Option value="es">Español</Option>
<Option value="fr">Français</Option>
<Option value="de">Deutsch</Option>
<Option value="ja">日本語</Option>
</Select>
);
}API
valuestring''- The currently selected value. Must match one of the child
arc-optionvalue attributes. Setting this programmatically updates the displayed label and internal selection state. placeholderstring'Select...'- Hint text displayed inside the trigger button when no option is selected. Use it to communicate what kind of choice the user should make, such as "Choose a team member..." or "Pick a status". The placeholder disappears once a value is chosen.
labelstring''- Visible label rendered above the select trigger. Also serves as the accessible name for assistive technologies. Always provide a label for accessibility compliance.
namestring''- Form field name submitted with the selected value. Required for native form integration via ElementInternals.
disabledbooleanfalse- When true, the select trigger becomes non-interactive: it cannot be opened, focused via keyboard, or clicked. The component renders with reduced opacity to visually convey the unavailable state.
errorstring''- Error message displayed below the select. When set, the trigger border turns red.
size'sm' | 'md' | 'lg''md'- Controls the select trigger size.
openbooleanfalse- Controls whether the dropdown is visible. Set programmatically to open or close the dropdown. Automatically set to
falsewhen an option is selected or the user clicks outside. Held atfalsewhiledisabled. formAssociatedbooleantruepropertiesobject{ // flag(), unlike `disabled`. The exclusion in props.js is specifically // about form-associated *platform* semantics: a `disabled` content // attribute that is merely present makes the element actually disabled // per the HTML spec, and formDisabledCallback assigns the property back, // so no converter can win. Neither of these is platform-mapped: // `required` is enforced by _computeValidity() below and `readonly` by // each component's own interaction handlers, so the stock converter buys // nothing here and costs the usual bug: `required="false"` read as true, // blocking submission of a form the author meant to leave optional. // Finding #48's shape, across all 26 form controls at once. required: flag(false), readonly: flag(false), }- Lit merges static properties up the prototype chain, so every consumer
gets these without declaring them.
requiredparticipates in constraint validation below;readonlyreflects for styling and is enforced by each component's interaction handlers (the mixin can't know which gestures mutate state). autoValidatesbooleantrue- Components that run their own constraint-validation logic (pattern checks, range checks) opt out of the automatic required sync by overriding this to false, and own the whole validity flag set instead.
formvalidityvalidationMessagerequiredbooleanfalsereadonlybooleanfalse
Methods
checkValidity()boolean- Whether the control currently satisfies its constraints, per the native
constraint-validation API. Fires
invalidon the element when it does not, and reports nothing to the user. reportValidity()boolean- As checkValidity(), but also shows the browser's validation message against the control when it fails.
Events
arc-change- Fired when the selected option changes
Option
<arc-option>One choice in a Select or MultiSelect. Its `value` is what the form submits and its text content is the label.
label- Expose text content as label
valuestring''- The value identifier for this option, used to match against the parent control value.
disabledbooleanfalse- When true, dims this option and prevents it from being selected.
selectedbooleanfalse