Drawer API
导入
import Drawer from '@mui/material/Drawer';
// 或
import { Drawer } from '@mui/material';
The props of the Modal component are available
when variant="temporary"
is set.
组件名称
在主题中,名称“MuiDrawer
”可用于提供默认属性(props),或者样式覆盖属性
原生(Native) 组件的属性也是可用的。
名称 | 类型 | 默认值 | 描述 |
---|---|---|---|
anchor | 'bottom' | 'left' | 'right' | 'top' | 'left' | Side from which the drawer will appear. |
children | node | The content of the component. | |
classes | object | Override or extend the styles applied to the component. See CSS API below for more details. | |
elevation | integer | 16 | The elevation of the drawer. |
hideBackdrop | bool | false | If true , the backdrop is not rendered. |
ModalProps | object | {} | Props applied to the Modal element. |
onClose | func | Callback fired when the component requests to be closed. Signature: function(event: object) => void event: The event source of the callback. | |
open | bool | false | Control the popup` open state. |
PaperProps | object | {} | Props applied to the Paper element. |
SlideProps | object | Props applied to the Slide element. | |
sx | Array<func | object | bool> | func | object | The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details. | |
transitionDuration | number | { appear?: number, enter?: number, exit?: number } | { enter: theme.transitions.duration.enteringScreen, exit: theme.transitions.duration.leavingScreen, } | The duration for the transition, in milliseconds. You may specify a single timeout for all transitions, or individually with an object. |
variant | 'permanent' | 'persistent' | 'temporary' | 'temporary' | The variant to use. |
ref
则会被传递到根元素中。CSS
规则名称 | 全局类名 | 描述 |
---|---|---|
root | .MuiDrawer-root | Styles applied to the root element. |
docked | .MuiDrawer-docked | Styles applied to the root element if variant="permanent or persistent" . |
paper | .MuiDrawer-paper | Styles applied to the Paper component. |
paperAnchorLeft | .MuiDrawer-paperAnchorLeft | Styles applied to the Paper component if anchor="left" . |
paperAnchorRight | .MuiDrawer-paperAnchorRight | Styles applied to the Paper component if anchor="right" . |
paperAnchorTop | .MuiDrawer-paperAnchorTop | Styles applied to the Paper component if anchor="top" . |
paperAnchorBottom | .MuiDrawer-paperAnchorBottom | Styles applied to the Paper component if anchor="bottom" . |
paperAnchorDockedLeft | .MuiDrawer-paperAnchorDockedLeft | Styles applied to the Paper component if anchor="left" and variant is not "temporary". |
paperAnchorDockedTop | .MuiDrawer-paperAnchorDockedTop | Styles applied to the Paper component if anchor="top" and variant is not "temporary". |
paperAnchorDockedRight | .MuiDrawer-paperAnchorDockedRight | Styles applied to the Paper component if anchor="right" and variant is not "temporary". |
paperAnchorDockedBottom | .MuiDrawer-paperAnchorDockedBottom | Styles applied to the Paper component if anchor="bottom" and variant is not "temporary". |
modal | .MuiDrawer-modal | Styles applied to the Modal component. |
您可以使用组件自定义选项对组件进行个性化:
- 具备 全局类名.
- 在自定义主体中,设定一个规则名称作为组件的
styleOverrides
属性的一部分。