Morphing Search

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

Chip Search

morphing-search-chips.tsx

Docked search bar that springs wider on focus and unfolds a recent-searches panel out of its own edge. Terms become removable chips, the bar grows with them, and suggestions filter as you type.

onboarding
Enter adds a filter. Backspace at the start of the field selects the last filter, and again removes it. Delete removes the highlighted recent search.

Install

$ bunx --bun shadcn add @beui/morphing-search-chips

API Reference

chips?
string[]

Active filters shown as chips inside the bar.

—
defaultChips?
string[]
[]
onChipsChange?
((chips: string[]) => void)
—
query?
string

Text in the field.

—
defaultQuery?
string
onQueryChange?
((query: string) => void)
—
recents?
string[]

Recent searches, newest first.

—
defaultRecents?
string[]
[]
onRecentsChange?
((recents: string[]) => void)
—
storageKey?
string

Persist uncontrolled recents in localStorage under this key.

—
maxRecents?
number

How many recent searches to keep. Default 5.

5
suggestions?
string[]

Terms offered while typing.

[]
filter?
false | ((term: string, query: string) => boolean)

How suggestions match the query. Default: case-insensitive substring. Pass `false` when `suggestions` already arrive filtered, e.g. from a server.

—
maxSuggestions?
number

How many matches to list under the typed query. Default 6.

6
loading?
boolean

Suggestions are being fetched.

false
maxChips?
number

Most chips allowed at once.

—
normalize?
((term: string) => string | null)

Clean a term before it becomes a chip; return null to reject it.

—
emptyState?
ReactNode

Shown when the field is empty and there are no recent searches.

—
side?
"auto" | "bottom" | "top"

Which way the surface grows. "auto" grows up unless there is no room. Default "top".

top
open?
boolean
—
defaultOpen?
boolean
false
onOpenChange?
((open: boolean) => void)
—
disabled?
boolean
false
name?
string

Submit each chip with a form under this name.

—
placeholder?
string
Search
label?
string

Accessible name for the search field.

Search
actions?
ReactNode

Trailing controls inside the bar, such as filter buttons.

—
className?
string
—

Morphing Search

morphing-search.tsx

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

Install

$ bunx --bun shadcn add @beui/morphing-search

API Reference

items
MorphingSearchItem[]
—
placeholder?
string
Search
shortcut?
string
f
iconOnly?
boolean

Render the closed trigger as a compact search icon.

false
emptyMessage?
string
No results found.
open?
boolean
—
defaultOpen?
boolean
false
onOpenChange?
((open: boolean) => void)
—
onQueryChange?
((query: string) => void)
—
onSelect?
((item: MorphingSearchItem) => void)
—
className?
string
—

Keep in mind

Some components on this site are inspired by or recreated from existing work across the web. I'm not here to take credit; just to learn, experiment, and sometimes push things a bit further. If something looks familiar and I forgot to mention you, reach out and I'll fix that right away.

Updated