Navigated to /docs/ui/components/search-input

SearchInput

Search input primitive with consistent control sizing.

Preview

A live, theme-aware example rendered with the published component.

Loading preview…

Import

Import the component from its dedicated entry point to keep the dependency and generated bundle explicit.

TSX
tsximport { SearchInput } from "@tavojs/ui/search-input";

Normal Tavo.js applications load component styles through the Tavo.js UI plugin. If the application manages component CSS manually, also import @tavojs/ui/css/search-input.

When to use

Use it when

Use `SearchInput` for labeled search and filtering fields. It keeps query state, filtering, debouncing, and result rendering in the consuming application

Choose something else when

Avoid SearchInput when wrapping controls without labels or accessible names.

Examples

SearchInput example

TSX
tsximport { SearchInput } from "@tavojs/ui/search-input";
import { Field } from "@tavojs/ui";

export function SearchInputExample1() {
  let query = "";
  const isSearching = false;
  const setQuery = (nextQuery: string) => {
    query = nextQuery;
  };
  return (
    <>
      <Field label="Search resources">
        <SearchInput
          value={query}
          placeholder="Name or category"
          clearable
          loading={isSearching}
          onInput={(event) => setQuery(event.currentTarget.value)}
          onClear={() => setQuery("")}
        />
      </Field>
    </>
  );
}

Common props and defaults

PropTypeDefaultDescription
classNamestring

Optional class hook applied to the public root element owned by the component.
sizeSize

Configures size for this component.
valuestring

Configures value for this component.
defaultValuestring

Configures defaultValue for this component.
clearableboolean

Configures clearable for this component.
clearLabelstring

Configures clearLabel for this component.
loadingboolean

Configures loading for this component.
leadingChild

Configures leading for this component.
trailingChild

Configures trailing for this component.

Complete TypeScript API

Import from @tavojs/ui/search-input. Published exports: SearchInput, SearchInputProps.

SearchInputProps

PropertyTypeRequiredDescription
classNamestring

No

Optional class hook applied to the public root element owned by the component.

inputClassNamestring

No

Inherited inputClassName attribute accepted by SearchInput.

sizeSize

No

Configures size for this component.

valuestring

No

Configures value for this component.

defaultValuestring

No

Configures defaultValue for this component.

namestring

No

Inherited name attribute accepted by SearchInput.

placeholderstring

No

Inherited placeholder attribute accepted by SearchInput.

autoCompletestring

No

Inherited autoComplete attribute accepted by SearchInput.

inputModestring

No

Inherited inputMode attribute accepted by SearchInput.

requiredboolean

No

Inherited required attribute accepted by SearchInput.

readOnlyboolean

No

Inherited readOnly attribute accepted by SearchInput.

minLengthnumber

No

Inherited minLength attribute accepted by SearchInput.

maxLengthnumber

No

Inherited maxLength attribute accepted by SearchInput.

patternstring

No

Inherited pattern attribute accepted by SearchInput.

typenever

No

Inherited type attribute accepted by SearchInput.

clearableboolean

No

Configures clearable for this component.

clearLabelstring

No

Configures clearLabel for this component.

loadingboolean

No

Configures loading for this component.

leadingChild

No

Configures leading for this component.

trailingChild

No

Configures trailing for this component.

onClear() => void

No

Inherited onClear attribute accepted by SearchInput.

onChangeValueChangeHandler<HTMLInputElement>

No

Inherited onChange attribute accepted by SearchInput.

onInputValueChangeHandler<HTMLInputElement>

No

Inherited onInput attribute accepted by SearchInput.

State ownership and DOM target

ConcernContract
StateApplication controlled through value and the matching callback.
DOM targetNative input attributes target the owned form control; wrapper-specific props stay on the documented component root.

Anatomy and related components

This component exposes one public component root rather than a compound member API.

Limitations

Avoid SearchInput when wrapping controls without labels or accessible names.

Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.

Accessibility

Pair the control with `Field`, a visible label, or `aria-label`. Loading sets `aria-busy` on the native input, and the clear action uses `clearLabel` as its accessible name.

  • Pair the control with `Field`, a visible label, or `aria-label`. Loading sets `aria-busy` on the native input, and the clear action uses `clearLabel` as its accessible name.

Component status

ContractCurrent value
Maturitystable
Categoryforms
Component import@tavojs/ui/search-input
Explicit CSS import@tavojs/ui/css/search-input
PreviewInteractive preview available on this page