@hacline/ui/selectSelect
Dropdown selector built on @ui-sdk/react/select supporting data-driven items, groups, search filtering, multi-select with Select All/Clear, async states, and adaptive popovers.
Import
import {
Select,
SelectArrow,
SelectClear,
SelectContent,
SelectEmpty,
SelectGroup,
SelectGroupLabel,
SelectInput,
SelectItem,
SelectItemIcon,
SelectItemIndicator,
SelectItems,
SelectItemText,
SelectLabel,
SelectList,
SelectSelectAll,
SelectSeparator,
SelectStatus,
SelectTrigger,
SelectValue,
SelectValueIcon,
} from "@/components/ui/hacline/components/select";Basic Usage
Group options semantically with SelectGroup, SelectGroupLabel, and SelectSeparator.
<Select defaultValue="cn-east">
<SelectLabel>Deployment Region</SelectLabel>
<SelectTrigger>
<SelectValue placeholder="Select a region" />
</SelectTrigger>
<SelectContent>
<SelectGroup>
<SelectGroupLabel>Asia Pacific</SelectGroupLabel>
<SelectItem value="cn-east">
<SelectItemText>China East (Shanghai)</SelectItemText>
<SelectItemIndicator />
</SelectItem>
<SelectItem value="jp-tokyo">
<SelectItemText>Japan (Tokyo)</SelectItemText>
<SelectItemIndicator />
</SelectItem>
</SelectGroup>
<SelectSeparator />
<SelectGroup>
<SelectGroupLabel>North America</SelectGroupLabel>
<SelectItem value="us-west">
<SelectItemText>US West (Silicon Valley)</SelectItemText>
<SelectItemIndicator />
</SelectItem>
</SelectGroup>
</SelectContent>
</Select>Sizes
Supports sm, md (default), and lg height scales aligned cleanly with Input and Button.
<Select defaultValue="sm">
<SelectTrigger size="sm">
<SelectValue />
</SelectTrigger>
<SelectContent>...</SelectContent>
</Select>
<Select defaultValue="md">
<SelectTrigger size="md">
<SelectValue />
</SelectTrigger>
<SelectContent>...</SelectContent>
</Select>
<Select defaultValue="lg">
<SelectTrigger size="lg">
<SelectValue />
</SelectTrigger>
<SelectContent>...</SelectContent>
</Select>Data-Driven
Pass structured items (with groups, separators, and disabled flags) directly to Select and leave SelectContent empty to render styled SelectItems automatically, complete with closed-state label reflection and typeahead search.
import {
Select,
SelectContent,
SelectLabel,
SelectTrigger,
SelectValue,
} from "@/components/ui/hacline/components/select";
import type { ListData } from "@/components/ui/hacline/components/select";
const items: ListData<string> = [
{
type: "group",
label: "Domestic Regions",
items: [
{ value: "cn-east", label: "China East (Shanghai)" },
{ value: "cn-north", label: "China North (Beijing)" },
{ value: "cn-south", label: "China South (Maintenance)", disabled: true },
],
},
{ type: "separator" },
{
type: "group",
label: "Global Regions",
items: [
{ value: "jp-tokyo", label: "Japan (Tokyo)" },
{ value: "us-west", label: "US West (Silicon Valley)" },
],
},
];
export function RegionDataSelect() {
return (
<Select defaultValue="cn-east" items={items}>
<SelectLabel>Cluster Node</SelectLabel>
<SelectTrigger>
<SelectValue placeholder="Select a node" />
</SelectTrigger>
<SelectContent />
</Select>
);
}Items with Icons
Place icons inside options via SelectItemIcon and mirror the selected icon onto the trigger with SelectValueIcon.
import { MonitorIcon, MoonIcon, SunIcon } from "lucide-react";
<Select defaultValue="system">
<SelectLabel>Appearance</SelectLabel>
<SelectTrigger>
<span className="flex min-w-0 items-center gap-2">
<SelectValueIcon />
<SelectValue placeholder="Choose theme" />
</span>
</SelectTrigger>
<SelectContent>
<SelectItem value="light">
<span className="flex min-w-0 items-center gap-2">
<SelectItemIcon>
<SunIcon aria-hidden="true" />
</SelectItemIcon>
<SelectItemText>Light Mode</SelectItemText>
</span>
<SelectItemIndicator />
</SelectItem>
<SelectItem value="dark">
<span className="flex min-w-0 items-center gap-2">
<SelectItemIcon>
<MoonIcon aria-hidden="true" />
</SelectItemIcon>
<SelectItemText>Dark Mode</SelectItemText>
</span>
<SelectItemIndicator />
</SelectItem>
<SelectItem value="system">
<span className="flex min-w-0 items-center gap-2">
<SelectItemIcon>
<MonitorIcon aria-hidden="true" />
</SelectItemIcon>
<SelectItemText>System</SelectItemText>
</span>
<SelectItemIndicator />
</SelectItem>
</SelectContent>
</Select>;Multiple Selection, Select All & Clear
Enable multiple to select multiple options at once, pair with SelectSelectAll to toggle all items, summarize overflow badges with maxLabels and getMoreLabel on SelectValue, and reset quickly with SelectClear.
<Select defaultValue={["email", "webhook"]} multiple>
<SelectLabel>Alert Channels</SelectLabel>
<div className="flex items-center gap-1.5">
<SelectTrigger>
<SelectValue
getMoreLabel={(count) => `+${count} more`}
maxLabels={2}
placeholder="Select channels"
/>
</SelectTrigger>
<SelectClear aria-label="Clear alert channels" />
</div>
<SelectContent>
<SelectSelectAll>Select All</SelectSelectAll>
<SelectSeparator />
<SelectItem value="email">
<SelectItemText>Email</SelectItemText>
<SelectItemIndicator />
</SelectItem>
<SelectItem value="sms">
<SelectItemText>SMS</SelectItemText>
<SelectItemIndicator />
</SelectItem>
<SelectItem value="webhook">
<SelectItemText>Webhook</SelectItemText>
<SelectItemIndicator />
</SelectItem>
<SelectItem value="lark">
<SelectItemText>Lark Bot</SelectItemText>
<SelectItemIndicator />
</SelectItem>
</SelectContent>
</Select>Search Filtering & Status
Combine SelectInput, SelectStatus, SelectList, and SelectEmpty inside SelectContent for built-in query matching, <mark> highlights, and an empty state.
<Select items={frameworkItems}>
<SelectLabel>Frontend Framework</SelectLabel>
<SelectTrigger>
<SelectValue placeholder="Search frameworks" />
</SelectTrigger>
<SelectContent>
<SelectInput
aria-label="Search frontend frameworks"
placeholder="Filter by keyword..."
/>
<SelectStatus>{(state) => `${state.count} options found`}</SelectStatus>
<SelectList />
<SelectEmpty>No matching framework</SelectEmpty>
</SelectContent>
</Select>Read-Only & Disabled
<Select defaultValue="prod" readOnly>
<SelectLabel>Environment (Read-Only)</SelectLabel>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>...</SelectContent>
</Select>
<Select defaultValue="pro" disabled>
<SelectLabel>Plan Tier (Disabled)</SelectLabel>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>...</SelectContent>
</Select>Props
Select
Prop
Type
SelectTrigger
Prop
Type
SelectValue
Prop
Type
SelectContent
Prop
Type