2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

React-BootstrapのModalの高さを設定する

2
Posted at

React-BootstrapのModalではダイアログの表示サイズを指定するためにdialogClassNameにCSSクラス名を指定する必要があります。
なお、bootstrapで用意されているCSSクラスでは横幅に影響するCSSクラスしかないため、高さを調整するためには高さを含むCSSクラスを定義し、追加する必要があります。

render() {
  const props = {
    show: true,
    onHide: () => console.log("onHide"),
    dialogClassName: "modal-middle custom-height",  // カスタムCSSクラスを挿す
    tabIndex: -1,
    role: "dialog",
    backdrop: "static"
  };

  return (
    <Modal {...props}>
      <div>content</div>
    </Modal>
  );
}

横幅の指定方法があるのなら高さの指定方法もありそうだと思って探してしまいますが、高さはCSSでなんとかするという方針のようです。

2
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?