UNPKG

2.21 kBTypeScriptView Raw
1import * as React from 'react';
2import { StandardProps } from '..';
3import { ModalProps } from '../Modal';
4import { SlideProps } from '../Slide';
5import { PaperProps } from '../Paper';
6import { Theme } from '../styles/createTheme';
7import { TransitionHandlerProps, TransitionProps } from '../transitions/transition';
8
9export interface DrawerProps
10 extends StandardProps<
11 ModalProps & Partial<TransitionHandlerProps>,
12 DrawerClassKey,
13 'open' | 'children'
14 > {
15 /**
16 * Side from which the drawer will appear.
17 */
18 anchor?: 'left' | 'top' | 'right' | 'bottom';
19 /**
20 * The contents of the drawer.
21 */
22 children?: React.ReactNode;
23 /**
24 * The elevation of the drawer.
25 */
26 elevation?: number;
27 /**
28 * Props applied to the [`Modal`](/api/modal/) element.
29 */
30 ModalProps?: Partial<ModalProps>;
31 /**
32 * Callback fired when the component requests to be closed.
33 *
34 * @param {object} event The event source of the callback.
35 */
36 onClose?: ModalProps['onClose'];
37 /**
38 * If `true`, the drawer is open.
39 */
40 open?: boolean;
41 /**
42 * Props applied to the [`Paper`](/api/paper/) element.
43 */
44 PaperProps?: Partial<PaperProps>;
45 /**
46 * Props applied to the [`Slide`](/api/slide/) element.
47 */
48 SlideProps?: Partial<SlideProps>;
49 /**
50 * The duration for the transition, in milliseconds.
51 * You may specify a single timeout for all transitions, or individually with an object.
52 */
53 transitionDuration?: TransitionProps['timeout'];
54 /**
55 * The variant to use.
56 */
57 variant?: 'permanent' | 'persistent' | 'temporary';
58}
59
60export type DrawerClassKey =
61 | 'root'
62 | 'docked'
63 | 'paper'
64 | 'paperAnchorLeft'
65 | 'paperAnchorRight'
66 | 'paperAnchorTop'
67 | 'paperAnchorBottom'
68 | 'paperAnchorDockedLeft'
69 | 'paperAnchorDockedTop'
70 | 'paperAnchorDockedRight'
71 | 'paperAnchorDockedBottom'
72 | 'modal';
73
74/**
75 * The props of the [Modal](https://material-ui.com/api/modal/) component are available
76 * when `variant="temporary"` is set.
77 * Demos:
78 *
79 * - [Drawers](https://material-ui.com/components/drawers/)
80 *
81 * API:
82 *
83 * - [Drawer API](https://material-ui.com/api/drawer/)
84 */
85export default function Drawer(props: DrawerProps): JSX.Element;