Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom 'full screen' height for the Material UI Dialog modal component

Currently, I am using the fullScreen property on the Material UI Dialog component (which acts as a modal on the screen) as recommended in the docs, like this:

import useMediaQuery from '@material-ui/core/useMediaQuery';


function MyComponent() {

  const theme = useTheme();

  const fullScreen = useMediaQuery(theme.breakpoints.down('sm'));

  return <Dialog fullScreen={fullScreen} />

}

Unfortunately, this causes the Dialog modal to cover the navbar at the top of the screen. I would like to override the height of the Dialog modal, but I am not sure how.

Is anyone able to help?

like image 618
Jack Joseph Avatar asked Oct 21 '25 19:10

Jack Joseph


1 Answers

Just pass a className to it & give it the top value equal to your AppBar's height. here is the sandbox

like image 148
e.a. Avatar answered Oct 23 '25 09:10

e.a.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!