Design System

Select reference ​

Every prop, event, attribute and measurement, for both wrappers. For how to apply it, see Usage. Measurements are taken at the 14px root the application pins.

Props ​

PropTypeRequiredDefaultMeaning
labelstringyesnoneText of the <label> bound to the control with for. On a single select it is not the accessible name
optionsunknown[]yesnoneOne row per entry, in array order. An empty array renders the empty message, "No available options", untranslated because nothing sets the library locale
hideLabelbooleannofalseSwaps the label class from text-fg-default to sr-only. The element, its text and its for stay in the DOM
optionLabelstring | undefinednoundefinedKey of the option field holding its text. Unset stringifies the option
optionValuestring | undefinednoundefinedKey of the option field holding its value. Unset emits the option object
optionGroupLabelstring | undefinednoundefinedKey of the group field holding its heading. Turns the list into grouped mode
optionGroupChildrenstring | undefinednoundefinedKey of the group field holding its rows. Passed together with optionGroupLabel
placeholderstring | undefinednoundefinedShown in fg-muted when the model is null or undefined. Unset renders a non-breaking space
multiplebooleannofalseSwaps the single-choice control for the multi-choice one. Changes the element tree, the height and the ARIA wiring
filterbooleannofalseAdds a search box to the overlay header, matching on contains
sizeCSelectSizeno"small"small or large. Neither value changes a pixel in this build
fluidbooleannofalseAdds w-full to the wrapper. The forwarded prop behind it paints nothing
invalidbooleannofalseGates message and aria-describedby. Paints the border on multiple only
messagestring | undefinednoundefinedValidation caption under the control. Renders only when invalid is also true
disabledbooleannofalseAdds the disabled fill, opacity-disabled, select-none, pointer-events-none and cursor-default
modelValueunknownnoundefinedDeclared with a model definition, so v-model is the route in. Untyped in both directions

The props type carries a generic parameter, and the component instantiates it without one, so T resolves to unknown and no inference flows from options to the model.

Events ​

EventDeclaredPayload
update:modelValueyesunknown
changeyes, as [value: unknown]{ originalEvent: Event, value: unknown }, forwarded verbatim from the library
focus, blur, show, hide, before-show, before-hide, filternoThe library payload. A template listener compiles to an on[A-Z] attribute and passes the filter
selectall-changenoUnreachable. The component fixes the toggle-all control off

Slots ​

SlotContent
noneThe template holds no slot element and the library control is rendered with no children, so its own value, option, optiongroup, header, footer, empty, dropdownicon and chip slots stay empty

Sizes ​

ValueLabel paddingTrigger height
small6px top and bottom, 8px left31px
large6px top and bottom, 8px left31px

CSelectSize is Extract<Size, "small" \| "large">, so passing medium fails typecheck. The two accepted values render identically, because the library declares no size prop and the value falls through to the DOM as a literal size attribute on a div.

Severities ​

None. The component imports no severity union and declares no severity prop. The one tonal state is invalid, and on a single select it changes no pixel.

DOM ​

Single select, with the library internal hidden spans left out.

PositionElementNotes
root<div>flex flex-col gap-1 text-body, plus w-full when fluid. Carries no caller attribute
1<label for>text-fg-default, or sr-only when hideLabel
2<div data-pc-name="select">The preset. Caller data-*, aria-*, name and form land here, as does the literal size attribute
2.1<span role="combobox">Carries the caller id, tabindex, and the label, value or placeholder text
2.2<div> with a 14px chevronThe dropdown block
3<span id="{id}-message">text-caption text-fg-danger, when invalid and message are both set

The overlay is portalled to the document body and exists only while open: an optional filter header, a scrolling list container, a <ul role="listbox">, one <li role="option"> per row, and polite live regions for the row count and the current selection.

With multiple the root becomes <div data-pc-name="multiselect">, the focusable element becomes a readonly <input role="combobox"> inside a visually hidden container, the visible text moves into two nested <div> elements, and each option row gains a 20px checkbox.

ARIA ​

AttributeOnWritten when
forthe labelalways, including when hideLabel makes the label sr-only. With multiple it targets a real input and the browser focuses it on click. On a single select it targets a <span>, so the library binds a click listener to the label instead
aria-describedbythe library root <div>invalid and message are both set
aria-labelthe combobox, single selecta caller forwards one, or a value or a placeholder supplies the text. With none of the three it is undefined
aria-labelthe combobox, multiplea caller forwards one. The component passes none, so the <label for> supplies the name by default
aria-invalidthe combobox, multipleinvalid is true
aria-invalidthe combobox, single selectnever. The library binds it on an editable branch this component does not use

