Skip to content

Expanding Search

Pro

A round search button that grows into a search field when you press it. It closes again when the field is empty and you move away.

  • Base UI
  • Motion
  • React 19
  • Tailwind CSS 4

Added Nov 9, 2026 · Pro license

Playground

Loading the preview

Props

Needs your Pro API key in GELATIN_UI_PRO_TOKEN. Set it up

Pro itemAPI key required

Expanding Search needs a Pro API key

Try the live preview for free. With Pro, the add command above puts the source in your project.

Files it adds
23
More Pro items, one API key
+327
Your coding agent runs it
1 cmd

$79$129once, for life

Already have Pro? Sign in to set up your API key.

A search button that grows into a field. Read the text with onValueChange.

header-search.tsx

ExpandingSearch

<div>
PropTypeDefaultDescription
valuestring—The text, when the parent owns it.
defaultValuestring""The first text, when the field owns it. Default "".
onValueChange—Each change of the text, at once (each key, a clear).
onSearch—Run the search: on Enter, on a clear (with ""), and after debounce ms of no typing.
onClear—The text was cleared (the clear button, or Escape with text).
debouncenumber—Ms of no typing before onSearch runs. undefined (the default): typing does not search, only Enter and a clear do. 0: each change searches.
shortcutfalse"/""mod+k"—The key that focuses and selects the field from anywhere. Default false (none).
classNamestring—Classes of the frame (the InputGroup), for its width. The classes of the root. Its width is the open width (default w-60 max-w-full).
busyboolean—The field waits for results: the spinner takes the place of the search icon, and the input is aria-busy.
size"default""lg""sm""xs""default"
variant"dashed""default"—
openboolean—The field is open (controlled). It also stays open while it holds text.
defaultOpenbooleanfalseThe field starts open (uncontrolled). Default false.
onOpenChange—The field opened or closed.
align"end""start""start"The side that stays put while the field grows: start (default) or end, for a header.
labels—The words: trigger, and the Search Field words clear and loading. Keep it stable.
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • Use it when the header has no room for a full field at rest.
  • Use align="end" for a search at the end of a header: the field grows toward the start.
  • Use shortcut to open it with a key, such as /.
  • For a search that is the main task of the page, use a Search Field.
  • For a search of commands and pages in a popup, use a Command.
EnterorSpaceOn the round button: opens the field and moves the focus into it.
EscapeClears the text. On an empty field: closes it and puts the focus on the button.
/Opens the field when shortcut is /.
Open and close
island · the frame grows from a circle to the full width, and the icon stays in place
Text
fade · the text and the placeholder fade in and out
Press
press · the button scales to 0.94

Built with

Installs with Expanding Search

Components
Search Field
  1. AddedExpanding Search, with Search Field.
Open the release