最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Custom 'full screen' height for the Material UI Dialog modal component - Stack Overflow

programmeradmin2浏览0评论

Currently, I am using the fullScreen property on the Material UI Dialog ponent (which acts as a modal on the screen) as remended 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?

Currently, I am using the fullScreen property on the Material UI Dialog ponent (which acts as a modal on the screen) as remended 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?

Share Improve this question asked Sep 10, 2021 at 1:34 Jack JosephJack Joseph 1292 silver badges7 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

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

发布评论

评论列表(0)

  1. 暂无评论