@acusti/dropdown
Version:
React component that renders a dropdown with a trigger and supports searching, keyboard access, and more
79 lines (70 loc) • 2.16 kB
Flow
/**
* Flowtype definitions for Dropdown
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.20.1
* @flow
*/
import * as React from 'react';
export type Item = {|
element: HTMLElement | null,
event: Event | SyntheticEvent<HTMLElement>,
label: string,
value: string,
|};
export type Props = {|
/**
* Boolean indicating if the user can submit a value not already in the
* dropdown.
*/
allowCreate?: boolean,
/**
* Boolean indicating if the user can submit an empty value (i.e. clear
* the value). Defaults to true.
*/
allowEmpty?: boolean,
/**
* Can take a single React element or exactly two renderable children.
*/
children: ChildrenTuple | React.Node,
className?: string,
disabled?: boolean,
/**
* Group identifier string links dropdowns together into a menu
* (like macOS top menubar).
*/
group?: string,
hasItems?: boolean,
isOpenOnMount?: boolean,
isSearchable?: boolean,
keepOpenOnSubmit?: boolean,
label?: string,
/**
* Only usable in conjunction with {isSearchable: true}.
* Used as search input’s name.
*/
name?: string,
onClick?: (event: SyntheticMouseEvent<HTMLElement>) => mixed,
onClose?: () => mixed,
onMouseDown?: (event: SyntheticMouseEvent<HTMLElement>) => mixed,
onMouseUp?: (event: SyntheticMouseEvent<HTMLElement>) => mixed,
onOpen?: () => mixed,
onSubmitItem?: (payload: Item) => void,
/**
* Only usable in conjunction with {isSearchable: true}.
* Used as search input’s placeholder.
*/
placeholder?: string,
style?: {| [string]: string | number |},
/**
* Only usable in conjunction with {isSearchable: true}.
* Used as search input’s tabIndex.
*/
tabIndex?: number,
/**
* Used as search input’s value if props.isSearchable === true
* Used to determine if value has changed to avoid triggering onSubmitItem if not
*/
value?: string,
|};
declare type ChildrenTuple = [React.Node, React.Node];
declare export default function Dropdown(x: Props): React.Node;