Search
Add a search form to help visitors find site content. Compare default, large, and icon-button layouts.
Examples
Default
Breakpoints
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxsearch-demo.tsx
Large
Breakpoints
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxsearch-large-demo.tsx
Icon Button
Breakpoints
Mobile
320pxMobile Lg
480pxTablet
640pxDesktop
1024pxsearch-icon-button-demo.tsx
Component API
Put Label, Input, and Button inside Root to form a search control.
Root<div>
Sets the shared search size and field state.
| Prop | Type | Default | Description |
|---|---|---|---|
size | default | sm | lg | default | Changes the input and button size. |
name | string | — | Form field name. |
required | boolean | — | Requires a query. |
disabled | boolean | — | Disables the search control. |
| Attribute | Value | Purpose |
|---|---|---|
data-disabled | Present when disabled | Style the disabled state. |
Label<label>
Provides a visually hidden accessible name.
| Attribute | Value | Purpose |
|---|---|---|
data-disabled | Present when disabled | Style the disabled state. |
Input<input>
Receives the search query.
| Attribute | Value | Purpose |
|---|---|---|
data-disabled | Present when disabled | Style the disabled state. |
Button<button>
Submits the search; children replace the default search icon. Give the icon-only button an accessible name, such as aria-label="Search".
| Attribute | Value | Purpose |
|---|---|---|
data-disabled | Present when disabled | Style the disabled state. |