adwaita-web
Version:
A GTK inspired toolkit designed to build awesome web apps
39 lines (38 loc) • 1.52 kB
TypeScript
import React from "react";
export declare type AutocompleteOption = {
/**
* The value associated with this option that will be given to the `onChange` and
* `onSearch` callback's.
*/
value: string | number;
/** Label of this option as will be show in the autocomplete's list of all options. */
label: React.ReactNode;
};
/** Props for the Autocomplete component. */
export declare type AutocompleteProps = {
/** Class names that will be added to the input element. */
className?: string;
/** Current value shown in the Autocomplete Input. */
value?: string | number;
/** The default value that the input will be set to upon mount. */
defaultValue?: string | number;
/** A list of options shown to the user. */
options: Array<AutocompleteOption>;
/**
* Enables basic filtering of options. Set to `false` if you want to implement your
* own filtering.
*/
enableFilter?: boolean;
/**
* Called when the value changes, event if the change was not directly triggered by
* the user interaction with the input.
*/
onChange?: (value: string | number) => void;
/** Called when the value changes due to the user input. */
onSearch?: (value: string) => void;
};
/**
* Autocomplete is a normal input element enhanced with a list of options that are
* shown when the user starts typing.
*/
export declare const Autocomplete: React.ForwardRefExoticComponent<AutocompleteProps & React.RefAttributes<HTMLDivElement>>;