Input
Search Input
NewA search field with a ⌘K shortcut hint, a spinner while typing and a clear button that pops in.
npx motionsnack add search-inputCustomize
<SearchInput />Props
19 properties
| Property | Type | Default | Description |
|---|---|---|---|
| value | string | - | Controlled value. Leave undefined to let the component manage it. |
| defaultValue | string | '' | Value on first render when uncontrolled. |
| onChange | (value: string) => void | - | Called with the new text on every change. |
| onSearch | (value: string) => void | - | Called with the text when the visitor presses Enter. |
| name | string | - | Name submitted with a form. |
| ariaLabel | string | - | Deprecated alias of label. |
| id | string | generated | Id of the input. |
| className | string | '' | Extra classes on the wrapper. |
| placeholder | string | 'Search projects, services…' | Hint inside the empty field. |
| label | string | 'Search' | Accessible name of the field and its search landmark (not shown). |
| shortcut | string | 'K' | Letter of the ⌘ / Ctrl shortcut that focuses the field. Empty turns it off and hides the hint. |
| shortcutModifier | boolean | true | The shortcut needs ⌘ / Ctrl. Off: the bare key focuses the field, like / on many apps. |
| loading | boolean | false | Results are loading: spinner in place of the magnifier after 500ms. |
| showLoader | boolean | true | Demo: a spinner in place of the magnifier while the visitor types. |
| loaderDelay | number | 600 | How long the spinner stays after the last keystroke. |
| clearable | boolean | true | Show a button that clears the field. |
| disabled | boolean | false | Disables the field. |
| height | number | 48 | Height of the field. |
| radius | number | 12 | Corner radius of the field. 999 makes a pill. |
About Search Input
Search Input is a search field for a site, a docs page or a project list. Pressing ⌘K or Ctrl+K anywhere on the page focuses it, and the shortcut hint in the field shows the right key for the visitor's system. While the visitor types, the magnifier cross-fades into a spinner for a moment you set, and once there is text the hint gives way to a clear button. Enter calls onSearch, Escape clears the field. The shape runs from square to pill through one radius prop.
What's included
- ⌘K / Ctrl+K shortcut with a platform-aware hint
- Spinner that replaces the magnifier while typing
- Clear button and Escape to clear
- onSearch on Enter
- Square to pill shape
- Light and dark look
- Type
- Animated React input component
- Library
- Components · Input
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-11-23
- Install
npx motionsnack add search-input