Skip to content

Search field

Accepts a search query, with a button to clear it.

search-field-basic-demo.tsx

Installation

The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.

Composition

  • SearchField

    Owns the query and submission state.

    • SearchFieldLabel
    • SearchFieldInput
    • SearchFieldClear
    • SearchFieldDescription
    • SearchFieldError

Disabled

search-field-disabled-demo.tsx

Filtered results

SearchFieldClear resets the query and the list.

search-field-demo.tsx

Sizes

Give each control in a filter bar the same size.

search-field-sizes-demo.tsx

API reference

vip/ui adds or changes the props below. For all other props, see React Aria SearchField (opens in a new tab).

size: "xs" | "sm" | "md" | "lg" | "xl" = "lg"
Sets the size of the field, the search icon, and the clear button. The clear button shows only when the field has a value.
label: string
Label above the field in the default layout.
description: string
Help text below the field in the default layout.
placeholder: string
Input placeholder in the default layout.