Home > Mobile >  Using z-index in Material UI
Using z-index in Material UI

Time:04-26

check this code please https://stackblitz.com/edit/react-ts-zer8p7?file=modal.js

I have the modal and inside of it the Drawer component. How can i put the Drawer component above the Modal? I tried Z-index but it didn't work.

Thank you

CodePudding user response:

Put the following in your <Drawer> in drawer.js
Make it look like this:

<Drawer
            anchor={anchor}
            open={state[anchor]}
            onClose={toggleDrawer(anchor, false)}
            sx={{ zIndex: 1300}}
          >

and you are good to go.

CodePudding user response:

I don't know where you tried adding z-index but try adding:

MuiDrawer-root{
  z-index:1300;
}

to

style.css

Happy coding :)

  • Related