Skip to content

Instantly share code, notes, and snippets.

@markryd
Created April 20, 2018 05:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markryd/5d912f0082c6209080337820f8b0095b to your computer and use it in GitHub Desktop.
Save markryd/5d912f0082c6209080337820f8b0095b to your computer and use it in GitHub Desktop.
Start of typescript types for react-autocomplete
interface AutocompleteProps<T> {
items: T[];
value?: string;
onChange?(e: React.ChangeEvent<HTMLInputElement>, value: string): void;
onSelect?(value: string, item: T): void;
shouldItemRender?(item: T, value: string): boolean;
isItemSelectable?(item: T): boolean;
sortItems?(itemA: T, itemB: T, value: string): -1 | 0 | 1;
getItemValue(item: T): string;
renderItem(item: T, isHighlighted?: boolean, styles?: React.CSSProperties): JSX.Element;
renderMenu?(items: T[], value: string, styles?: React.CSSProperties): JSX.Element;
menuStyle?: React.CSSProperties;
renderInput?(props: any): JSX.Element;
inputProps?: object;
wrapperProps?: object;
wrapperStyle?: React.CSSProperties;
autoHighlight?: boolean;
selectOnBlur?: boolean;
onMenuVisibilityChange?(isOpen: boolean): void;
open?: boolean;
debug?: boolean;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment