Select

A React select component on Base UI with grouped options, descriptions, icons, four trigger styles, keyboard navigation, and native form submission.

Loading preview

Examples

Practical examples and common states for the same installable component.

Filled

A softer trigger for dense settings panels.

examples/select-filled.tsx
import {
IconBolt,
IconBuildingSkyscraper,
IconRocket,
} from "@tabler/icons-react";
import { Select } from "@/components/wensity/select";
export function SelectFilled() {
return (
<Select
variant="filled"
label="Plan"
defaultValue="team"
options={[
{
value: "free",
label: "Free",
description: "Prototype with public examples.",
leading: <IconRocket stroke={1.75} />,
},
{
value: "pro",
label: "Pro",
description: "Use source files in production.",
leading: <IconBolt stroke={1.75} />,
},
{
value: "team",
label: "Team",
description: "Seats, shared billing, and API tokens.",
leading: <IconBuildingSkyscraper stroke={1.75} />,
},
]}
/>
);
}

Pill

Compact select triggers for filters and toolbars.

examples/select-pill.tsx
import { IconChartBar, IconFilter } from "@tabler/icons-react";
import { Select } from "@/components/wensity/select";
export function SelectPill() {
return (
<div className="flex flex-wrap items-center gap-2">
<Select
variant="pill"
fullWidth={false}
defaultValue="all"
leadingIcon={<IconFilter stroke={1.75} />}
options={[
{ value: "all", label: "All components" },
{ value: "free", label: "Free" },
{ value: "pro", label: "Pro" },
]}
/>
<Select
variant="pill"
fullWidth={false}
defaultValue="popular"
leadingIcon={<IconChartBar stroke={1.75} />}
options={[
{ value: "popular", label: "Popular" },
{ value: "newest", label: "Newest" },
{ value: "updated", label: "Updated" },
]}
/>
</div>
);
}

Grouped

Grouped options with disabled choices and descriptions.

examples/select-grouped.tsx
import {
IconCreditCard,
IconShieldLock,
IconUser,
IconUsers,
} from "@tabler/icons-react";
import { Select } from "@/components/wensity/select";
export function SelectGrouped() {
return (
<Select
label="Role"
defaultValue="developer"
options={[
{
label: "Workspace",
options: [
{
value: "owner",
label: "Owner",
description: "Full access to billing, members, and tokens.",
leading: <IconShieldLock stroke={1.75} />,
},
{
value: "admin",
label: "Admin",
description: "Manage members and publish components.",
leading: <IconUsers stroke={1.75} />,
},
],
},
{
label: "Limited",
options: [
{
value: "developer",
label: "Developer",
description: "Create tokens and download source files.",
leading: <IconUser stroke={1.75} />,
},
{
value: "billing",
label: "Billing only",
description: "View invoices and payment methods.",
leading: <IconCreditCard stroke={1.75} />,
disabled: true,
},
],
},
]}
/>
);
}

Controlled

Controlled value for settings that mirror app state.

examples/select-controlled.tsx
"use client";
import * as React from "react";
import { Select } from "@/components/wensity/select";
export function SelectControlled() {
const [value, setValue] = React.useState("weekly");
return (
<Select
value={value}
onValueChange={setValue}
variant="filled"
label="Email frequency"
options={[
{ value: "instant", label: "Instant" },
{ value: "daily", label: "Daily" },
{ value: "weekly", label: "Weekly" },
{ value: "never", label: "Never" },
]}
/>
);
}

Error

Validation state for required select fields.

examples/select-error.tsx
import { Select } from "@/components/wensity/select";
export function SelectError() {
return (
<Select
label="Workspace role"
placeholder="Choose a role"
error="Select a role before sending the invite."
options={[
{ value: "owner", label: "Owner" },
{ value: "admin", label: "Admin" },
{ value: "developer", label: "Developer" },
]}
/>
);
}

Disabled

Disabled triggers and disabled options remain readable.

examples/select-disabled.tsx
import { IconLock } from "@tabler/icons-react";
import { Select } from "@/components/wensity/select";
export function SelectDisabled() {
return (
<div className="space-y-4">
<Select
label="Security policy"
defaultValue="strict"
disabled
leadingIcon={<IconLock stroke={1.75} />}
options={[
{ value: "standard", label: "Standard" },
{ value: "strict", label: "Strict" },
]}
/>
<Select
label="Billing contact"
defaultValue="primary"
options={[
{ value: "primary", label: "Primary card" },
{ value: "invoice", label: "Invoice", disabled: true },
]}
/>
</div>
);
}

Overview

Select is a React and Tailwind CSS select component on Base UI, in Next.js or any React app, that replaces the native dropdown with a styled listbox. Pass options as a flat array or in labeled groups, and each option can carry a description, a leading icon, trailing text, or a disabled flag. Field, filled, command, and pill variants fit forms, toolbars, and filters. Arrow keys and a check on the chosen item come from Base UI, and name plus required let it submit with a form. onValueChange never fires with null, so clear a value through your own state.

Installation

Run the following command

~/your-project
pnpm dlx wensity@latest add select

Usage

Import Select from @/components/wensity/select and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.

app/example.tsx
import { Select } from "@/components/wensity/select";
export function SelectDemo() {
return (
<Select
label="Region"
placeholder="Choose region"
defaultValue="fra"
options={[
{ value: "iad", label: "US East" },
{ value: "fra", label: "Europe" },
{ value: "sin", label: "Asia Pacific" },
]}
/>
);
}

Props

PropTypeDefaultDescription
optionsSelectOption[] | SelectGroup[]-Choices to render. Pass groups to get labelled sections.
valuestring | null-Controlled selected value.
defaultValuestring | null-Initial value when the select is uncontrolled.
onValueChange(value: string) => void-Called when the selection changes.
openboolean-Controlled open state of the listbox.
onOpenChange(open: boolean) => void-Called when the listbox opens or closes.
labelReact.ReactNode-Field label above the trigger.
hintReact.ReactNode-Helper copy under the trigger. Hidden while error is set.
errorReact.ReactNode-Error message under the trigger, with invalid styling applied.
placeholderReact.ReactNode"Select option"Shown in the trigger while nothing is selected.
selectSize"sm" | "md" | "lg""md"Trigger height and text size.
variant"field" | "filled" | "command" | "pill""field"Trigger treatment. command matches palette-style UI; pill is fully rounded.
fullWidthbooleantrueStretches the trigger to fill its container.
leadingIconReact.ReactNode-Icon inside the trigger, before the value.
disabledboolean-Disables the trigger and prevents opening.
  • AI Model Selector component preview

    AI Model Selector

    An AI model selector dropdown that scales out from its trigger and glides the selection pill to whichever model you pick.

  • Gooey Dropdown Menu component preview

    Gooey Dropdown Menu

    A capsule trigger drips a menu out of its underside. Arrow keys, live shortcuts, and a clear Delete row come built in.

  • Multi-Select Tag Input component preview

    Multi-Select Tag Input

    A tag input where pills pop in as you add them and slide out on remove, closing the gap without snapping the layout.

  • Gooey Search Bar component preview

    Gooey Search Bar

    A search circle stretches into a field, and results drip out below it. Ask Claude, ChatGPT, or Google in one keystroke.