role="combobox", aria-haspopup, aria-expanded, aria-controls, aria-activedescendant, role="listbox", role="option", aria-selected, aria-setsize, aria-posinset and the live regions all come from the library.

aria-describedby is bound to the library root rather than to the focusable element, so the element a keyboard reaches has no description.

Attributes ​

The filter is the single expression /^(data-|aria-|on[A-Z])|^(id|name|form)$/, minus id, which the component consumes. defineOptions sets inheritAttrs: false.

ShapeResult
data-*bound to the library control, which merges it onto its own root
aria-*bound to the library control, which merges it onto its own root. aria-label and aria-labelledby are declared props there, so each is read as a prop and written onto the combobox instead
on[A-Z] listenerbound to the library control
name, formbound to the library control, which puts them on a div, where they do nothing
idconsumed, then used as the combobox id and the label for target
aria-describedbydeleted. The component binds its own after the forwarded set, and an undefined value removes the key
class, style, ptdropped. Nothing reaches the DOM. Three tests pin these
any other namedropped

Geometry ​

PartSingleMultiple
Wrapper gap4px4px
Trigger height31px34px
Border and radius1px line-strong, 6px1px line-strong, 6px
Text inset from the trigger edge9px9px
Chevron block30px wide48px wide
Option row30px36px
Block with a label55px58px
Block with a hidden label31px34px
Block with a label and a message75pxnot measured
Overlay partValue
Surfacesurface-page behind a 1px line-default border, radius 6px
Shadownone. The preset puts shadow-md on the overlay, and that class computes to box-shadow: none in the running application
Minimum widththe outer width of the trigger, set inline when it opens
List cap196px, set inline by the library and beating the preset class
List padding4px around the list. The rows step 4px apart on a single select and 2px on multiple
Option padding8px top and bottom, 12px left and right, radius 6px
Group heading36px tall, fg-muted, weight 600
Filter header8px top, 8px left and right on a single select and 16px on multiple

Colour ​

StateBorderBackgroundText
restingline-strongsurface-pagefg-strong
hover, singlefill-secondarysurface-pagefg-strong
hover, multipleline-strong, unchangedsurface-pagefg-strong
placeholder showingline-strongsurface-pagefg-muted
invalid, singleline-strong, unchangedsurface-pagefg-strong
invalid, multipleline-dangersurface-pagefg-strong
disabledline-strongsurface-disabled at 0.6fg-strong through the opacity
multiple with an empty array boundline-strongsurface-pagetransparent
Overlay rowBackgroundText
restingnonefg-default
keyboard focussurface-hoverfg-default
selectedsurface-selectedfg-strong
focused and selectedsurface-hoverfg-strong
empty messagenonefg-strong

The single select keeps border-line-strong in its class list and adds border-line-danger beside it, and the strong line is emitted later in the stylesheet, so it wins. The multi-choice preset writes the border on the negated test instead. Colour changes run through a 200ms transition on both triggers.

CDropdown ​

A separate wrapper over the same library control, with no label, no message and no attribute filter.

PropTypeRequiredDefault
optionsT[]yesnone
modelValueNonNullable<T> | undefined | nullyesnone
optionLabel((option: T) => string) | undefinednoundefined
optionDisabled((option: T) => boolean) | undefinednoundefined
dataKeystring | undefinednoundefined
filterbooleannofalse
filterPlaceholderstring | undefinednoundefined
SlotPayload
value{ value: T, placeholder: string }
option{ option: T, index: number }
footernone
EventPayload
update:modelValueNonNullable<T>

The generic parameter is declared on the script block, so T is inferred from the call site here. Attribute inheritance is left on and the single root is the library control, so class, placeholder, disabled, checkmark, aria-label and a pass-through styling object all reach it without being declared. There is no label prop, no message, no invalid, no size and no multi-choice mode.

Call sites ​

CSelect, counted by parsing each opening tagCall sites
label, options7
fluid, optionLabel, optionValue6
placeholder, id4
hideLabel3
disabled, change, the option group pair1
multiple, filter, size, invalid, message0
CDropdown, counted the same wayCall sites
options13
optionLabel, aria-label written by hand12
class11
A slot6
placeholder and disabled, neither declared4
filter3
checkmark, undeclared2
dataKey, filterPlaceholder, a pass-through styling object1

CSelect has a spec file of eight cases. CDropdown has none.