"use client"
import { createListCollection } from "@chakra-ui/react"
import {
SelectContent,
SelectItem,
SelectLabel,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
const Demo = () => {
return (
<SelectRoot collection={frameworks} size="sm" width="320px">
<SelectLabel>Select framework</SelectLabel>
<SelectTrigger>
<SelectValueText placeholder="Select movie" />
</SelectTrigger>
<SelectContent>
{frameworks.items.map((movie) => (
<SelectItem item={movie} key={movie.value}>
{movie.label}
</SelectItem>
))}
</SelectContent>
</SelectRoot>
)
}
const frameworks = createListCollection({
items: [
{ label: "React.js", value: "react" },
{ label: "Vue.js", value: "vue" },
{ label: "Angular", value: "angular" },
{ label: "Svelte", value: "svelte" },
],
})
Setup
If you don't already have the snippet, run the following command to add the
select
snippet
npx @chakra-ui/cli snippet add select
The snippet includes a closed component composition for the Select
component.
Usage
import {
SelectContent,
SelectItem,
SelectLabel,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
<SelectRoot>
<SelectLabel />
<SelectTrigger>
<SelectValueText />
</SelectTrigger>
<SelectContent>
<SelectItem />
</SelectContent>
</SelectRoot>
Examples
Sizes
Use the size
prop to change the size of the select component.
"use client"
import { For, Stack, createListCollection } from "@chakra-ui/react"
import {
SelectContent,
SelectItem,
SelectLabel,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
const Demo = () => {
return (
<Stack gap="5" width="320px">
<For each={["xs", "sm", "md", "lg"]}>
{(size) => (
<SelectRoot key={size} size={size} collection={frameworks}>
<SelectLabel>size = {size}</SelectLabel>
<SelectTrigger>
<SelectValueText placeholder="Select movie" />
</SelectTrigger>
<SelectContent>
{frameworks.items.map((movie) => (
<SelectItem item={movie} key={movie.value}>
{movie.label}
</SelectItem>
))}
</SelectContent>
</SelectRoot>
)}
</For>
</Stack>
)
}
const frameworks = createListCollection({
items: [
{ label: "React.js", value: "react" },
{ label: "Vue.js", value: "vue" },
{ label: "Angular", value: "angular" },
{ label: "Svelte", value: "svelte" },
],
})
Variants
Use the variant
prop to change the appearance of the select component.
"use client"
import { For, Stack, createListCollection } from "@chakra-ui/react"
import {
SelectContent,
SelectItem,
SelectLabel,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
const Demo = () => {
return (
<Stack gap="5" width="320px">
<For each={["outline", "subtle"]}>
{(variant) => (
<SelectRoot key={variant} variant={variant} collection={frameworks}>
<SelectLabel>Select framework - {variant}</SelectLabel>
<SelectTrigger>
<SelectValueText placeholder="Select movie" />
</SelectTrigger>
<SelectContent>
{frameworks.items.map((movie) => (
<SelectItem item={movie} key={movie.value}>
{movie.label}
</SelectItem>
))}
</SelectContent>
</SelectRoot>
)}
</For>
</Stack>
)
}
const frameworks = createListCollection({
items: [
{ label: "React.js", value: "react" },
{ label: "Vue.js", value: "vue" },
{ label: "Angular", value: "angular" },
{ label: "Svelte", value: "svelte" },
],
})
Option Group
Use the SelectItemGroup
component to group select options.
"use client"
import { createListCollection } from "@chakra-ui/react"
import {
SelectContent,
SelectItem,
SelectItemGroup,
SelectLabel,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
const Demo = () => {
return (
<SelectRoot collection={frameworks} size="sm" width="320px">
<SelectLabel>Select framework</SelectLabel>
<SelectTrigger>
<SelectValueText placeholder="Select movie" />
</SelectTrigger>
<SelectContent>
{categories.map((category) => (
<SelectItemGroup key={category.group} label={category.group}>
{category.items.map((item) => (
<SelectItem item={item} key={item.value}>
{item.label}
</SelectItem>
))}
</SelectItemGroup>
))}
</SelectContent>
</SelectRoot>
)
}
const frameworks = createListCollection({
items: [
{ label: "Naruto", value: "naruto", group: "Anime" },
{ label: "One Piece", value: "one-piece", group: "Anime" },
{ label: "Dragon Ball", value: "dragon-ball", group: "Anime" },
{
label: "The Shawshank Redemption",
value: "the-shawshank-redemption",
group: "Movies",
},
{ label: "The Godfather", value: "the-godfather", group: "Movies" },
{ label: "The Dark Knight", value: "the-dark-knight", group: "Movies" },
],
})
const categories = frameworks.items.reduce(
(acc, item) => {
const group = acc.find((group) => group.group === item.group)
if (group) {
group.items.push(item)
} else {
acc.push({ group: item.group, items: [item] })
}
return acc
},
[] as { group: string; items: (typeof frameworks)["items"] }[],
)
Controlled
Use the value
and onValueChange
props to control the select component.
"use client"
import { createListCollection } from "@chakra-ui/react"
import {
SelectContent,
SelectItem,
SelectLabel,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
import { useState } from "react"
const Demo = () => {
const [value, setValue] = useState<string[]>([])
return (
<SelectRoot
collection={frameworks}
width="320px"
value={value}
onValueChange={(e) => setValue(e.value)}
>
<SelectLabel>Select framework</SelectLabel>
<SelectTrigger>
<SelectValueText placeholder="Select movie" />
</SelectTrigger>
<SelectContent>
{frameworks.items.map((movie) => (
<SelectItem item={movie} key={movie.value}>
{movie.label}
</SelectItem>
))}
</SelectContent>
</SelectRoot>
)
}
const frameworks = createListCollection({
items: [
{ label: "React.js", value: "react" },
{ label: "Vue.js", value: "vue" },
{ label: "Angular", value: "angular" },
{ label: "Svelte", value: "svelte" },
],
})
Async Loading
Here's an example of how to populate the select collection
from a remote
source.
"use client"
import { createListCollection } from "@chakra-ui/react"
import {
SelectContent,
SelectItem,
SelectLabel,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
import { useMemo } from "react"
import { useAsync } from "react-use"
interface Item {
name: string
url: string
}
const Demo = () => {
const state = useAsync(async (): Promise<Item[]> => {
const response = await fetch(`https://pokeapi.co/api/v2/pokemon`)
const data = await response.json()
return data.results
}, [])
const pokemons = useMemo(() => {
return createListCollection({
items: state.value || [],
itemToString: (item) => item.name,
itemToValue: (item) => item.name,
})
}, [state.value])
return (
<SelectRoot collection={pokemons} size="sm" width="320px">
<SelectLabel>Select pokemon</SelectLabel>
<SelectTrigger>
<SelectValueText placeholder="Pokemon" />
</SelectTrigger>
<SelectContent>
{pokemons.items.map((pokemon) => (
<SelectItem item={pokemon} key={pokemon.name}>
{pokemon.name}
</SelectItem>
))}
</SelectContent>
</SelectRoot>
)
}
Hook Form
Here's an example of how to use the Select
component with react-hook-form
.
"use client"
import { Button, Stack, createListCollection } from "@chakra-ui/react"
import { zodResolver } from "@hookform/resolvers/zod"
import { Field } from "@/components/ui/field"
import {
SelectContent,
SelectItem,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
import { Controller, useForm } from "react-hook-form"
import { z } from "zod"
const formSchema = z.object({
framework: z.string({ message: "Framework is required" }).array(),
})
type FormValues = z.infer<typeof formSchema>
const Demo = () => {
const {
handleSubmit,
formState: { errors },
control,
} = useForm<FormValues>({
resolver: zodResolver(formSchema),
})
const onSubmit = handleSubmit((data) => console.log(data))
return (
<form onSubmit={onSubmit}>
<Stack gap="4" align="flex-start">
<Field
label="Rating"
invalid={!!errors.framework}
errorText={errors.framework?.message}
width="320px"
>
<Controller
control={control}
name="framework"
render={({ field }) => (
<SelectRoot
name={field.name}
value={field.value}
onValueChange={({ value }) => field.onChange(value)}
onInteractOutside={() => field.onBlur()}
collection={frameworks}
>
<SelectTrigger>
<SelectValueText placeholder="Select movie" />
</SelectTrigger>
<SelectContent>
{frameworks.items.map((movie) => (
<SelectItem item={movie} key={movie.value}>
{movie.label}
</SelectItem>
))}
</SelectContent>
</SelectRoot>
)}
/>
</Field>
<Button size="sm" type="submit">
Submit
</Button>
</Stack>
</form>
)
}
const frameworks = createListCollection({
items: [
{ label: "React.js", value: "react" },
{ label: "Vue.js", value: "vue" },
{ label: "Angular", value: "angular" },
{ label: "Svelte", value: "svelte" },
],
})
Disabled
Use the disabled
prop to disable the select component.
"use client"
import { createListCollection } from "@chakra-ui/react"
import {
SelectContent,
SelectItem,
SelectLabel,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
const Demo = () => {
return (
<SelectRoot disabled collection={frameworks} size="sm" width="320px">
<SelectLabel>Select framework</SelectLabel>
<SelectTrigger>
<SelectValueText placeholder="Select movie" />
</SelectTrigger>
<SelectContent>
{frameworks.items.map((movie) => (
<SelectItem item={movie} key={movie.value}>
{movie.label}
</SelectItem>
))}
</SelectContent>
</SelectRoot>
)
}
const frameworks = createListCollection({
items: [
{ label: "React.js", value: "react" },
{ label: "Vue.js", value: "vue" },
{ label: "Angular", value: "angular" },
{ label: "Svelte", value: "svelte" },
],
})
Invalid
Here's an example of how to compose the Select
component with the Field
component to display an error state.
"use client"
import { createListCollection } from "@chakra-ui/react"
import { Field } from "@/components/ui/field"
import {
SelectContent,
SelectItem,
SelectLabel,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
const Demo = () => {
return (
<Field invalid errorText="This is an error">
<SelectRoot collection={frameworks} size="sm" width="320px">
<SelectLabel>Select framework</SelectLabel>
<SelectTrigger>
<SelectValueText placeholder="Select movie" />
</SelectTrigger>
<SelectContent>
{frameworks.items.map((movie) => (
<SelectItem item={movie} key={movie.value}>
{movie.label}
</SelectItem>
))}
</SelectContent>
</SelectRoot>
</Field>
)
}
const frameworks = createListCollection({
items: [
{ label: "React.js", value: "react" },
{ label: "Vue.js", value: "vue" },
{ label: "Angular", value: "angular" },
{ label: "Svelte", value: "svelte" },
],
})
Multiple
Use the multiple
prop to allow multiple selections.
"use client"
import { createListCollection } from "@chakra-ui/react"
import {
SelectContent,
SelectItem,
SelectLabel,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
const Demo = () => {
return (
<SelectRoot multiple collection={frameworks} size="sm" width="320px">
<SelectLabel>Select framework</SelectLabel>
<SelectTrigger>
<SelectValueText placeholder="Movie" />
</SelectTrigger>
<SelectContent>
{frameworks.items.map((movie) => (
<SelectItem item={movie} key={movie.value}>
{movie.label}
</SelectItem>
))}
</SelectContent>
</SelectRoot>
)
}
const frameworks = createListCollection({
items: [
{ label: "React.js", value: "react" },
{ label: "Vue.js", value: "vue" },
{ label: "Angular", value: "angular" },
{ label: "Svelte", value: "svelte" },
],
})
Positioning
Use the positioning
prop to control the underlying floating-ui
options of
the select component.
"use client"
import { createListCollection } from "@chakra-ui/react"
import {
SelectContent,
SelectItem,
SelectLabel,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
const Demo = () => {
return (
<SelectRoot
collection={frameworks}
size="sm"
width="320px"
positioning={{ placement: "top", flip: false }}
>
<SelectLabel>Select framework</SelectLabel>
<SelectTrigger>
<SelectValueText placeholder="Select movie" />
</SelectTrigger>
<SelectContent>
{frameworks.items.map((movie) => (
<SelectItem item={movie} key={movie.value}>
{movie.label}
</SelectItem>
))}
</SelectContent>
</SelectRoot>
)
}
const frameworks = createListCollection({
items: [
{ label: "React.js", value: "react" },
{ label: "Vue.js", value: "vue" },
{ label: "Angular", value: "angular" },
{ label: "Svelte", value: "svelte" },
],
})
Within Popover
Here's an example of how to use the Select
within a Popover
component.
"use client"
import { createListCollection } from "@chakra-ui/react"
import { Button } from "@/components/ui/button"
import {
PopoverBody,
PopoverContent,
PopoverHeader,
PopoverRoot,
PopoverTrigger,
} from "@/components/ui/popover"
import {
SelectContent,
SelectItem,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
const Demo = () => {
return (
<PopoverRoot size="xs">
<PopoverTrigger asChild>
<Button variant="outline" size="sm">
Select in Popover
</Button>
</PopoverTrigger>
<PopoverContent>
<PopoverHeader>Select in Popover</PopoverHeader>
<PopoverBody>
<SelectRoot
collection={frameworks}
size="sm"
positioning={{ sameWidth: true, placement: "bottom" }}
>
<SelectTrigger>
<SelectValueText placeholder="Select" />
</SelectTrigger>
<SelectContent portalled={false} width="full">
{frameworks.items.map((item) => (
<SelectItem item={item} key={item.value}>
{item.label}
</SelectItem>
))}
</SelectContent>
</SelectRoot>
</PopoverBody>
</PopoverContent>
</PopoverRoot>
)
}
const frameworks = createListCollection({
items: [
{ label: "React.js", value: "react" },
{ label: "Vue.js", value: "vue" },
{ label: "Angular", value: "angular" },
{ label: "Svelte", value: "svelte" },
],
})
Within Dialog
Here's an example of how to use the Select
within a Dialog
component.
"use client"
import { createListCollection } from "@chakra-ui/react"
import { Button } from "@/components/ui/button"
import {
DialogBackdrop,
DialogBody,
DialogCloseTrigger,
DialogContent,
DialogFooter,
DialogHeader,
DialogRoot,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog"
import {
SelectContent,
SelectItem,
SelectLabel,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
import { useRef } from "react"
const Demo = () => {
const contentRef = useRef<HTMLDivElement>(null)
return (
<DialogRoot>
<DialogBackdrop />
<DialogTrigger asChild>
<Button variant="outline">Open Dialog</Button>
</DialogTrigger>
<DialogContent ref={contentRef}>
<DialogCloseTrigger />
<DialogHeader>
<DialogTitle>Select in Dialog</DialogTitle>
</DialogHeader>
<DialogBody>
<SelectRoot collection={frameworks} size="sm">
<SelectLabel>Select framework</SelectLabel>
<SelectTrigger>
<SelectValueText placeholder="Select movie" />
</SelectTrigger>
<SelectContent portalRef={contentRef}>
{frameworks.items.map((item) => (
<SelectItem item={item} key={item.value}>
{item.label}
</SelectItem>
))}
</SelectContent>
</SelectRoot>
</DialogBody>
<DialogFooter />
</DialogContent>
</DialogRoot>
)
}
const frameworks = createListCollection({
items: [
{ label: "React.js", value: "react" },
{ label: "Vue.js", value: "vue" },
{ label: "Angular", value: "angular" },
{ label: "Svelte", value: "svelte" },
],
})
Avatar Select
Here's an example of how to compose the Select
and the Avatar
.
"use client"
import { HStack, createListCollection } from "@chakra-ui/react"
import { Avatar } from "@/components/ui/avatar"
import {
SelectContent,
SelectItem,
SelectLabel,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
const SelectValueItem = () => (
<SelectValueText placeholder="Select movie">
{(items: Array<{ name: string; avatar: string }>) => {
const { name, avatar } = items[0]
return (
<HStack>
<Avatar name={name} size="xs" src={avatar} />
{name}
</HStack>
)
}}
</SelectValueText>
)
const Demo = () => {
return (
<SelectRoot
collection={members}
size="sm"
width="240px"
defaultValue={["jessica_jones"]}
positioning={{ sameWidth: true }}
>
<SelectLabel>Select member</SelectLabel>
<SelectTrigger>
<SelectValueItem />
</SelectTrigger>
<SelectContent portalled={false}>
{members.items.map((item) => (
<SelectItem item={item} key={item.id} justifyContent="flex-start">
<Avatar name={item.name} src={item.avatar} size="xs" />
{item.name}
</SelectItem>
))}
</SelectContent>
</SelectRoot>
)
}
const members = createListCollection({
items: [
{
name: "Jessica Jones",
id: "jessica_jones",
avatar:
"https://images.unsplash.com/photo-1531746020798-e6953c6e8e04?w=100",
},
{
name: "Kenneth Johnson",
id: "kenneth_johnson",
avatar:
"https://images.unsplash.com/photo-1523477800337-966dbabe060b?w=100",
},
{
name: "Kate Wilson",
id: "kate_wilson",
avatar:
"https://images.unsplash.com/photo-1609712409631-dbbb050746d1?w=100",
},
],
itemToString: (item) => item.name,
itemToValue: (item) => item.id,
})
Clear Trigger
Pass the clearable
prop to the SelectTrigger
.
"use client"
import { createListCollection } from "@chakra-ui/react"
import {
SelectContent,
SelectItem,
SelectLabel,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
const Demo = () => {
return (
<SelectRoot
collection={animeMovies}
defaultValue={["spirited_away"]}
size="sm"
width="320px"
>
<SelectLabel>Select fav. anime</SelectLabel>
<SelectTrigger clearable>
<SelectValueText placeholder="Select movie" />
</SelectTrigger>
<SelectContent>
{animeMovies.items.map((movie) => (
<SelectItem item={movie} key={movie.value}>
{movie.label}
</SelectItem>
))}
</SelectContent>
</SelectRoot>
)
}
const animeMovies = createListCollection({
items: [
{ label: "Spirited Away", value: "spirited_away" },
{ label: "My Neighbor Totoro", value: "my_neighbor_totoro" },
{ label: "Akira", value: "akira" },
{ label: "Princess Mononoke", value: "princess_mononoke" },
{ label: "Grave of the Fireflies", value: "grave_of_the_fireflies" },
{ label: "Howl's Moving Castle", value: "howls_moving_castle" },
{ label: "Ghost in the Shell", value: "ghost_in_the_shell" },
{ label: "Naruto", value: "naruto" },
{ label: "Hunter x Hunter", value: "hunter_x_hunter" },
{ label: "The Wind Rises", value: "the_wind_rises" },
{ label: "Kiki's Delivery Service", value: "kikis_delivery_service" },
{ label: "Perfect Blue", value: "perfect_blue" },
{
label: "The Girl Who Leapt Through Time",
value: "the_girl_who_leapt_through_time",
},
{ label: "Weathering with You", value: "weathering_with_you" },
{ label: "Ponyo", value: "ponyo" },
{ label: "5 Centimeters per Second", value: "5_centimeters_per_second" },
{ label: "A Silent Voice", value: "a_silent_voice" },
{ label: "Paprika", value: "paprika" },
{ label: "Wolf Children", value: "wolf_children" },
{ label: "Redline", value: "redline" },
{
label: "The Tale of the Princess Kaguya",
value: "the_tale_of_the_princess_kaguya",
},
],
})
Overflow
"use client"
import { createListCollection } from "@chakra-ui/react"
import {
SelectContent,
SelectItem,
SelectLabel,
SelectRoot,
SelectTrigger,
SelectValueText,
} from "@/components/ui/select"
const Demo = () => {
return (
<SelectRoot collection={animeMovies} size="sm" width="240px">
<SelectLabel>Select anime</SelectLabel>
<SelectTrigger>
<SelectValueText placeholder="Select movie" />
</SelectTrigger>
<SelectContent>
{animeMovies.items.map((movie) => (
<SelectItem item={movie} key={movie.value}>
{movie.label}
</SelectItem>
))}
</SelectContent>
</SelectRoot>
)
}
const animeMovies = createListCollection({
items: [
{ label: "Spirited Away", value: "spirited_away" },
{ label: "My Neighbor Totoro", value: "my_neighbor_totoro" },
{ label: "Akira", value: "akira" },
{ label: "Princess Mononoke", value: "princess_mononoke" },
{ label: "Grave of the Fireflies", value: "grave_of_the_fireflies" },
{ label: "Howl's Moving Castle", value: "howls_moving_castle" },
{ label: "Ghost in the Shell", value: "ghost_in_the_shell" },
{ label: "Naruto", value: "naruto" },
{ label: "Hunter x Hunter", value: "hunter_x_hunter" },
{ label: "The Wind Rises", value: "the_wind_rises" },
{ label: "Kiki's Delivery Service", value: "kikis_delivery_service" },
{ label: "Perfect Blue", value: "perfect_blue" },
{
label: "The Girl Who Leapt Through Time",
value: "the_girl_who_leapt_through_time",
},
{ label: "Weathering with You", value: "weathering_with_you" },
{ label: "Ponyo", value: "ponyo" },
{ label: "5 Centimeters per Second", value: "5_centimeters_per_second" },
{ label: "A Silent Voice", value: "a_silent_voice" },
{ label: "Paprika", value: "paprika" },
{ label: "Wolf Children", value: "wolf_children" },
{ label: "Redline", value: "redline" },
{
label: "The Tale of the Princess Kaguya",
value: "the_tale_of_the_princess_kaguya",
},
],
})
Props
Root
Prop | Default | Type |
---|---|---|
items * | T[] | readonly T[] The options of the select | |
closeOnSelect | true | boolean Whether the select should close after an item is selected |
composite | true | boolean Whether the select is a composed with other composite widgets like tabs or combobox |
lazyMount | false | boolean Whether to enable lazy mounting |
loopFocus | false | boolean Whether to loop the keyboard navigation through the options |
unmountOnExit | false | boolean Whether to unmount on exit. |
colorPalette | 'gray' | 'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink' | 'accent' The color palette of the component |
variant | 'outline' | 'outline' | 'filled' The variant of the component |
size | 'md' | 'xs' | 'sm' | 'md' | 'lg' The size of the component |
asChild | boolean Use the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. | |
defaultOpen | boolean The initial open state of the select when it is first rendered. Use when you do not need to control its open state. | |
defaultValue | string[] The initial value of the select when it is first rendered. Use when you do not need to control the state of the select. | |
disabled | boolean Whether the select is disabled | |
form | string The associate form of the underlying select. | |
highlightedValue | string The key of the highlighted item | |
id | string The unique identifier of the machine. | |
ids | Partial<{
root: string
content: string
control: string
trigger: string
clearTrigger: string
label: string
hiddenSelect: string
positioner: string
item(id: string | number): string
itemGroup(id: string | number): string
itemGroupLabel(id: string | number): string
}> The ids of the elements in the select. Useful for composition. | |
immediate | boolean Whether to synchronize the present change immediately or defer it to the next frame | |
invalid | boolean Whether the select is invalid | |
isItemDisabled | (item: T) => boolean Whether the item is disabled | |
itemToString | (item: T) => string The label of the item | |
itemToValue | (item: T) => string The value of the item | |
multiple | boolean Whether to allow multiple selection | |
name | string The `name` attribute of the underlying select. | |
onExitComplete | () => void Function called when the animation ends in the closed state | |
onFocusOutside | (event: FocusOutsideEvent) => void Function called when the focus is moved outside the component | |
onHighlightChange | (details: HighlightChangeDetails<T>) => void The callback fired when the highlighted item changes. | |
onInteractOutside | (event: InteractOutsideEvent) => void Function called when an interaction happens outside the component | |
onOpenChange | (details: OpenChangeDetails) => void Function called when the popup is opened | |
onPointerDownOutside | (event: PointerDownOutsideEvent) => void Function called when the pointer is pressed down outside the component | |
onValueChange | (details: ValueChangeDetails<T>) => void The callback fired when the selected item changes. | |
open | boolean Whether the select menu is open | |
positioning | PositioningOptions The positioning options of the menu. | |
present | boolean Whether the node is present (controlled by the user) | |
readOnly | boolean Whether the select is read-only | |
required | boolean Whether the select is required | |
scrollToIndexFn | (details: ScrollToIndexDetails) => void Function to scroll to a specific index | |
value | string[] The keys of the selected items | |
as | React.ElementType The underlying element to render. | |
unstyled | boolean Whether to remove the component's style. |