Select
Select dropdown with grouped options, per-item descriptions, multiple selection and action items; on a phone, an iOS pop-up menu.
import { Select } from "@plexui/vue/components/Select";One iOS menu, opened three ways: Menu from a button of actions, Select from a button that shows a value, as an iOS pop-up button, and Context Menu from a touch and hold or a secondary click on an element. Select Control is Select's button alone, for a list of your own. On a phone the three menus draw the same rows, described once under Menu › On a phone.
On Phone, put a select in a Field row of a FieldGroup, as the Settings Forms do: the value and its up-down chevrons sit at the row's end, like an iOS pop-up button, and its list opens over the value, as the pop-up menu of an iOS picker does: 250px wide, its end at the chevron's end, 9px below the row's top, and toward the larger part of the screen. The value is hidden under the list while it is open. The list is an iOS menu, so its rows are the rows of Menu › On a phone: a description is the row's subtitle, and so is a tooltip; the checkmark leads every row whatever checkPosition says ("none" still leaves it out), so the Phone previews leave out that control. It has no search, as an iOS menu has none: a long list scrolls. A clearable select with its default trigger has no clear button there, as an iOS pop-up button has none (a custom trigger owns its clearing): its list leads with a None row in a section of its own, checked while nothing is chosen, and choosing it unsets the value and closes the list, a multiple one too, as Reminders does. none-label names the row. The row sets its height, insets and type, so the Phone previews show rows without the variant and size controls.
Examples
Overview
With descriptions
Actions
Grouped options
Multiple selection
API
Use aria-labelledby with the ID of a visible field label. The default trigger includes that label and its current value or placeholder in its accessible name. aria-label, aria-describedby and aria-invalid also reach the default trigger. Custom triggers manage their own accessibility attributes.
The open list is a listbox (aria-multiselectable with multiple) named by aria-labelledby, then aria-label, then the default trigger; with a custom trigger, pass one of the two so the list has a name. aria-selected follows the selection and aria-activedescendant the highlighted option. Each option group is a group named by its label, so screen readers announce the group, and the arrow keys move through the options of every group in order. Typing a letter moves to the next matching option; Ctrl, Cmd and Alt shortcuts are left alone. After an option is chosen or Escape is pressed, focus returns to the trigger, a custom one included.
Searchable menus name their input Search options by default. Set search-aria-label for a more specific search label without changing the trigger's accessible name or the visible placeholder.
| Prop | Type | Default | Description |
|---|---|---|---|
options | Options<T> | — | Array of options or grouped options |
v-model:value | string | string[] | — | Selected value (single) or values (multiple) |
@change | (option | options) => void | — | Called when selection changes, with the selected option (or options with multiple) |
multiple | boolean | false | Allow multiple selection. value, @change and @update:value are typed by it |
placeholder | string | "Select..." | Trigger placeholder |
variant | "soft" | "outline" | "ghost" | "outline" | Trigger variant |
size | ControlSize | "md" | Trigger size (3xs to 3xl) |
pill | boolean | false | Rounded trigger |
clearable | boolean | false | Show clear button. On a phone, with the default trigger, a None row first in the list instead |
none-label | string | "None" | Label of the row that unsets a clearable select on a phone |
block | boolean | variant !== "ghost" | Full width trigger |
disabled | boolean | false | Disable select. A disabled select is not submitted or validated with its form |
loading | boolean | false | Loading state; shows loading-placeholder and keeps the menu closed |
loading-placeholder | string | "Loading..." | Trigger text while loading |
all-selected-label | string | "All selected" | Text of a multiple trigger when every option is selected |
name | string | — | Name of the hidden form input. With multiple, every selected value is submitted |
required | boolean | — | Required for native form validation |
id | string | — | Id of the hidden form input |
actions | array | — | Actions below options list |
check-position | "start" | "end" | "none" | "start" | Where the check indicator sits in the list. "none" removes the indicator column for lists that never carry a selection. On a phone the checkmark leads the row, as in iOS menus, so "end" stands at the start there |
#optionView / OptionView | slot (option) | Component | — | Custom option render |
#triggerView / TriggerView | slot | Component | — | Custom trigger render: the selected option, or { values, selectedAll } with multiple |
TriggerStartIcon | Component | — | Icon at the start of the trigger |
#trigger / trigger | slot ({ open, onToggle }) | function | — | Custom trigger element, wrapped as the popover trigger |
dropdown-icon-type | "chevronDown" | "dropdown" | "none" | "dropdown" | Indicator at the end of the trigger |
side | "top" | "bottom" | "bottom" | Preferred side of the list. Without one, on a phone the list opens over its trigger toward the larger part of the screen |
align | "start" | "center" | "end" | "end" at the end of a Field row ("start" in a FieldGroup with columns), "center" when block, otherwise "start" | Alignment of the list against the trigger |
list-width | number | "auto" | trigger width (fits the options when not block or at the end of a Field row; 250px on a phone) | Width of the list in px |
list-min-width | number | "auto" | trigger width (at least 250px on a phone, unless the list has its own width or a smaller maximum) | Minimum width of the list in px |
list-max-width | number | "auto" | "auto" (300 when it fits the options) | Maximum width of the list in px |
search-placeholder | string | — | Search input placeholder |
search-aria-label | string | "Search options" | Accessible name of the search input, independent of the trigger label |
#searchEmptyMessage / search-empty-message | slot | string | "No results found." | Shown when the search matches nothing |
search-size | ControlSize | "md" | Size of the search input in the menu. A phone list has no search: it is an iOS menu, and a long one scrolls |
search-predicate | (option, term) => boolean | — | Filters options while searching |
aria-label / aria-labelledby | string | — | Accessible name of the trigger and the list |
Select shares the unified 9-step size scale with Button, Input, SelectControl, and SegmentedControl.
Styling
Phone options share Menu's 34px corners and 17/20px label scale with the optional touch.css stylesheet. Long labels wrap within their text column; selection indicators keep a separate slot. Custom option content must inherit the label line height and allow its text to shrink. Search stays fixed while the option list scrolls.
On phones, Select uses the visible Page or Dialog footer as the bottom limit for collision handling. Search keeps its height while the list scrolls within the available space. :avoid-collisions="false" disables this adjustment.
Select reads these component tokens. Override them at any scope to restyle it:
--link-primary-text-color: primary text color (defaultlight-dark(var(--blue-500), var(--blue-300)))--menu-font-size: font size (defaultvar(--font-text-sm-size))--menu-gutter: gutter (defaultspacing(1.5))--menu-item-background-color: item background color (defaultlight-dark(var(--alpha-08), var(--alpha-10)))--menu-item-gap: item gap (defaultspacing(1.5))--menu-item-padding: item padding (defaultspacing(1.5) spacing(2))--menu-line-height: line height (defaultvar(--font-text-sm-line-height))--menu-radius: radius (defaultvar(--radius-xl))--menu-separator-background-color: separator background color (defaultvar(--color-border))