base-ui-svelte

Select

Displays a list of options for the user to pick from.

View as Markdown

API Reference

Props mirror Base UI React where applicable, adapted for Svelte 5. Native HTML attributes for the rendered element are also accepted unless noted.

Select.Root

Extends div HTML attributes.

PropertyTypeDefaultDescription
valuestring | null | undefinedControlled value.
defaultValuestring | nullUncontrolled initial value.
onValueChange((value: string | null, event: Event) => void) | undefinedEvent handler called when the value changes.
openboolean | undefinedWhether the component is open (controlled).
defaultOpenbooleanWhether the component is initially open (uncontrolled).
onOpenChange((open: boolean, eventDetails: { reason: OpenChangeReason }) => void) | undefinedEvent handler called when the open state changes.
disabledbooleanfalseWhether the control ignores user interaction.
namestring | undefined
childrenSnippet<[{ value: string | null; open: boolean; disabled: boolean }]>Content rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-disabledPresent when the part is disabled.
data-openPresent when the part is open.

Select.Arrow

Extends span HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-openPresent when the part is open.

Select.Backdrop

Extends div HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-openPresent when the part is open.

Select.Group

Extends div HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.

Select.GroupLabel

Extends div HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.

Select.Icon

Extends span HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-openPresent when the part is open.

Select.Item

Extends div HTML attributes.

PropertyTypeDefaultDescription
valuestringControlled value.
disabledbooleanfalseWhether the control ignores user interaction.
childrenSnippet<[{ selected: boolean; highlighted: boolean; disabled: boolean }]>Content rendered inside the part.
Data attributeDescription
data-disabledPresent when the part is disabled.
data-highlightedPresent when the item is highlighted.
data-selectedPresent when the item is selected.

Select.ItemIndicator

Extends span HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-disabledPresent when the part is disabled.
data-selectedPresent when the item is selected.

Select.ItemText

Extends span HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-highlightedPresent when the item is highlighted.
data-select-item-textPresent on the element when applicable.
data-selectedPresent when the item is selected.

Select.Label

Extends label HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-disabledPresent when the part is disabled.

Select.List

Extends div HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-openPresent when the part is open.

Select.Popup

Extends div HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-ending-stylePresent while the exit animation can run.
data-openPresent when the part is open.
data-starting-stylePresent while the enter animation can run.

Select.Portal

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.

Select.Positioner

Extends div HTML attributes.

PropertyTypeDefaultDescription
sideSide
alignAlign
sideOffsetnumber
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-openPresent when the part is open.

Select.ScrollDownArrow

Extends button HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-directionPresent on the element when applicable.
data-hiddenPresent on the element when applicable.

Select.ScrollUpArrow

Extends button HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-directionPresent on the element when applicable.
data-hiddenPresent on the element when applicable.

Select.Separator

Extends div HTML attributes.

No component-specific props — HTML attributes and children only.

Select.Trigger

Extends button HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
disabledbooleanfalseWhether the control ignores user interaction.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-disabledPresent when the part is disabled.
data-openPresent when the part is open.

Select.Value

Extends span HTML attributes.

PropertyTypeDefaultDescription
placeholderstring
childrenSnippet<[string | null]>Content rendered inside the part.
Data attributeDescription
data-placeholderPresent when showing placeholder content.