Skip to content

An iPhone OS search field: a white rounded pill with a magnifier glyph and grey clear button on a blue-grey glossy bar.

Installation

Requires the theme. Register the @skeuomorph namespace and add @skeuomorph/skeuomorph first, as shown in the installation guide. The CLI also pulls it in as a dependency.

pnpm dlx shadcn@latest add @skeuomorph/search-bar

Without the namespace, install straight from the URL:

pnpm dlx shadcn@latest add https://ui-skeuomorph.vercel.app/r/search-bar.json

Usage

import { SearchBar } from "@/components/ui/search-bar"
<SearchBar placeholder="Search" aria-label="Search contacts" />

Examples

iOS

variant="ios" puts the pill on the blue-grey iPhone OS tray. Add showCancel for the Cancel button that clears and blurs the field.

<SearchBar variant="ios" showCancel placeholder="Search" aria-label="Search contacts" />

API

SearchBar accepts every input prop except type (it is always search), plus:

PropTypeDescription
variant"default" | "ios"default: a Mac search pill. ios: the pill on an iPhone OS tray.
onClear() => voidCalled after the clear button empties the field.
showCancelbooleanShows a Cancel button next to the field.
onCancel() => voidCalled after Cancel empties and blurs the field.

The field works controlled (value + onChange) or uncontrolled. Always give it an accessible name with aria-label or a <label>.