Select Primitive
Use Select to pick one option from a popup list. It handles opening the list, moving between options with the keyboard, and submitting the chosen value when the control has a name.
Anatomy
Open the Framework list and choose React. The list closes and the trigger shows React.
---import { Select } from "@starwind-ui/astro/select";---
<Select.Root defaultValue="astro" name="framework"> <Select.Label>Framework</Select.Label> <Select.Trigger type="button"> <Select.Value>Astro</Select.Value> </Select.Trigger> <Select.Positioner> <Select.Popup> <Select.List> <Select.Item value="astro"> <Select.ItemText>Astro</Select.ItemText> </Select.Item> <Select.Item value="react"> <Select.ItemText>React</Select.ItemText> </Select.Item> </Select.List> </Select.Popup> </Select.Positioner></Select.Root>Open the Framework list and choose React. The list closes and the trigger shows React.
import { Select } from "@starwind-ui/react/select";
export function Example() { return ( <Select.Root defaultValue="astro" name="framework"> <Select.Label>Framework</Select.Label> <Select.Trigger type="button"> <Select.Value>Astro</Select.Value> </Select.Trigger> <Select.Positioner> <Select.Popup> <Select.List> <Select.Item value="astro"> <Select.ItemText>Astro</Select.ItemText> </Select.Item> <Select.Item value="react"> <Select.ItemText>React</Select.ItemText> </Select.Item> </Select.List> </Select.Popup> </Select.Positioner> </Select.Root> );}Open the Framework list and choose React. The list closes and the trigger shows React.
<script setup lang="ts">import Select from "@starwind-ui/vue/select";</script>
<template> <Select.Root defaultValue="astro" name="framework"> <Select.Label>Framework</Select.Label> <Select.Trigger type="button"> <Select.Value>Astro</Select.Value> </Select.Trigger> <Select.Positioner> <Select.Popup> <Select.List> <Select.Item value="astro"> <Select.ItemText>Astro</Select.ItemText> </Select.Item> <Select.Item value="react"> <Select.ItemText>React</Select.ItemText> </Select.Item> </Select.List> </Select.Popup> </Select.Positioner> </Select.Root></template>Open the Framework list and choose React. The list closes and the trigger shows React.
<script lang="ts"> import { Select } from "@starwind-ui/svelte/select";</script>
<Select.Root defaultValue="astro" name="framework"> <Select.Label>Framework</Select.Label> <Select.Trigger type="button"> <Select.Value>Astro</Select.Value> </Select.Trigger> <Select.Positioner> <Select.Popup> <Select.List> <Select.Item value="astro"> <Select.ItemText>Astro</Select.ItemText> </Select.Item> <Select.Item value="react"> <Select.ItemText>React</Select.ItemText> </Select.Item> </Select.List> </Select.Popup> </Select.Positioner></Select.Root>Open the Framework list and choose React. The list closes and the trigger shows React.
<div data-sw-select data-default-value="astro" data-name="framework"> <input data-sw-select-input type="hidden" /> <div data-sw-select-label>Framework</div> <button data-sw-select-trigger role="combobox" aria-haspopup="listbox" type="button"> <span data-sw-select-value>Astro</span> </button> <div data-sw-select-positioner> <div data-sw-select-popup role="listbox" hidden tabindex="-1"> <div data-sw-select-list> <div data-sw-select-item role="option" data-value="astro"> <span data-sw-select-item-text>Astro</span> </div> <div data-sw-select-item role="option" data-value="react"> <span data-sw-select-item-text>React</span> </div> </div> </div> </div></div>
<script type="module"> import { createSelect } from "@starwind-ui/runtime/select";
const root = document.querySelector("[data-sw-select]"); if (root) { createSelect(root); }</script>Astro, React, Vue, and Svelte components use the same underlying interactions. Each framework has its own way to read and update state. See the examples and your installed packageโs types for the available props and events. Plain HTML uses DOM events and Runtime methods.
Usage Guidelines
- Give the root a position for form validation. A required Select blocks form submission while it has no value. The browser shows its message next to the trigger and moves focus to the trigger. Give the Select root a position, such as
position: relative, so the message appears at the trigger inside scroll containers. The styled Select already does this.
Positioning
Select positions its popup from the trigger. Keep the Positioner and Popup parts near the trigger in source order so the relationship stays readable, then let the Runtime handle placement, collision, and open-state updates after hydration.
Examples
Positioned Select
Compose the positioning parts around the Select popup.
---import { Select } from "@starwind-ui/astro/select";---
<Select.Root defaultValue="astro"> <Select.Label>Framework</Select.Label> <Select.Trigger> <Select.Value>Astro</Select.Value> <Select.Icon>v</Select.Icon> </Select.Trigger> <Select.Positioner> <Select.Popup> <Select.List> <Select.Item value="astro"> <Select.ItemText>Astro</Select.ItemText> <Select.ItemIndicator /> </Select.Item> <Select.Item value="react"> <Select.ItemText>React</Select.ItemText> <Select.ItemIndicator /> </Select.Item> </Select.List> </Select.Popup> </Select.Positioner></Select.Root>import { Select } from "@starwind-ui/react/select";
export function Example() { return ( <Select.Root defaultValue="astro"> <Select.Label>Framework</Select.Label> <Select.Trigger> <Select.Value>Astro</Select.Value> <Select.Icon>v</Select.Icon> </Select.Trigger> <Select.Positioner> <Select.Popup> <Select.List> <Select.Item value="astro"> <Select.ItemText>Astro</Select.ItemText> <Select.ItemIndicator /> </Select.Item> <Select.Item value="react"> <Select.ItemText>React</Select.ItemText> <Select.ItemIndicator /> </Select.Item> </Select.List> </Select.Popup> </Select.Positioner> </Select.Root> );}<script setup lang="ts">import { Select } from "@starwind-ui/vue/select";</script>
<template> <Select.Root defaultValue="astro"> <Select.Label>Framework</Select.Label> <Select.Trigger> <Select.Value>Astro</Select.Value> <Select.Icon>v</Select.Icon> </Select.Trigger> <Select.Positioner> <Select.Popup> <Select.List> <Select.Item value="astro"> <Select.ItemText>Astro</Select.ItemText> <Select.ItemIndicator /> </Select.Item> <Select.Item value="react"> <Select.ItemText>React</Select.ItemText> <Select.ItemIndicator /> </Select.Item> </Select.List> </Select.Popup> </Select.Positioner> </Select.Root></template><script lang="ts"> import { Select } from "@starwind-ui/svelte/select";</script>
<Select.Root defaultValue="astro"> <Select.Label>Framework</Select.Label> <Select.Trigger> <Select.Value>Astro</Select.Value> <Select.Icon>v</Select.Icon> </Select.Trigger> <Select.Positioner> <Select.Popup> <Select.List> <Select.Item value="astro"> <Select.ItemText>Astro</Select.ItemText> <Select.ItemIndicator /> </Select.Item> <Select.Item value="react"> <Select.ItemText>React</Select.ItemText> <Select.ItemIndicator /> </Select.Item> </Select.List> </Select.Popup> </Select.Positioner></Select.Root><div data-sw-select data-default-value="astro"> <span data-sw-select-label>Framework</span> <button data-sw-select-trigger type="button"> <span data-sw-select-value>Astro</span> <span data-sw-select-icon>v</span> </button> <div data-sw-select-positioner> <div data-sw-select-popup> <div data-sw-select-list> <div data-sw-select-item data-value="astro"> <span data-sw-select-item-text>Astro</span> <span data-sw-select-item-indicator></span> </div> <div data-sw-select-item data-value="react"> <span data-sw-select-item-text>React</span> <span data-sw-select-item-indicator></span> </div> </div> </div> </div></div>
<script type="module"> import { createSelect } from "@starwind-ui/runtime/select";
const root = document.querySelector("[data-sw-select]"); if (root) { createSelect(root); }</script>Floating Behavior
| Fact | Value |
|---|---|
| Anchor part | trigger |
| Positioner part | positioner |
| Popup part | popup |
| Portal part | portal |
| Option props | side, align, sideOffset, alignOffset, avoidCollisions, alignItemWithTrigger |
API Reference
Root
The main element that owns the Select Runtime instance.
- Default element
- div
- Discovery hook
- data-sw-select
- Role
- -
Props
open boolean -
- Description
- Controls whether Select is open.
- Kind
- control
- Targets
- -
- Full type
- boolean
- React
Use open for controlled state and defaultOpen for default state, and onOpenChange for change proposals.
opendefaultOpenonOpenChange
- Astro
Use open or defaultOpen for initial state, listen for starwind:open-change, and call setOpen for later updates.
opendefaultOpenstarwind:open-changesetOpen
- Runtime / HTML
Use data-default-open for initial state, listen for starwind:open-change, and call setOpen for later updates.
data-default-openstarwind:open-changesetOpen
defaultOpen boolean -
- Description
- Sets whether Select starts open.
- Kind
- control
- Targets
- -
- Full type
- boolean
- React
Use open for controlled state and defaultOpen for default state, and onOpenChange for change proposals.
opendefaultOpenonOpenChange
- Astro
Use open or defaultOpen for initial state, listen for starwind:open-change, and call setOpen for later updates.
opendefaultOpenstarwind:open-changesetOpen
- Runtime / HTML
Use data-default-open for initial state, listen for starwind:open-change, and call setOpen for later updates.
data-default-openstarwind:open-changesetOpen
value string | null -
- Description
- Controls the current Select value.
- Kind
- control
- Targets
- -
- Full type
- string | null
- React
Use value for controlled state and defaultValue for default state, and onValueChange for change proposals.
valuedefaultValueonValueChange
- Astro
Use value or defaultValue for initial state, listen for starwind:value-change, and call setValue for later updates.
valuedefaultValuestarwind:value-changesetValue
- Runtime / HTML
Use data-default-value for initial state, listen for starwind:value-change, and call setValue for later updates.
data-default-valuestarwind:value-changesetValue
defaultValue string | null -
- Description
- Sets the initial Select value for uncontrolled usage.
- Kind
- control
- Targets
- -
- Full type
- string | null
- React
Use value for controlled state and defaultValue for default state, and onValueChange for change proposals.
valuedefaultValueonValueChange
- Astro
Use value or defaultValue for initial state, listen for starwind:value-change, and call setValue for later updates.
valuedefaultValuestarwind:value-changesetValue
- Runtime / HTML
Use data-default-value for initial state, listen for starwind:value-change, and call setValue for later updates.
data-default-valuestarwind:value-changesetValue
autoComplete string -
- Description
- Sets the native autocomplete behavior.
- Kind
- option
- Targets
- -
- Full type
- string
disabled boolean -
- Description
- Disables the Root part.
- Kind
- option
- Targets
- -
- Full type
- boolean
form string -
- Description
- Associates the control with a form element.
- Kind
- option
- Targets
- -
- Full type
- string
highlightItemOnHover boolean true
- Description
- Highlights Select items when the pointer moves over them.
- Kind
- option
- Targets
- -
- Full type
- boolean
modal boolean true
- Description
- Makes Select behave as a modal overlay.
- Kind
- option
- Targets
- root
- Full type
- boolean
name string -
- Description
- Sets the submitted form field name.
- Kind
- option
- Targets
- -
- Full type
- string
readOnly boolean false
- Description
- Marks the control as read-only.
- Kind
- option
- Targets
- -
- Full type
- boolean
required boolean -
- Description
- Marks the form control as required.
- Kind
- option
- Targets
- -
- Full type
- boolean
onOpenChange (open: boolean, details: SelectOpenChangeDetails) => void -
- Description
- Runs when Select opens or closes.
- Kind
- callback
- Targets
- -
- Full type
- (open: boolean, details: SelectOpenChangeDetails) => void
- React
Use open for controlled state and defaultOpen for default state, and onOpenChange for change proposals.
opendefaultOpenonOpenChange
- Astro
Use open or defaultOpen for initial state, listen for starwind:open-change, and call setOpen for later updates.
opendefaultOpenstarwind:open-changesetOpen
- Runtime / HTML
Use data-default-open for initial state, listen for starwind:open-change, and call setOpen for later updates.
data-default-openstarwind:open-changesetOpen
onValueChange (value: string | null, details: SelectValueChangeDetails) => void -
- Description
- Runs when the Select value changes.
- Kind
- callback
- Targets
- -
- Full type
- (value: string | null, details: SelectValueChangeDetails) => void
- React
Use value for controlled state and defaultValue for default state, and onValueChange for change proposals.
valuedefaultValueonValueChange
- Astro
Use value or defaultValue for initial state, listen for starwind:value-change, and call setValue for later updates.
valuedefaultValuestarwind:value-changesetValue
- Runtime / HTML
Use data-default-value for initial state, listen for starwind:value-change, and call setValue for later updates.
data-default-valuestarwind:value-changesetValue
Events
openChange onOpenChange open: boolean
- Description
- Fires when Select opens or closes.
- DOM event
- starwind:open-change
- Details type
- SelectOpenChangeDetails
- Timing
- before-state-commit
- Cancelable
- Yes
- Cancellation sequence
- Check internal eligibility and intent.
- Create one details object for the proposal.
- Call the Runtime callback with the details object when the controller exposes one.
- Dispatch the cancelable DOM event with the same details object, including when the callback canceled it.
- Read details.isCanceled, including cancellation caused by preventDefault().
- Apply the accepted state.
- Notify Runtime subscribers and other accepted-only observers.
valueChange onValueChange value: string | null
- Description
- Fires when the value changes for Select.
- DOM event
- starwind:value-change
- Details type
- SelectValueChangeDetails
- Timing
- before-state-commit
- Cancelable
- Yes
- Cancellation sequence
- Check internal eligibility and intent.
- Create one details object for the proposal.
- Call the Runtime callback with the details object when the controller exposes one.
- Dispatch the cancelable DOM event with the same details object, including when the callback canceled it.
- Read details.isCanceled, including cancellation caused by preventDefault().
- Apply the accepted state.
- Notify Runtime subscribers and other accepted-only observers.
State
open boolean open / defaultOpen
- Description
- Tracks whether Select is open.
- Initial attribute
- data-default-open
- Runtime getter
- getOpen
- Runtime setter
- setOpen
- React
Use open for controlled state and defaultOpen for default state, and onOpenChange for change proposals.
opendefaultOpenonOpenChange
- Astro
Use open or defaultOpen for initial state, listen for starwind:open-change, and call setOpen for later updates.
opendefaultOpenstarwind:open-changesetOpen
- Runtime / HTML
Use data-default-open for initial state, listen for starwind:open-change, and call setOpen for later updates.
data-default-openstarwind:open-changesetOpen
value string | null value / defaultValue
- Description
- Tracks the current Select value.
- Initial attribute
- data-default-value
- Runtime getter
- getValue
- Runtime setter
- setValue
- React
Use value for controlled state and defaultValue for default state, and onValueChange for change proposals.
valuedefaultValueonValueChange
- Astro
Use value or defaultValue for initial state, listen for starwind:value-change, and call setValue for later updates.
valuedefaultValuestarwind:value-changesetValue
- Runtime / HTML
Use data-default-value for initial state, listen for starwind:value-change, and call setValue for later updates.
data-default-valuestarwind:value-changesetValue
Data Attributes
Runtime hooks
State
Metadata
Label
Text label associated with Select.
- Default element
- div
- Discovery hook
- data-sw-select-label
- Role
- -
Data Attributes
Runtime hooks
Trigger
The control that opens, closes, or targets the Select content.
- Default element
- button
- Discovery hook
- data-sw-select-trigger
- Role
- combobox
Props
asChild boolean -
- Description
- Merges behavior onto your child element instead of rendering the default Trigger element.
- Kind
- rendering
- Targets
- trigger
- Full type
- boolean
Data Attributes
Runtime hooks
State
Metadata
Value
Displays the current Select value.
- Default element
- span
- Discovery hook
- data-sw-select-value
- Role
- -
Data Attributes
Runtime hooks
Icon
Decorative icon rendered by Select.
- Default element
- span
- Discovery hook
- data-sw-select-icon
- Role
- -
Data Attributes
Runtime hooks
Input
The native input synchronized by Select.
- Default element
- input
- Discovery hook
- data-sw-select-input
- Role
- -
Data Attributes
Runtime hooks
Portal
Moves Select overlay content to the document body when needed.
- Default element
- div
- Discovery hook
- data-sw-select-portal
- Role
- -
Data Attributes
Runtime hooks
Metadata
Positioner
Positions the Select content relative to its trigger.
- Default element
- div
- Discovery hook
- data-sw-select-positioner
- Role
- -
Props
side "top" | "right" | "bottom" | "left" "bottom"
- Description
- Sets the preferred side for Select content.
- Kind
- option
- Targets
- positioner, popup
- Full type
- "top" | "right" | "bottom" | "left"
align "start" | "center" | "end" "start"
- Description
- Sets how Select content aligns to its trigger.
- Kind
- option
- Targets
- positioner, popup
- Full type
- "start" | "center" | "end"
sideOffset number 4
- Description
- Sets the distance between Select content and its trigger.
- Kind
- option
- Targets
- positioner, popup
- Full type
- number
alignOffset number 0
- Description
- Adjusts the cross-axis alignment offset for Select content.
- Kind
- option
- Targets
- positioner, popup
- Full type
- number
avoidCollisions boolean true
- Description
- Allows Select content to shift or flip to stay visible.
- Kind
- option
- Targets
- positioner, popup
- Full type
- boolean
alignItemWithTrigger boolean true
- Description
- Configures the align item with trigger option for the Positioner part.
- Kind
- option
- Targets
- positioner
- Full type
- boolean
Data Attributes
Runtime hooks
Metadata
Popup
The floating content container for Select.
- Default element
- div
- Discovery hook
- data-sw-select-popup
- Role
- listbox
Props
side "top" | "right" | "bottom" | "left" "bottom"
- Description
- Sets the preferred side for Select content.
- Kind
- option
- Targets
- positioner, popup
- Full type
- "top" | "right" | "bottom" | "left"
align "start" | "center" | "end" "start"
- Description
- Sets how Select content aligns to its trigger.
- Kind
- option
- Targets
- positioner, popup
- Full type
- "start" | "center" | "end"
sideOffset number 4
- Description
- Sets the distance between Select content and its trigger.
- Kind
- option
- Targets
- positioner, popup
- Full type
- number
alignOffset number 0
- Description
- Adjusts the cross-axis alignment offset for Select content.
- Kind
- option
- Targets
- positioner, popup
- Full type
- number
avoidCollisions boolean true
- Description
- Allows Select content to shift or flip to stay visible.
- Kind
- option
- Targets
- positioner, popup
- Full type
- boolean
Data Attributes
Runtime hooks
State
Metadata
List
The list of selectable Select items.
- Default element
- div
- Discovery hook
- data-sw-select-list
- Role
- -
Data Attributes
Runtime hooks
Group
Groups related Select items.
- Default element
- div
- Discovery hook
- data-sw-select-group
- Role
- group
Data Attributes
Runtime hooks
Group Label
Labels a group of Select items.
- Default element
- div
- Discovery hook
- data-sw-select-group-label
- Role
- -
Data Attributes
Runtime hooks
Item
An interactive item inside the Select collection.
- Default element
- div
- Discovery hook
- data-sw-select-item
- Role
- option
Data Attributes
Runtime hooks
Metadata
Item Text
Text content for a Select item.
- Default element
- span
- Discovery hook
- data-sw-select-item-text
- Role
- -
Data Attributes
Runtime hooks
Item Indicator
Shows the selected state for a Select item.
- Default element
- span
- Discovery hook
- data-sw-select-item-indicator
- Role
- -
Data Attributes
Runtime hooks
State
Separator
Separates groups of Select items.
- Default element
- div
- Discovery hook
- data-sw-select-separator
- Role
- separator
Data Attributes
Runtime hooks
Scroll Up Arrow
Scrolls Select options upward.
- Default element
- div
- Discovery hook
- data-sw-select-scroll-up-arrow
- Role
- -
Data Attributes
Runtime hooks
Scroll Down Arrow
Scrolls Select options downward.
- Default element
- div
- Discovery hook
- data-sw-select-scroll-down-arrow
- Role
- -
Data Attributes
Runtime hooks
Runtime API
- Factory
createSelect- Import
@starwind-ui/runtime/select- Root hook
- root
data-sw-select - Option props
- autoComplete, defaultOpen, defaultValue, disabled, form, highlightItemOnHover, modal, open, readOnly, value
Option Lifecycles
| Option | Lifecycle |
|---|---|
| autoComplete | constructor-only |
| defaultOpen | constructor-only |
| defaultValue | constructor-only |
| disabled | constructor-only |
| form | constructor-only |
| highlightItemOnHover | constructor-only |
| modal | constructor-only |
| open | setter-backed |
| readOnly | constructor-only |
| value | setter-backed |
Runtime Setters
Form Participation
| Fact | Value |
|---|---|
| Form props | autoComplete, form, name, required, value |
| Hidden input | input (text) |
| Field integration | Yes |
Related Styled Components
Changelog
View version history v1.4.0 12 releases
v1.4.0
- Select options align to the reading start edge. Its popup keeps the direction of the trigger when it moves into a portal.
- A click during the Select close animation now goes to the page below the list. Before, the closing list caught the click, so a quick click on a control under it did nothing.
- When you close a Select with focus inside it, focus now goes back to the trigger as the close starts. The closing list takes no keyboard input until it hides.
- In Vue, the default slot of `Select.Value` no longer receives `label` and `value`. In Svelte, its `children` snippet no longer receives them. If you read them, use `v-model` or `bind:value` on the Select root and find the label from that value. Leave `Select.Value` empty to show the selected label.
- In Vue, `Select.Trigger` with `asChild` now accepts a child wrapped in one fragment or next to an empty `v-if`.
- In Vue, `SelectContextValue` no longer has `element`, `mounted`, `requestRefresh()` or `registerPortal()`. In Svelte, it no longer has `mounted`, `registerTrigger()` or `registerPortal()`. The state fields, such as `open` and `value`, stay.
- Select now closes when you press Tab right after the click that opened it. Before, focus left the list, but it stayed open.
- In Svelte, the server HTML of an enabled `Select.Trigger` leaves out `aria-disabled` until it mounts, as in the other frameworks.
- In Svelte, the `data-default-*` attributes of Select now come only from its `default*` props, and `false` flags such as `data-close-on-click` are left out, as in the other frameworks.
- In Vue, this component now needs Vue 3.5.21 or newer.
- Internal code cleanup, such as unused code and import order. This cleanup does not change behavior.
v1.3.0
- In Astro, an attribute that you set on a Select part now wins over the part's own default for the same attribute, such as `role` or `aria-label`.
- In Svelte, a defined `value` or `open` that you pass when Select mounts now stays under your control, as in React and Vue. To change it, use `bind:` or update your state in the change callback. A form reset keeps it. If you pass `undefined` at mount, Select keeps its own state.
- In Svelte, Select no longer exports `show`, `close`, or `updatePosition`. Use `bind:open` or `bind:value` instead.
- `Select.Value` with its own content and no `placeholder` now shows that content until a value is chosen, in Astro and Vue. Before, the trigger was blank. React already did this.
- In React, Select now shows the selected label when your own component renders the items. If your items load later, a value has no label until someone opens the list and picks an item.
- In React, a Select now keeps the label of the parent value after the parent refuses a pick.
- Pressing the trigger of an open Select in Safari now closes the list. Before, the list closed and opened again.
- In Svelte, `Select.Trigger` still needs a button in `child`. With another element it does nothing, and it now logs a console error in production as well as in development.
- In Vue, the template ref of the Select root no longer has the undocumented methods `open`, `close`, `updatePosition`, `getValue`, and `setValue`. It exposes only `element`. Use `v-model` on the root instead.
- In Vue, `Select.Trigger` with `asChild` accepts a component child.
- In React, Select and Combobox inside a `Field` with a `name` now send their value when the form submits, and they call `onValueChange`, `onOpenChange`, and `onInputValueChange`. Before, the form often left the value out, and the callbacks did not run.
- A `name` on a control now wins over the `name` on its `Field`, in all frameworks. If you set different names on a `Field` and its control, and your server reads the `Field` name, remove the `name` from the control.
v1.2.1
- A `required` Select now stops a plain HTML form from submitting when no option is selected. The browser shows its message next to the Select and puts focus on the trigger. Before, the empty form submitted.
- Give the Select root a CSS position, such as `position: relative`. Then the browser message shows at the trigger inside a scrolling container. The styled Select already does this.
- A Select without `required` still lets the Enter key submit the form as before.
- When a required Select is the first field with an error in a Starwind Form, submit and `validate({ focus: true })` now put focus on the trigger, and the page scrolls to it.
v1.2.0
- Select labels in Vue and Svelte now update when the selected option's text changes or its option loads after the value is set, whether the popup is open or closed.
- Vue Select keeps its previous selection and open state when a change is canceled.
- Reduced background work when a React page uses multiple menus, tooltips, or other portals.
- Added `asChild` to the Vue Select Trigger so you can use your own element as the trigger.
- React Select keeps its current selection when a reset is canceled and preserves newer values while a reset is pending. Keep it in the same form until that reset finishes.
- Fixed nested Svelte overlays inside a dialog appearing behind their parent or failing to receive clicks.
- Reduced background work when a Vue page uses multiple menus, tooltips, or other portals.
- Fixed nested overlays appearing behind their parent in Vue and Svelte. Overlays can now render under the document body; if custom CSS or DOM queries require them to stay inside a parent, set a portal container or add `data-floating-root` to that parent.
- Reduced the JavaScript loaded by Select when it is used without Field.
- Fixed React 18 retaining removed popup elements when the parent component stays mounted.
- Reduced repeated JavaScript when Astro Select is used with other Starwind components.
- Reduced JavaScript used by Svelte Select. Element props, event handlers, and refs keep the same behavior.
v1.1.1
- Removed old comments from the Vue Primitive files that said the code was internal and not for release. The CLI also removes the blank line that these comments left in the Vue Primitive `index.ts` files that it copies into your project.
- Group headings are now linked to their groups with `aria-labelledby`, so screen readers announce the name of each group.
v1.1.0
- Added `container` and `disabled` to the Portal part. `container` sets the element that holds the popup, and `disabled` keeps the popup in place. Portals now place nested popups in the same way every time, and they show their placement in data attributes.
- On mobile browsers, a tap on the Select trigger now closes an open Select list, and a tap on an option now selects it.
v1.0.0
- This Primitive is now stable at version `1.0.0`. Its API and behavior stay the same as in the previous release.
v0.1.4
- The React Primitive files that the CLI copies into your project are now marked with `"use client"`, so they stay client components in React server frameworks.
- In React, you can cancel a change from its change callback or DOM event before it applies. React then shows only the changes that apply.
- React Select now picks up a value that code sets without a change event. Because of this, the Color Picker format control shows its set format before anyone uses it.
- In React, the Select trigger inside the Color Picker format control now keeps the selected style.
v0.1.3
- In React, a Select item with an empty label now keeps that empty label. Its value is still sent with the form while the list is closed.
v0.1.2
- In React, a closed Select now does less work when it mounts. Its value and form value stay correct.
v0.1.1
- By default, the page behind the Select no longer scrolls while the list is open. The `modal` option controls this.
v0.1.0
- First release. Select handles selection and keyboard navigation. It places its list next to the trigger, fires events, and sends its value with the form.