Select
Migration guide for Select from HeroUI v2 to v3
Refer to the v3 Select documentation for complete API reference, styling guide, and advanced examples. This guide only focuses on migrating from HeroUI v2.
Structure Changes
In v2, Select used a simple structure with props:
import { Select, SelectItem } from "@heroui/react";
export default function App() {
return (
<Select label="Select animal" placeholder="Choose one">
<SelectItem key="cat">Cat</SelectItem>
<SelectItem key="dog">Dog</SelectItem>
</Select>
);
}In v3, Select requires compound components and uses ListBox for items:
import { Select, Label, ListBox } from "@heroui/react";
export default function App() {
return (
<Select placeholder="Choose one">
<Label>Select animal</Label>
<Select.Trigger>
<Select.Value />
<Select.Indicator />
</Select.Trigger>
<Select.Popover>
<ListBox>
<ListBox.Item id="cat" textValue="Cat">
Cat
<ListBox.ItemIndicator />
</ListBox.Item>
<ListBox.Item id="dog" textValue="Dog">
Dog
<ListBox.ItemIndicator />
</ListBox.Item>
</ListBox>
</Select.Popover>
</Select>
);
}Key Changes
1. Component Structure
v2: Simple Select with SelectItem children
v3: Compound components (Select.Trigger, Select.Value, Select.ClearButton, Select.Indicator, Select.Popover) with ListBox for items
2. Item Components
v2: SelectItem, SelectSection
v3: ListBox.Item, ListBox.Section (with Header for section titles and Separator between sections)