UNPKG

2.68 kBTypeScriptView Raw
1import * as React from 'react';
2import { SxProps } from '@mui/system';
3import { InternalStandardProps as StandardProps, Theme } from '..';
4import { ModalProps } from '../Modal';
5import { SlideProps } from '../Slide';
6import { PaperProps } from '../Paper';
7import { TransitionProps } from '../transitions/transition';
8import { DrawerClasses } from './drawerClasses';
9
10export interface DrawerProps extends StandardProps<ModalProps, 'open' | 'children'> {
11 /**
12 * Side from which the drawer will appear.
13 * @default 'left'
14 */
15 anchor?: 'left' | 'top' | 'right' | 'bottom';
16 /**
17 * The content of the component.
18 */
19 children?: React.ReactNode;
20 /**
21 * Override or extend the styles applied to the component.
22 */
23 classes?: Partial<DrawerClasses>;
24 /**
25 * The elevation of the drawer.
26 * @default 16
27 */
28 elevation?: number;
29 /**
30 * Props applied to the [`Modal`](https://mui.com/material-ui/api/modal/) element.
31 * @default {}
32 */
33 ModalProps?: Partial<ModalProps>;
34 /**
35 * Callback fired when the component requests to be closed.
36 * The `reason` parameter can optionally be used to control the response to `onClose`.
37 *
38 * @param {object} event The event source of the callback.
39 * @param {string} reason Can be: `"escapeKeyDown"`, `"backdropClick"`.
40 */
41 onClose?: ModalProps['onClose'];
42 /**
43 * If `true`, the component is shown.
44 * @default false
45 */
46 open?: boolean;
47 /**
48 * Props applied to the [`Paper`](https://mui.com/material-ui/api/paper/) element.
49 * @default {}
50 */
51 PaperProps?: Partial<PaperProps<React.ElementType>>;
52 /**
53 * Props applied to the [`Slide`](https://mui.com/material-ui/api/slide/) element.
54 */
55 SlideProps?: Partial<SlideProps>;
56 /**
57 * The system prop that allows defining system overrides as well as additional CSS styles.
58 */
59 sx?: SxProps<Theme>;
60 /**
61 * The duration for the transition, in milliseconds.
62 * You may specify a single timeout for all transitions, or individually with an object.
63 * @default {
64 * enter: theme.transitions.duration.enteringScreen,
65 * exit: theme.transitions.duration.leavingScreen,
66 * }
67 */
68 transitionDuration?: TransitionProps['timeout'];
69 /**
70 * The variant to use.
71 * @default 'temporary'
72 */
73 variant?: 'permanent' | 'persistent' | 'temporary';
74}
75
76/**
77 * The props of the [Modal](https://mui.com/material-ui/api/modal/) component are available
78 * when `variant="temporary"` is set.
79 *
80 * Demos:
81 *
82 * - [Drawer](https://mui.com/material-ui/react-drawer/)
83 *
84 * API:
85 *
86 * - [Drawer API](https://mui.com/material-ui/api/drawer/)
87 */
88export default function Drawer(props: DrawerProps): React.JSX.Element;