SearchField
A search field allows a user to enter and clear a search query.
Preview
Code
Examples
Disabled
Preview
Code
Read only
Preview
Code
With custom width
Preview
Code
With default value
Preview
Code
Props
Name | Type | Default |
---|---|---|
id | string | — |
name | string | — |
type | (string & {}) | "search" | "text" | "tel" | "url" | "email" | "password" | — |
onCopy | ClipboardEventHandler<HTMLInputElement> | — |
onCut | ClipboardEventHandler<HTMLInputElement> | — |
onPaste | ClipboardEventHandler<HTMLInputElement> | — |
onCompositionEnd | CompositionEventHandler<HTMLInputElement> | — |
onCompositionStart | CompositionEventHandler<HTMLInputElement> | — |
onCompositionUpdate | CompositionEventHandler<HTMLInputElement> | — |
onFocus | ((e: FocusEvent<HTMLInputElement, Element>) => void) | — |
onBlur | ((e: FocusEvent<HTMLInputElement, Element>) => void) | — |
onChange | ((value: string) => void) | — |
onBeforeInput | FormEventHandler<HTMLInputElement> | — |
onInput | FormEventHandler<HTMLInputElement> | — |
onSubmit | ((value: string) => void) | — |
onKeyDown | ((e: KeyboardEvent) => void) | — |
onKeyUp | ((e: KeyboardEvent) => void) | — |
onSelect | ReactEventHandler<HTMLInputElement> | — |
isDisabled | boolean | — |
autoFocus | boolean | — |
onFocusChange | ((isFocused: boolean) => void) | — |
excludeFromTabOrder | boolean | — |
value | string | — |
autoComplete | string | — |
maxLength | number | — |
minLength | number | — |
pattern | string | — |
defaultValue | string | — |
enterKeyHint | "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | — |
spellCheck | string | — |
autoCorrect | string | — |
inputMode | "none" | "search" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | — |
isReadOnly | boolean | — |
isRequired | boolean | — |
isInvalid | boolean | — |
validate | ((value: string) => true | ValidationError | null) | — |
onClear | (() => void) | — |
validationBehavior | "native" | "aria" | 'native' |
children | ReactNode | ((values: SearchFieldRenderProps & { defaultChildren: ReactNode; }) => ReactNode) | — |
className | string | ((values: SearchFieldRenderProps & { defaultClassName: string; }) => string) | — |
style | CSSProperties | ((values: SearchFieldRenderProps & { defaultStyle: CSSProperties; }) => CSSProperties) | — |
slot | string | null | — |
ref | Ref<HTMLInputElement> | — |
key | Key | null | — |