---
title: "Morphing Search"
description: "Free React search that morphs from a field or icon into a glass results panel, opened by click or keyboard shortcut. Keyboard accessible, shadcn install."
category: "Blocks"
parent: "https://beui.dev/components/blocks/morphing-search"
publishedAt: "2026-08-18"
updatedAt: "2026-11-24"
documentation: "https://beui.dev/components/blocks/morphing-search/overlay"
markdown: "https://beui.dev/components/blocks/morphing-search/overlay.md"
license: "MIT"
---

# Morphing Search

> Free React search that morphs from a field or icon into a glass results panel, opened by click or keyboard shortcut. Keyboard accessible, shadcn install.

## Install

```bash
npx shadcn@latest add @beui/morphing-search
```

## Dependencies

- `clsx`
- `lucide-react`
- `motion`
- `react`
- `react-dom`
- `tailwind-merge`

## Usage

### Morphing Search usage

Search field or compact icon that morphs into a glass results surface, whether opened by click or keyboard shortcut.

```tsx
"use client";

import { Blocks, BookOpen, Bot, FolderOpen, Palette } from "lucide-react";
import {
  MorphingSearch,
  type MorphingSearchItem,
} from "@/components/motion/morphing-search";

const ITEMS: MorphingSearchItem[] = [
  {
    id: "project-folder",
    title: "Project Folder",
    description: "Block · Files and previews",
    keywords: ["files", "overlay"],
    icon: FolderOpen,
  },
  {
    id: "motion-components",
    title: "Motion components",
    description: "Collection · Interaction primitives",
    keywords: ["animation", "components"],
    icon: Blocks,
  },
  {
    id: "agent-interfaces",
    title: "Agent interfaces",
    description: "Collection · AI building blocks",
    keywords: ["ai", "chat"],
    icon: Bot,
  },
  {
    id: "installation",
    title: "Installation guide",
    description: "Documentation · Add your first component",
    keywords: ["setup", "shadcn"],
    icon: BookOpen,
  },
  {
    id: "design-tokens",
    title: "Design tokens",
    description: "Documentation · Color, type, and motion",
    keywords: ["theme", "styles"],
    icon: Palette,
  },
];

export function MorphingSearchPreview() {
  return (
    <div className="flex w-full max-w-[22rem] items-center gap-3">
      <MorphingSearch items={ITEMS} placeholder="Find components" />
      <MorphingSearch
        items={ITEMS}
        placeholder="Find components"
        shortcut=""
        iconOnly
      />
    </div>
  );
}
```

## API Reference

### MorphingSearch

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `items` | `MorphingSearchItem[]` | — | Yes | Searchable items, matched on title, description and keywords. |
| `placeholder` | `string` | — | No | Input placeholder and accessible name. Default: "Search" |
| `shortcut` | `string` | `f` | No | Opens the search when this key is pressed outside a text field. Default: "f" |
| `iconOnly` | `boolean` | `false` | No | Render the closed trigger as a compact search icon. |
| `emptyMessage` | `string` | — | No | Text shown when no item matches the query. Default: "No results found." |
| `open` | `boolean` | — | No | Whether the search panel is open, for controlled use. |
| `defaultOpen` | `boolean` | `false` | No | Whether the panel starts open when uncontrolled. Default: false |
| `onOpenChange` | `((open: boolean) => void)` | — | No | Called with the new open state when the panel opens or closes. |
| `onQueryChange` | `((query: string) => void)` | — | No | Called with the query text as the user types. |
| `onSelect` | `((item: MorphingSearchItem) => void)` | — | No | Called with the chosen item after its own `onSelect`, then the panel closes. |
| `labels` | `Partial<{ placeholder: string; empty: string; close: string; dialog: string; results: string; }>` | — | No | Override any built-in string. |
| `className` | `string` | — | No | Classes merged onto the closed trigger wrapper. |

## Types

### MorphingSearchItem

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | Unique key for the result row. |
| `title` | `string` | Yes | Main text of the result row, matched by the search. |
| `description` | `string` | No | Smaller text under the title, also matched by the search. |
| `keywords` | `string[]` | No | Extra words the search matches that are not shown. |
| `icon` | `LucideIcon` | No | Lucide icon component shown before the title. Omitted when not set. |
| `onSelect` | `() => void` | No | Called when this result is chosen, before the search's `onSelect`. |

## More in Morphing Search

- [Chip Search Bar](https://beui.dev/components/blocks/morphing-search/chips.md)

## Source

- Registry detail: https://beui.dev/r/morphing-search
- Raw source: https://beui.dev/r/morphing-search/raw
- GitHub: https://github.com/starc007/ui-components
