Combobox
The combobox primitives coordinate an input, popup and registered option labels.
Practical React example
Find and select a known project from a longer searchable list.
Before you copy and paste
Keep the example in the React rendering environment required by the imported component. Copy components/motion/combobox.tsx and its returned support files from the Code tab; preserve the project-relative paths.
Listed package dependencies: clsx, lucide-react, motion, react, react-dom, tailwind-merge.
Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.
Find and select a known project from a longer searchable list
// Usage adapted from beUI's pinned MIT source.
// Copyright (c) 2026 Saurabh Chauhan. See ./LICENSES.md.
"use client";
import { Blocks, Box, Component, Layers3 } from "lucide-react";
import { useState } from "react";
import {
Combobox,
ComboboxContent,
ComboboxEmpty,
ComboboxGroup,
ComboboxInput,
ComboboxItem,
ComboboxLabel,
ComboboxList,
ComboboxSeparator,
ComboboxTrigger,
} from "@/components/motion/combobox";
const WORKSPACES = [
{
value: "studio",
label: "Design studio",
detail: "12 projects",
group: "Recent",
icon: Component,
color: "bg-amber-400/20 text-amber-700 dark:text-amber-300",
},
{
value: "product",
label: "Product team",
detail: "8 projects",
group: "Recent",
icon: Layers3,
color: "bg-sky-400/20 text-sky-700 dark:text-sky-300",
},
{
value: "playground",
label: "Playground",
detail: "24 experiments",
group: "Workspaces",
icon: Blocks,
color: "bg-emerald-400/20 text-emerald-700 dark:text-emerald-300",
},
{
value: "archive",
label: "Component archive",
detail: "41 components",
group: "Workspaces",
icon: Box,
color: "bg-rose-400/20 text-rose-700 dark:text-rose-300",
},
] as const;
function WorkspaceMark({ value }: { value: string }) {
const workspace = WORKSPACES.find((item) => item.value === value);
if (!workspace) return null;
const Icon = workspace.icon;
return (
<span
className={`grid size-7 shrink-0 place-items-center rounded-lg ${workspace.color}`}
>
<Icon className="size-3.5" />
</span>
);
}
export function ComboboxPreview() {
const [value, setValue] = useState("studio");
return (
<div className="w-full max-w-72">
<p className="mb-2 text-xs font-medium text-muted-foreground">
Workspace
</p>
<Combobox value={value} onValueChange={setValue}>
<ComboboxTrigger className="h-12 rounded-2xl px-2.5">
<ComboboxInput
aria-label="Search workspaces"
placeholder="Search workspaces…"
/>
</ComboboxTrigger>
<ComboboxContent className="w-72 rounded-2xl">
<ComboboxList ariaLabel="Workspaces" className="p-2">
<ComboboxEmpty>No workspaces found.</ComboboxEmpty>
{(["Recent", "Workspaces"] as const).map((group, groupIndex) => (
<ComboboxGroup key={group}>
{groupIndex > 0 ? <ComboboxSeparator /> : null}
<ComboboxLabel>{group}</ComboboxLabel>
{WORKSPACES.filter((item) => item.group === group).map(
(workspace) => (
<ComboboxItem
key={workspace.value}
value={workspace.value}
textValue={workspace.label}
keywords={[workspace.detail, workspace.group]}
className="py-2"
>
<span className="flex min-w-0 items-center gap-2.5">
<WorkspaceMark value={workspace.value} />
<span className="min-w-0">
<span className="block truncate font-medium text-foreground">
{workspace.label}
</span>
<span className="block truncate text-xs text-muted-foreground">
{workspace.detail}
</span>
</span>
</span>
</ComboboxItem>
),
)}
</ComboboxGroup>
))}
</ComboboxList>
</ComboboxContent>
</Combobox>
</div>
);
}
Usage example adapted from beUI's pinned MIT source. Retain the source licence notices when copying.
Compose the input inside its trigger and the items inside the list. Keep selected IDs stable when the query filters the options, and model remote loading in the parent.
Customization
- ComboboxContentProps.children
- Required; ReactNode.
- ComboboxContentProps.side
- Optional; Side.
- ComboboxContentProps.align
- Optional; Align.
- ComboboxContentProps.sideOffset
- Optional; number.
- ComboboxContentProps.avoidCollisions
- Optional; boolean.
- ComboboxContentProps.className
- Optional; string.
- ComboboxProps.children
- Required; ReactNode.
- ComboboxProps.value
- Optional; string.
- ComboboxProps.defaultValue
- Optional; string.
- ComboboxProps.onValueChange
- Optional; (value: string) => void.
- ComboboxProps.open
- Optional; boolean.
- ComboboxProps.defaultOpen
- Optional; boolean.
- ComboboxProps.onOpenChange
- Optional; (open: boolean) => void.
- ComboboxProps.query
- Optional; string.
Integration notes
- A selected option must still be valid and authorized when it is submitted.
- Test empty results and keyboard selection when the result set changes during typing.
Component source: beUI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.
Give your agent taste.
The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.
All components are free. Sign up only to connect MCP.