bbd-react-autocomplete
Version:
A search box for React
32 lines (31 loc) • 1.31 kB
TypeScript
import type { FocusEventHandler } from 'react';
import type { DefaultTheme } from '../config/config';
export declare const DEFAULT_INPUT_DEBOUNCE = 300;
export declare const MAX_RESULTS = 10;
export interface ReactSearchAutocompleteProps<T> {
items: T[];
inputDebounce?: number;
onSearch?: (keyword: string, results?: T[]) => void;
onHover?: (result: T) => void;
onSelect?: (result: T) => void;
onFocus?: FocusEventHandler<HTMLInputElement>;
onClear?: Function;
showIcon?: boolean;
showClear?: boolean;
maxResults?: number;
placeholder?: string;
autoFocus?: boolean;
styling?: DefaultTheme;
resultStringKeyName?: string;
inputSearchString?: string;
formatResult?: Function;
showNoResults?: boolean;
showNoResultsText?: string;
maxLength?: number;
className?: string;
defaultOptions?: T[];
customValue?: string;
triggerSetValue?: boolean;
filterKey?: string;
}
export default function ReactSearchAutocomplete<T>({ items, inputDebounce, onSearch, onHover, onSelect, onFocus, onClear, showIcon, showClear, maxResults, placeholder, autoFocus, styling, resultStringKeyName, inputSearchString, formatResult, showNoResults, showNoResultsText, maxLength, className, filterKey }: ReactSearchAutocompleteProps<T>): JSX.Element;