Forms

Search Field

A text input designed for searching, often featuring built-in filtering, suggestions, and a clear button. It provides a user-friendly way to perform searches.

Loading...

Installation

Install the component via the CLI in one command.

npx shadcn@latest add @intentui/search-field

Composed components

When you install this component via the CLI, it automatically loads all composed components, so you don’t need to add them individually.

Manual installation

Use this approach if you prefer to install and wire up the component yourself instead of using the CLI.

npm install react-aria-components @heroicons/react tailwind-merge

Anatomy

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

<SearchField>
  <SearchInput placeholder="Search..." />
</SearchField>

Examples

With label

You can add a label to the search field by using the label prop.

Loading...

Validation

Add a validation message to the search field by setting the validationMessage prop.

Loading...

Description

You can add a description to the search field by using the description prop.

Loading...

Controlled

Like other fields, the search field can be controlled by managing its value through the value prop.

Loading...

Uncontrolled

Like other fields, the search field can be controlled by managing its value through the defaultValue prop.

Loading...

Readonly

When the search field is set to readonly, it cannot be edited.

Loading...

Disabled

Disable the search field by using the isDisabled prop.

Loading...

Component API

SearchField

The SearchField component renders a search input.

PropTypeDefault
classNamestring-

SearchInput

The SearchInput component renders the search input control.

PropTypeDefault
classNamestring-

See the React Aria for the full API reference.

Unlock the full power of
Intent UI Design

Build modern web apps faster with 1000+ resources across components, blocks, patterns, templates, and starter kits.

Learn more