react-smart-select
Version:
A very flexible and smart React select component
38 lines (34 loc) • 1.28 kB
TypeScript
import React, { ReactNode, SyntheticEvent, CSSProperties } from 'react';
type RSSLabel = string | ReactNode;
type RSSOption = {
label: RSSLabel;
value: any;
[key: string]: any;
};
type RSSOptions = Array<RSSOption>;
type RSSValue = RSSOptions | RSSOption | null;
type EvtHandler = (evt?: Event | SyntheticEvent) => void;
type FormatLabel = (value: RSSValue, options: RSSOptions) => RSSLabel;
type FormatOption = (option: RSSOption, selected: boolean) => RSSLabel;
type ChangeHandler = (value: RSSValue, selected?: RSSOption, options?: RSSOptions) => void;
type SelectProps = {
onChange: ChangeHandler;
options: RSSOptions;
value?: RSSValue;
placeholder?: RSSLabel;
className?: string;
style?: CSSProperties;
labelStyle?: CSSProperties;
dropdownStyle?: CSSProperties;
optionStyle?: CSSProperties;
formatLabel?: FormatLabel;
formatOption?: FormatOption;
disabled?: boolean;
multi?: boolean;
toggle?: boolean;
};
interface StyleProps {
readonly open: boolean;
}
declare const _default: React.NamedExoticComponent<SelectProps>;
export { ChangeHandler, EvtHandler, FormatLabel, FormatOption, RSSLabel, RSSOption, RSSOptions, RSSValue, SelectProps, StyleProps, _default as default };