LoginSignup
1
1

More than 3 years have passed since last update.

Material-UI の Dialogのスタイルを変更する方法

Posted at

はじめに

Material-UIで画像をモーダルで表示したい時に、やり方を探したのでメモとして残します。

やり方

PaperPropsにstyleを渡す。

import { Dialog } from "@material-ui/core";

...
const [showingDialog, setShowingDialog] = useState(false);
...

<Dialog
  onClose={() => setShowingDialog(false)}
  open={showingDialog}
  scroll="body"
  PaperProps={{
    style: {
      backgroundColor: "transparent",
      boxShadow: "none",
      textAlign: "center",
    },
  }}
>
  <img src="image url" />
</Dialog>
...
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1