简体   繁体   English

如何在Material-UI中更改抽屉的位置?

[英]How to change position of drawer in material-ui?

Change the position of the drawer in material-ui 在material-ui中更改抽屉的位置

I am trying to apply paddingLeft styling to the drawer. 我正在尝试将paddingLeft样式应用于抽屉。

For some reason, My code is not working. 由于某种原因,我的代码无法正常工作。 Any chance anyone has any idea whats happening here? 有人可能对这里发生的事情有任何把握吗?

  <Drawer
        containerStyle={{paddingLeft:50}}
        className="app-sidebar-content"
        variant={type}
        open={type.includes("temporary") ? navCollapsed : true}
        onClose={this.props.onToggleCollapsedNav}
        classes={{
          paper: "side-nav"
        }}
      >
        <UserInfo />

      </Drawer>

Using the modal element of the CSS API, you can achieve what you are looking for: 使用CSS API的模式元素,您可以实现所需的功能:

<Drawer
  open={xxx}
  onClose={yyy}
  classes={{
     paper: classes.paper,
     modal: classes.modal
  }}
>...</Drawer>

then 然后

const styles = {
  modal: {
    paddingLeft: 50,
  },
}

Ref: https://material-ui-next.com/api/drawer/ 参考: https : //material-ui-next.com/api/drawer/

Which version are you using? 您正在使用哪个版本?

With the latest version of material-ui, you can pass classes object and style the component hierarchy. 使用最新版本的material-ui,您可以传递classes对象并设置组件层次结构的样式。

Hope this helps ! 希望这可以帮助 !

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM