Tessera UI

Search

A search input with built-in search icon, clear button, optional submit button, loading state, and full RTL support. Follows the Field component's design language with three visual variants.

Installation

pnpm add @tessinaui/ui

Usage

import { Search } from "@tessinaui/ui";
<Search placeholder="Search..." onSearch={(value) => console.log(value)} />

The search component wraps a native <input type="search"> inside a <form role="search"> landmark for proper accessibility. It automatically provides a search icon, handles Escape to clear, and Enter to submit.

Playground

Configure every property interactively:

Preview
Loading...

Showcase

All variants, sizes, intents, and feature combinations:

Preview
Loading...

API Reference

Props

PropTypeDefaultDescription
variant"default" | "filled" | "minimal""default"Visual variant. default has a border, filled has a background, minimal has only a bottom border
size"xs" | "sm" | "md" | "lg" | "xl""md"Controls height, padding, and text/icon size
rounded"full" | "lg" | "md" | "sm" | "none""full"Border radius. Ignored for minimal variant
intent"none" | "error" | "warning" | "success" | "info""none"Controls border/ring color and supporting text styling
labelstring--Label text above the search field
requiredbooleanfalseShows a red * after the label and sets aria-required
supportingTextstring--Text below the input. Color and icon follow intent
searchLabelstring"Search"Accessible label for the search form landmark (aria-label)
clearablebooleantrueShows a clear button when the input has a value
onClear() => void--Called when the clear button is clicked
onSearch(value: string) => void--Called when the user presses Enter or clicks the submit button
showSubmitButtonbooleanfalseShows a submit button inside the search field
submitButtonTextstring"Search"Text for the submit button
loadingbooleanfalseShows a loading spinner instead of the search icon
showShortcutbooleanfalseShows ⌘K hint when empty, Esc when dirty. Registers a global Cmd/Ctrl+K listener to focus the input
disabledbooleanfalseDisables the input and all interactive elements
dir"ltr" | "rtl"--Text direction. RTL flips the full layout
placeholderstring"Search..."Native placeholder text
value / defaultValuestring--Controlled / uncontrolled value
onChangeChangeEventHandler--Native onChange handler
wrapperClassNamestring--Extra className for the outer <form> element
containerClassNamestring--Extra className for the bordered container <div>

All other native <input> attributes (name, autoComplete, autoFocus, etc.) are forwarded.

Keyboard Interactions

KeyAction
EnterSubmits the search (calls onSearch)
EscapeClears the input value
⌘K / Ctrl+KFocuses the search input (when showShortcut is enabled)

Accessibility

  • Wrapped in a <form role="search"> landmark with aria-label
  • Uses native <input type="search"> with role="searchbox"
  • aria-required and aria-invalid set from props
  • Clear button uses aria-label="Clear search"
  • Focus ring follows WCAG 2.1 AA: focus-visible:ring-2
  • Touch targets meet 44x44px minimum

On this page