简体   繁体   English

透明可滑动抽屉材质-UI

[英]Transparent Swipeable drawer Material-UI

I need to know how to apply a 'transparent' style porperty background to my SwipeableDrawer component from Material UI... Since the component creates another component in my html file when it renders i cannot change his background from my code. 我需要知道如何从Material UI将“透明”样式的背景应用于我的SwipeableDrawer组件...由于该组件在呈现时在html文件中创建了另一个组件,因此我无法从代码中更改其背景。 I tried to put some , but it seems that the component doesn`t like it. 我试图放一些,但似乎该组件不喜欢它。

Thanks in advance. 提前致谢。

As stated in Material-ui Docs you can override the style of Modal using ModalProps . 如Material-ui Docs中所述,您可以使用ModalProps覆盖Modal的样式。 Using the BackdropProps of Modal you can able to set the background to transparent. 使用ModalBackdropProps ,您可以将背景设置为透明。

Create a styles variable and apply the necessary styles. 创建一个styles变量并应用必要的样式。

 const styles = { BackdropProps: { background: 'transparent' } }; 

Apply the style to the root of Backdrop using classes property 使用classes属性将样式应用于Backdrop的根

 <SwipeableDrawer ModalProps={{ BackdropProps:{ classes:{ root:classes.BackdropProps } } }} {...otherProps}> 

Have a look at overriding components with classes in the docs 看看文档中具有类的重写组件

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

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