Search Field

A capsule search field with a magnifying glass, in content, Liquid Glass toolbar and sidebar styles, and a filter field.

@cupertinoui/search-fieldRegistry JSON

Installation

pnpm dlx shadcn@latest add @cupertinoui/search-field

The first install also adds the macOS theme. See Installation to set up the registry.

Usage

import { FilterField, SearchField } from "@/components/ui/search-field"

<SearchField aria-label="Search" />
<FilterField aria-label="Filter files" variant="filled" size="sm" />

Examples

Variants

Default sits in content. Glass matches the Liquid Glass capsules of a toolbar, and filled is the sidebar search field of System Settings.

Sizes

Filter field

FilterField narrows a list in place, like the field under Xcode's navigator: a filter symbol and a “Filter” placeholder, in the same styles and sizes.

API Reference

Every part forwards the props of the underlying element. The props below are the ones CupertinoUI adds or changes.

SearchField

Accepts every input attribute; the placeholder defaults to “Search”.

PropTypeDescription
variant"default" | "glass" | "filled"
Default: "default"
Content, toolbar or sidebar style.
size"sm" | "default" | "lg" | "xl"
Default: "default"
20, 24, 28 or 36pt tall. Toolbars use xl.
classNamestringExtra classes, merged with the component's own.

FilterField

The same field with a filter symbol; the placeholder defaults to “Filter”. Takes the same props.

PropTypeDescription