Search Input

Search input with a leading search icon and a clear button that appears once there is text. Comes in sm, default and lg sizes, controlled or uncontrolled.

src/registry/ui/search-input.tsx/r/search-input.json

Installation#

bash
npx shadcn@latest add @minidev/search-input

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/search-input.json

Usage#

tsx
import { SearchInput } from "@/components/ui/search-input"

export function Example() {
  return (
    <SearchInput id="q1" placeholder="Search components" />
  )
}

API reference#

SearchInput props
PropTypeDefault
size"sm" | "default" | "lg""default"
onClear() => void-
containerClassNamestring-

Also accepts every prop of <input>, passed through to the root element.

Dependencies#

npm

lucide-react

Built from

Examples#

All form components

Learn more