BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/flowkit-ui/creatable-combobox

Creatable Combobox

flowkit-ui/creatable-combobox
FreeComponent

Combobox with creatable items, built on Base UI and shadcn-style primitives (combobox, input group, button).

Live preview

live · rendered by the registry
Rendered by flowkit-ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://flowkit-ui.vzkiss.com/r/creatable-combobox.json

Source

src/flowkit/creatable-combobox/creatable-combobox.tsxflowkit-ui.vzkiss.com/r/creatable-combobox.json · first 6 KB
1"use client";
2
3import * as React from "react";
4import {
5 Combobox as ComboboxPrimitive,
6 ComboboxRootChangeEventDetails,
7} from "@base-ui/react";
8
9import { cn } from "@/lib/utils";
10import { Combobox } from "@/components/ui/combobox";
11import { Plus } from "lucide-react";
12
13// ─── Creatable ────────────────────────────────────────────────────────
14
15type CreatableItem = {
16 creatable: true; // literal true, not boolean
17 label: string;
18 value: string;
19};
20
21const isCreatableItem = (item: unknown): item is CreatableItem => {
22 return (
23 typeof item === "object" &&
24 item !== null &&
25 (item as CreatableItem).creatable === true
26 );
27};
28// ─── Internal helpers ─────────────────────────────────────────────────────────
29
30/** Display string for an item — mirrors base-ui's own default logic. */
31const toLabel = (item: unknown): string => {
32 if (typeof item === "string") return item;
33 if (item && typeof item === "object") {
34 if ("label" in item) return String((item as { label: unknown }).label);
35 if ("value" in item) return String((item as { value: unknown }).value);
36 }
37 return String(item);
38};
39
40/** Equality key for an item — prefers .value for stable identity. */
41const toValueKey = (item: unknown): string => {
42 if (typeof item === "string") return item;
43 if (item && typeof item === "object") {
44 if ("value" in item) return String((item as { value: unknown }).value);
45 if ("label" in item) return String((item as { label: unknown }).label);
46 }
47 return String(item);
48};
49
50// ─── CreatableCombobox ────────────────────────────────────────────────────────
51
52type ComboboxRootProps = React.ComponentProps<typeof ComboboxPrimitive.Root>;
53
54type CreatableComboboxProps = ComboboxRootProps & {
55 /**
56 * Called when the user confirms a new value that doesn't exist in the list.
57 * Receives the raw typed string value.
58 */
59 /**
60 * onValueChange will never be called with a CreatableItem.
61 * Use onCreateValue to handle new value creation.
62 */
63 onCreateValue: (value: string) => void;
64
65 /** Label for the "Create" option. Defaults to `Create "${value}"`. */
66 createLabel?: (value: string) => string;
67
68// … truncated

What it pulls in

npm packages

  • @base-ui/react
  • class-variance-authority
  • clsx
  • tailwind-merge
  • lucide-react

Files it writes

  • src/lib/utils.ts
  • src/components/ui/button.tsx
  • src/components/ui/input.tsx
  • src/components/ui/textarea.tsx
  • src/components/ui/input-group.tsx
  • src/components/ui/combobox.tsx
  • src/flowkit/creatable-combobox/creatable-combobox.tsx

Facts

Registry
flowkit-ui
Type
registry:component
Access
Free
Files written
7
Licence
MIT
First indexed
2026-08-04
Last confirmed
today

Go to the source

Docs on flowkit-ui flowkit-ui.vzkiss.com vzkiss/flowkit-ui on GitHub Raw registry item This item as JSON
BlockDex

Built by

Kynth Studio

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

BlockDex

BlockDex

Built by

Kynth Studio

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

BlockDex

BlockDex

Built by

Kynth Studio

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

BlockDex