Skip to content

Select

Choose one value from a trigger-controlled popup list.

Usage

Environment

Choose one deployment environment from a popup collection.

Choose one deployment environment from a popup collection.

Deployment environment
Deployments inherit variables from the selected environment.

Disabled option

Show an unavailable option without allowing focus or selection to land on it.

Show an unavailable option without allowing focus or selection to land on it.

Deployment environment
Deployments inherit variables from the selected environment.

Controlled

Let the parent own the current value and apply accepted changes back to the component.

Let the parent own the current value and apply accepted changes back to the component.

Deployment environment
Deployments inherit variables from the selected environment.

Floating positioning

This component uses the shared positioning engine. Use the live positioning example to change side, align, offsets, collision boundaries, strategy, and tracking while inspecting the resolved placement.

API

Vue package: @sectile/vue/select

Components
  • SelectRoot
  • SelectTrigger
  • SelectValue
  • SelectContent
  • SelectItem
  • SelectItemIndicator
  • SelectViewport
  • SelectItemText
  • SelectPortal

Props

SelectRootProps

align

Alignment of positioned content relative to its anchor.

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

avoidCollisions

Whether positioned content may flip or shift to remain visible.

collisionBoundary

Boundary used to keep positioned content visible.

collisionPadding

Space kept between positioned content and its collision boundary.

defaultOpen

Initial uncontrolled open state.

defaultValue

Initial value used when the component owns its state.

disabled

Whether interaction is unavailable.

disabledItems

Item values excluded from focus and selection.

form

ID of the native form associated with the control.

hideWhenDetached

Whether positioned content hides when its anchor leaves the layout.

items

Ordered item values managed by the component.

label

Accessible name announced for the control.

modelValue

Current value when state is controlled by the parent.

name

Name used for native form submission.

open

Whether the associated popup or disclosure is open.

policies

Behavior policies that customize validation, movement, or selection.

position

Whether the popup is positioned relative to its trigger.

readonly

Whether the value can be inspected but not changed.

required

Whether the control must contain a valid value before submission.

side

Preferred side of the anchor for positioned content.

sideOffset

Distance between positioned content and its anchor.

strategy

CSS positioning strategy used for anchored content.

textValue

Returns searchable or presentational text for an item value.

tracking

Update strategy used while anchored content is open.

typeaheadTimeoutMs

Idle time in milliseconds before the printable-text search buffer resets.

unmountOnExit

Whether presence-managed content is removed from the DOM after its exit motion completes.

SelectItemProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

disabled

Whether interaction is unavailable.

value

Current value exposed by this contract.

SelectPartProps

as

Element or component rendered for this part.

asChild

Whether to merge this part into its single child instead of rendering a wrapper.

SelectPortalProps

defer

Whether Teleport target resolution waits until the end of the current mount or update tick.

disabled

Whether interaction is unavailable.

to

Teleport target for portalled content.

Slots

SelectRootSlotProps

disabled

Whether interaction is unavailable.

highlightedValue

Value currently highlighted for interaction.

open

Whether the associated popup or disclosure is open.

readonly

Whether the value can be inspected but not changed.

value

Current value exposed by this contract.

SelectItemSlotProps

disabled

Whether interaction is unavailable.

highlighted

Whether this item is highlighted for interaction.

selected

Whether this item is selected.

value

Current value exposed by this contract.

Events

SelectRoot

highlight

Emitted when the highlighted item changes.

update:modelValue

Emitted when the component requests a new controlled value.

update:open

Emitted when the component requests a new open state.

Other types

SelectTextValueResolver

ts
type SelectTextValueResolver = NonNullable<SelectRootProps['textValue']>

SelectValueChangeHandler

ts
type SelectValueChangeHandler = (value: string | null) => void

SelectOpenChangeHandler

ts
type SelectOpenChangeHandler = (value: boolean) => void

SelectHighlightHandler

ts
type SelectHighlightHandler = (value: string | null) => void

Parts

Shared scope: [data-scope="select"]. Combine it with a part selector to keep styles local to this component.

PartSelectorRoleExtra attributes
root[data-part="root"]Defines the component boundary and owns its composed parts.
trigger[data-part="trigger"]Opens, closes, or activates the associated content.
value[data-part="value"]Displays the current committed value.
content[data-part="content"]Contains the component content shown for the active state.
viewport[data-part="viewport"]Clips and positions the currently visible content.
item[data-part="item"]Represents one selectable or actionable item.
item-text[data-part="item-text"]Renders the item label independently from its controls.
item-indicator[data-part="item-indicator"]Shows the item selection state.

Keyboard interaction

KeyBehavior
Arrow keysMove the active option in the visible orientation.
Home / EndMove to the first or last eligible option.
Enter / SpaceSelect or activate the current option.
Printable textMove to the next matching option when typeahead is available.

Accessibility

The trigger owns a portalled listbox whose active descendant, selected options, and disabled options remain linked across DOM boundaries.

See the corresponding WAI-ARIA pattern for the host accessibility contract.

Released under the MIT License.