UNPKG

1.76 kBTypeScriptView Raw
1import * as React from 'react';
2import { StandardProps } from '..';
3import { InputProps } from '../Input';
4import { NativeSelectInputProps } from './NativeSelectInput';
5
6export interface NativeSelectProps
7 extends StandardProps<InputProps, NativeSelectClassKey, 'inputProps' | 'value' | 'onChange'> {
8 /**
9 * The option elements to populate the select with.
10 * Can be some `<option>` elements.
11 */
12 children?: React.ReactNode;
13 /**
14 * The icon that displays the arrow.
15 */
16 IconComponent?: React.ElementType;
17 /**
18 * An `Input` element; does not have to be a material-ui specific `Input`.
19 */
20 input?: React.ReactElement<any, any>;
21 /**
22 * Attributes applied to the `select` element.
23 */
24 inputProps?: NativeSelectInputProps;
25 /**
26 * Callback function fired when a menu item is selected.
27 *
28 * @param {object} event The event source of the callback.
29 * You can pull out the new value by accessing `event.target.value` (string).
30 * @document
31 */
32 onChange?: NativeSelectInputProps['onChange'];
33 /**
34 * The input value. The DOM API casts this to a string.
35 * @document
36 */
37 value?: unknown;
38 /**
39 * The variant to use.
40 */
41 variant?: 'standard' | 'outlined' | 'filled';
42}
43
44export type NativeSelectClassKey =
45 | 'root'
46 | 'select'
47 | 'filled'
48 | 'outlined'
49 | 'selectMenu'
50 | 'disabled'
51 | 'icon'
52 | 'iconFilled'
53 | 'iconOutlined';
54
55/**
56 * An alternative to `<Select native />` with a much smaller bundle size footprint.
57 * Demos:
58 *
59 * - [Selects](https://mui.com/components/selects/)
60 *
61 * API:
62 *
63 * - [NativeSelect API](https://mui.com/api/native-select/)
64 * - inherits [Input API](https://mui.com/api/input/)
65 */
66export default function NativeSelect(props: NativeSelectProps): JSX.Element;