BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/trovecn/combobox

Combobox

trovecn/combobox
FreeComponent

Base UI combobox — a text input filtered against a list as you type.

Install it

npx shadcn@latest add https://trovecn.dev/r/combobox.json

Source

src/components/ui/combobox.tsxtrovecn.dev/r/combobox.json · first 6 KB
1"use client";
2
3import {
4 createContext,
5 useCallback,
6 useContext,
7 useEffect,
8 useMemo,
9 useRef,
10 useState,
11 type ReactNode,
12} from "react";
13import { Combobox as ComboboxPrimitive } from "@base-ui/react/combobox";
14import { motion, AnimatePresence, useReducedMotion } from "motion/react";
15import { CheckIcon, ChevronDownIcon, SearchIcon, XIcon } from "lucide-react";
16
17import { cn } from "@/lib/utils";
18import { spring } from "@/lib/springs";
19import {
20 useProximityHover,
21 proximityHoverWashClassName,
22 proximityHoverWashOpacity,
23} from "@/hooks/use-proximity-hover";
24
25interface ComboboxProximityContextValue {
26 registerItem: (index: number, element: HTMLElement | null) => void;
27}
28
29const ComboboxProximityContext = createContext<ComboboxProximityContextValue | null>(null);
30
31function Combobox<Value, Multiple extends boolean | undefined = false>({
32 ...props
33}: ComboboxPrimitive.Root.Props<Value, Multiple>) {
34 return <ComboboxPrimitive.Root data-slot="combobox" {...props} />;
35}
36
37function ComboboxInputGroup({ className, ...props }: ComboboxPrimitive.InputGroup.Props) {
38 return (
39 <ComboboxPrimitive.InputGroup
40 data-slot="combobox-input-group"
41 className={cn(
42 "flex h-8 w-full min-w-0 items-center gap-1.5 rounded-lg border border-input bg-transparent pr-1.5 pl-2.5 transition-colors outline-none focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50 has-data-disabled:pointer-events-none has-data-disabled:opacity-50 dark:bg-input/30",
43 className,
44 )}
45 {...props}
46 />
47 );
48}
49
50function ComboboxInput({ className, ...props }: ComboboxPrimitive.Input.Props) {
51 return (
52 <ComboboxPrimitive.Input
53 data-slot="combobox-input"
54 className={cn(
55 "h-full min-w-0 flex-1 bg-transparent text-body text-foreground outline-none placeholder:text-muted-foreground",
56 className,
57 )}
58 {...props}
59 />
60 );
61}
62
63function ComboboxSearchIcon({ className, ...props }: React.ComponentProps<"span">) {
64 return (
65 <span
66 data-slot="combobox-search-icon"
67 aria-hidden
68 className={cn("flex shrink-0 items-center justify-center text-muted-foreground", className)}
69 {...props}
70 >
71 <SearchIcon className="size-4" />
72 </span>
73 );
74}
75
76function ComboboxIcon({ className, ...props }: ComboboxPrimitive.Icon.Props) {
77 return (
78 <ComboboxPrimitive.Icon
79 data-slot="combobox-icon"
80 className={cn("shrink-0 text-muted-foreground", className)}
81 {...props}
82 >
83// … truncated

What it pulls in

npm packages

  • @base-ui/react
  • motion
  • lucide-react

Other registry items

  • utils
  • springs
  • use-proximity-hover

Files it writes

  • src/components/ui/combobox.tsx

Facts

Registry
trovecn
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-14
Last confirmed
today

Go to the source

trovecn.dev PPRAMANIK62/trovecn on GitHub Raw registry item This item as JSON

More from trovecn

All 26 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordiontrovecnComponentsFree3 deps
Agent Activityagent-activitytrovecnComponentsFree2 deps
Approval Requestapproval-requesttrovecnComponentsFree2 deps
ButtonbuttontrovecnComponentsFree2 deps
CheckboxcheckboxtrovecnComponentsFree2 deps
Checkbox Groupcheckbox-grouptrovecnComponentsFree2 deps
Comparison Slidercomparison-slidertrovecnComponentsFree1 dep
Context Menucontext-menutrovecnComponentsFree3 deps

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex