UNPKG

@react-md/autocomplete

Version:

Create an accessible autocomplete component that allows a user to get real-time suggestions as they type within an input. This component can also be hooked up to a backend API that handles additional filtering or sorting.

58 lines (57 loc) 1.68 kB
import { CSSProperties, ReactElement, ReactNode } from "react"; export interface HighlightedResultProps { /** * An optional id to use for the `<span>`. This will be suffixed by the * current `index` if it was provided */ id?: string; /** * An optional style to provide to the `<span>`. */ style?: CSSProperties; /** * An optional className to provide to the `<span>`. */ className?: string; /** * The match index which is automatically added when the `repeatable` prop is * used for nested matches. */ index?: number; /** * The current value to match against. */ value: string; /** * Boolean if the highlighting functionality should be enabled. Setting this * to false will just return the `children` instead. */ enabled?: boolean; /** * Boolean if the highlighting can be repeated multiple times within the * children string. */ repeatable?: boolean; /** * The children to highlight. If this is not a string, the highlight will not * work. */ children: ReactNode; } /** * The `HighlightedResult` component can be used to bold specific letters * within the `children` if the `children` is a string. */ export declare function HighlightedResult({ id: propId, style, className, enabled, value, children, repeatable, index, }: HighlightedResultProps): ReactElement; export declare namespace HighlightedResult { var propTypes: { id: any; index: any; value: any; style: any; className: any; children: any; enabled: any; repeatable: any; }; }