SearchField
The <SearchField> component offers a user-friendly input field specifically designed for search queries, often accompanied by a search icon or button to initiate the search action.
Anatomy
A <SearchField> consists of an input element, a label, and an optional clear button.
Appearance
The appearance of a component can be customized using the variant and size props. These props adjust the visual style and dimensions of the component, available values are based on the active theme.
| Property | Type | Description |
|---|---|---|
variant | - | The available variants of this component. |
size | - | The available sizes of this component. |
Usage
The <SearchField> component is a versatile UI element that enables users to search for specific information within a given context or data set.
Placement
The placement of a search field plays a critical role in its effectiveness and usability. A well-positioned search field ensures users can easily find and use it, enhancing their overall experience on a website or application.


Don’t place the search field in an obscure location.
Props
action?ReactElement<any, string | JSXElementConstructor<any>>;
aria-activedescendant?string;
aria-autocomplete?"none" | "inline" | "list" | "both";
aria-controls?string;
aria-describedby?string;
aria-details?string;
aria-errormessage?string;
aria-haspopup?boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog";
aria-label?string;
aria-labelledby?string;
autoComplete?string;
autoCorrect?string;
autoFocus?boolean;
defaultValue?string;
"none"description?ReactNode;
dir?string;
disabled?boolean;
true, the input is disabled."false"enterKeyHint?"search" | "enter" | "done" | "go" | "next" | "previous" | "send";
error?boolean;
true, the input is considered invalid and if set the errorMessage is shown instead of the description."false"errorMessage?ReactNode | ((v: ValidationResult) => ReactNode);
excludeFromTabOrder?boolean;
form?string;
<form> element to associate the input with.
The value of this attribute must be the id of a <form> in the same document.
See MDN.hidden?boolean;
id?string;
inert?boolean;
inputMode?"text" | "search" | "url" | "tel" | "email" | "none" | "numeric" | "decimal";
label?ReactNode;
lang?string;
maxLength?number;
minLength?number;
name?string;
onAnimationEnd?AnimationEventHandler<HTMLDivElement>;
onAnimationEndCapture?AnimationEventHandler<HTMLDivElement>;
onAnimationIteration?AnimationEventHandler<HTMLDivElement>;
onAnimationIterationCapture?AnimationEventHandler<HTMLDivElement>;
onAnimationStart?AnimationEventHandler<HTMLDivElement>;
onAnimationStartCapture?AnimationEventHandler<HTMLDivElement>;
onAuxClick?MouseEventHandler<HTMLDivElement>;
onAuxClickCapture?MouseEventHandler<HTMLDivElement>;
onBeforeInput?FormEventHandler<HTMLInputElement>;
onBlur?(e: FocusEvent<HTMLInputElement, Element>) => void;
onChange?(value: string) => void;
onClear?() => void;
onClick?MouseEventHandler<HTMLDivElement>;
onClickCapture?MouseEventHandler<HTMLDivElement>;
onCompositionEnd?CompositionEventHandler<HTMLInputElement>;
onCompositionStart?CompositionEventHandler<HTMLInputElement>;
onCompositionUpdate?CompositionEventHandler<HTMLInputElement>;
onContextMenu?MouseEventHandler<HTMLDivElement>;
onContextMenuCapture?MouseEventHandler<HTMLDivElement>;
onCopy?ClipboardEventHandler<HTMLInputElement>;
onCut?ClipboardEventHandler<HTMLInputElement>;
onDoubleClick?MouseEventHandler<HTMLDivElement>;
onDoubleClickCapture?MouseEventHandler<HTMLDivElement>;
onFocus?(e: FocusEvent<HTMLInputElement, Element>) => void;
onFocusChange?(isFocused: boolean) => void;
onGotPointerCapture?PointerEventHandler<HTMLDivElement>;
onGotPointerCaptureCapture?PointerEventHandler<HTMLDivElement>;
onInput?FormEventHandler<HTMLInputElement>;
onKeyDown?(e: KeyboardEvent) => void;
onKeyUp?(e: KeyboardEvent) => void;
onLostPointerCapture?PointerEventHandler<HTMLDivElement>;
onLostPointerCaptureCapture?PointerEventHandler<HTMLDivElement>;
onMouseDown?MouseEventHandler<HTMLDivElement>;
onMouseDownCapture?MouseEventHandler<HTMLDivElement>;
onMouseEnter?MouseEventHandler<HTMLDivElement>;
onMouseLeave?MouseEventHandler<HTMLDivElement>;
onMouseMove?MouseEventHandler<HTMLDivElement>;
onMouseMoveCapture?MouseEventHandler<HTMLDivElement>;
onMouseOut?MouseEventHandler<HTMLDivElement>;
onMouseOutCapture?MouseEventHandler<HTMLDivElement>;
onMouseOver?MouseEventHandler<HTMLDivElement>;
onMouseOverCapture?MouseEventHandler<HTMLDivElement>;
onMouseUp?MouseEventHandler<HTMLDivElement>;
onMouseUpCapture?MouseEventHandler<HTMLDivElement>;
onPaste?ClipboardEventHandler<HTMLInputElement>;
onPointerCancel?PointerEventHandler<HTMLDivElement>;
onPointerCancelCapture?PointerEventHandler<HTMLDivElement>;
onPointerDown?PointerEventHandler<HTMLDivElement>;
onPointerDownCapture?PointerEventHandler<HTMLDivElement>;
onPointerEnter?PointerEventHandler<HTMLDivElement>;
onPointerLeave?PointerEventHandler<HTMLDivElement>;
onPointerMove?PointerEventHandler<HTMLDivElement>;
onPointerMoveCapture?PointerEventHandler<HTMLDivElement>;
onPointerOut?PointerEventHandler<HTMLDivElement>;
onPointerOutCapture?PointerEventHandler<HTMLDivElement>;
onPointerOver?PointerEventHandler<HTMLDivElement>;
onPointerOverCapture?PointerEventHandler<HTMLDivElement>;
onPointerUp?PointerEventHandler<HTMLDivElement>;
onPointerUpCapture?PointerEventHandler<HTMLDivElement>;
onScroll?UIEventHandler<HTMLDivElement>;
onScrollCapture?UIEventHandler<HTMLDivElement>;
onSelect?ReactEventHandler<HTMLInputElement>;
onSubmit?(value: string) => void;
onTouchCancel?TouchEventHandler<HTMLDivElement>;
onTouchCancelCapture?TouchEventHandler<HTMLDivElement>;
onTouchEnd?TouchEventHandler<HTMLDivElement>;
onTouchEndCapture?TouchEventHandler<HTMLDivElement>;
onTouchMove?TouchEventHandler<HTMLDivElement>;
onTouchMoveCapture?TouchEventHandler<HTMLDivElement>;
onTouchStart?TouchEventHandler<HTMLDivElement>;
onTouchStartCapture?TouchEventHandler<HTMLDivElement>;
onTransitionCancel?TransitionEventHandler<HTMLDivElement>;
onTransitionCancelCapture?TransitionEventHandler<HTMLDivElement>;
onTransitionEnd?TransitionEventHandler<HTMLDivElement>;
onTransitionEndCapture?TransitionEventHandler<HTMLDivElement>;
onTransitionRun?TransitionEventHandler<HTMLDivElement>;
onTransitionRunCapture?TransitionEventHandler<HTMLDivElement>;
onTransitionStart?TransitionEventHandler<HTMLDivElement>;
onTransitionStartCapture?TransitionEventHandler<HTMLDivElement>;
onWheel?WheelEventHandler<HTMLDivElement>;
onWheelCapture?WheelEventHandler<HTMLDivElement>;
pattern?string;
placeholder?string;
"none"readOnly?boolean;
true, the input is readOnly."false"ref?Ref<HTMLInputElement>;
ref.current to null
(or call the ref with null if you passed a callback ref).
@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}required?boolean;
true, the input is required."false"slot?string | null;
null value indicates that the local props completely override all props received from a parent.spellCheck?string;
translate?"yes" | "no";
type?"text" | "search" | "url" | "tel" | "email" | "password" | (string & {});
'search'validate?(value: string) => true | ValidationError | null;
validationBehavior="native". For realtime validation, use the isInvalid
prop instead.validationBehavior?"native" | "aria";
'native'value?string;
"none"width?WidthProp;
"full"