UNPKG

1.58 kBTypeScriptView Raw
1import * as React from 'react';
2import { SxProps } from '@mui/system';
3import { Theme } from '..';
4import { MenuProps } from '../Menu';
5
6/**
7 * The change can be caused by different kind of events.
8 * The type of event depends on what caused the change.
9 * For example, when the browser auto-fills the `Select` you'll receive a `React.ChangeEvent`.
10 */
11export type SelectChangeEvent<Value = string> =
12 | (Event & { target: { value: Value; name: string } })
13 | React.ChangeEvent<HTMLInputElement>;
14
15export interface SelectInputProps<Value = unknown> {
16 autoFocus?: boolean;
17 autoWidth: boolean;
18 defaultOpen?: boolean;
19 disabled?: boolean;
20 error?: boolean;
21 IconComponent?: React.ElementType;
22 inputRef?: (
23 ref: HTMLSelectElement | { node: HTMLInputElement; value: SelectInputProps<Value>['value'] },
24 ) => void;
25 MenuProps?: Partial<MenuProps>;
26 multiple: boolean;
27 name?: string;
28 native: boolean;
29 onBlur?: React.FocusEventHandler<any>;
30 onChange?: (event: SelectChangeEvent<Value>, child: React.ReactNode) => void;
31 onClose?: (event: React.SyntheticEvent) => void;
32 onFocus?: React.FocusEventHandler<any>;
33 onOpen?: (event: React.SyntheticEvent) => void;
34 open?: boolean;
35 readOnly?: boolean;
36 renderValue?: (value: SelectInputProps<Value>['value']) => React.ReactNode;
37 SelectDisplayProps?: React.HTMLAttributes<HTMLDivElement>;
38 sx?: SxProps<Theme>;
39 tabIndex?: number;
40 value?: Value;
41 variant?: 'standard' | 'outlined' | 'filled';
42}
43
44declare const SelectInput: React.JSXElementConstructor<SelectInputProps>;
45
46export default SelectInput;