UNPKG

2.19 kBTypeScriptView Raw
1import * as React from 'react';
2import { SxProps } from '@mui/system';
3import { InternalStandardProps as StandardProps, Theme } from '..';
4import { InputProps } from '../Input';
5import { NativeSelectInputProps } from './NativeSelectInput';
6import { NativeSelectClasses } from './nativeSelectClasses';
7
8export interface NativeSelectProps
9 extends StandardProps<InputProps, 'inputProps' | 'value' | 'onChange'> {
10 /**
11 * The option elements to populate the select with.
12 * Can be some `<option>` elements.
13 */
14 children?: React.ReactNode;
15 /**
16 * Override or extend the styles applied to the component.
17 * @default {}
18 */
19 classes?: Partial<NativeSelectClasses>;
20 /**
21 * The icon that displays the arrow.
22 * @default ArrowDropDownIcon
23 */
24 IconComponent?: React.ElementType;
25 /**
26 * An `Input` element; does not have to be a material-ui specific `Input`.
27 * @default <Input />
28 */
29 input?: React.ReactElement<unknown, any>;
30 /**
31 * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attributes) applied to the `select` element.
32 */
33 inputProps?: Partial<NativeSelectInputProps>;
34 /**
35 * Callback fired when a menu item is selected.
36 *
37 * @param {React.ChangeEvent<HTMLSelectElement>} event The event source of the callback.
38 * You can pull out the new value by accessing `event.target.value` (string).
39 */
40 onChange?: NativeSelectInputProps['onChange'];
41 /**
42 * The system prop that allows defining system overrides as well as additional CSS styles.
43 */
44 sx?: SxProps<Theme>;
45 /**
46 * The `input` value. The DOM API casts this to a string.
47 */
48 value?: unknown;
49 /**
50 * The variant to use.
51 */
52 variant?: 'standard' | 'outlined' | 'filled';
53}
54
55/**
56 * An alternative to `<Select native />` with a much smaller bundle size footprint.
57 *
58 * Demos:
59 *
60 * - [Select](https://mui.com/material-ui/react-select/)
61 *
62 * API:
63 *
64 * - [NativeSelect API](https://mui.com/material-ui/api/native-select/)
65 * - inherits [Input API](https://mui.com/material-ui/api/input/)
66 */
67declare const NativeSelect: ((props: NativeSelectProps) => React.JSX.Element) & { muiName: string };
68
69export default NativeSelect;
70
\No newline at end of file