SearchBar
SearchBar that includes an input field with a search icon and clear button, allowing users to easily search for specific items or content.
import { SearchBar } from '@lobehub/ui';Data Entry
Default
The rest of the props of Input are exactly the same as the original input.
Loading preview
APIs
SearchBar properties
allowClearInputPropsbooleanclassNameInputPropsstringclassNames{ input?: string; shortKey?: string; }defaultValuestringThe default value of the input. Use when uncontrolled.
Defaults to
"".enableShortKeybooleanloadingbooleanonClearInputProps() => voidonInputChange(value: string) => voidonPressEnterInputProps(event: KeyboardEvent<HTMLInputElement>) => voidonSearch(value: string) => voidonValueChangeInputProps(value: string, eventDetails: Input.ChangeEventDetails) => voidCallback fired when the `value` changes. Use when controlled.
prefixInputPropsnull | string | number | bigint | false | true | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>Prefix node rendered before the input
refInputPropsnull | (instance: HTMLInputElement | null) => void | (() => VoidOrUndefinedOnly) | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES] | RefObject<HTMLInputElement | null>Reference to the input element
shadowInputPropsbooleanApply lobe shadow style
shortKeystringDefaults to
"mod+k".sizeInputProps'small' | 'large' | 'middle'Size of the input
Defaults to
'middle'.spotlightbooleanstyleInputPropsCSSPropertiesstyles{ input?: CSSProperties; shortKey?: CSSProperties; }suffixInputPropsnull | string | number | bigint | false | true | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>Suffix node rendered after the input
valuestringThe value of the input. Use when controlled.
variantInputProps'filled' | 'outlined' | 'borderless'Visual variant, defaults to `filled` in dark mode and `outlined` in light mode
Also accepts all native HTML and ARIA attributes.
Helpful?