reablocks
Version:
Component library for React
85 lines (83 loc) • 2.12 kB
TypeScript
import { SelectTheme } from '../SelectTheme';
import { GroupOptions } from '../utils';
import { SelectOptionProps, SelectValue } from '../SelectOption';
import { default as React, FC, ReactElement } from 'react';
export interface RenderCreateOptionArgs {
text: string;
onCreate: () => void;
}
export interface SelectMenuProps {
/**
* The id of the select.
*/
id?: string;
/**
* Options passed to the select.
*/
options?: SelectOptionProps[];
/**
* The selected option(s).
*/
selectedOption?: SelectOptionProps | SelectOptionProps[];
/**
* Additional CSS styles to apply to the select menu.
*/
style?: React.CSSProperties;
/**
* Whether the menu is disabled or not.
*/
disabled?: boolean;
/**
* The groups of options.
*/
groups?: GroupOptions;
/**
* Whether users can create options or not.
*/
createable?: boolean;
/**
* Function to render the create option.
*/
renderCreateOption?: ({ text, onCreate }: RenderCreateOptionArgs) => ReactElement;
/**
* Additional class names to apply to the select menu.
*/
className?: string;
/**
* Whether the menu can select multiples or not.
*/
multiple?: boolean;
/**
* Internal active index of the keyboard position.
*/
index?: number;
/**
* The input's search text to use for highlighting.
*/
inputSearchText?: string;
/**
* Whether users can filter the options or not.
*/
filterable?: boolean | 'async';
/**
* Whether the component is loading or not.
*/
loading?: boolean;
/**
* The size of the select menu.
*/
size?: 'small' | 'medium' | 'large' | string;
/**
* Icon displayed for checked elements of the list
*/
checkIcon?: any;
/**
* Event fired when the selected option(s) change.
*/
onSelectedChange?: (option: SelectValue) => void;
/**
* The theme for the Select.
*/
theme?: SelectTheme;
}
export declare const SelectMenu: FC<SelectMenuProps>;