Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Material UI - Facing an issue that drop down options are coming below the modal window footer

Hi I am using material ui and react select . I am facing an issue that my drop-drown options are showing below the modal window.

Here is the codesandbox link

dropdown option are coming below the modal footer

I tried z-index and change the position value to absolute but did not get the success. Please help.

like image 787
Prabhat Kumar Avatar asked Sep 15 '19 17:09

Prabhat Kumar


People also ask

How do I remove MUI modal border?

Set the outline: 'none' to your paper instead. That will fix your problem. Also, i think that you should be using <Dialog> instead, as recommended in docs. You will keep your behavior without that focus.

How do I make material UI dialog full screen?

You just need to add fullScreen flag to modal component in order to achieve full screen. And if you don't want to use fullScreen, simply remove that fullScreen flag and don't need to use CSS here.

What is modal in material UI?

The modal component provides a solid foundation for creating dialogs, popovers, lightboxes, or whatever else. The component renders its children node in front of a backdrop component. The Modal offers important features: 💄 Manages modal stacking when one-at-a-time just isn't enough.


1 Answers

This happens because of overflow-y rule in two places: the dialog paper, and the dialog content. simply use material-ui styling to override this rules:

import { makeStyles } from '@material-ui/core/styles';

const useStyles = makeStyles({
  paperFullWidth: {
    overflowY: 'visible'
  },
  dialogContentRoot: {
    overflowY: 'visible'
  }
});

And than apply this classes to your component:

const classes = useStyles();
   ...
<Dialog
        ...
        fullWidth={true}
        classes={{
          paperFullWidth: classes.paperFullWidth
        }}
      >
  ...
 <DialogContent
        classes={{
          root: classes.dialogContentRoot
        }}

You can refer this CodeSandbox demo

like image 166
Ido Avatar answered Nov 15 '22 08:11

Ido