如何在Material-UI上设置Dialog标题?

时间:2016-03-10 20:30:52

标签: material-ui

如何在Dialog(Material-UI)上居中标题? Mi代码

<Dialog
   open={this.state.open}
   titleStyle = {styles.Dialog}
   title='Title centered please!'
   actions={standardActions}
   onRequestClose={this.handleRequestClose}
>

Dialog boby..asdasdasd

title with text "Ingreso de Procedimientos" centered please

3 个答案:

答案 0 :(得分:11)

这对我有用:

<Dialog
   titleStyle={{textAlign: "center"}}
   ... />

答案 1 :(得分:0)

u只需使用对话框标题组件并在其中添加印刷字体组件

<DialogTitle>
  <Typography variant="h3" align="center">Centered Title</Typography>
</DialogTitle>

希望获得帮助:))

答案 2 :(得分:0)

所有解决方案都不再有效。试试下面的

 <DialogTitle>
    <label className={"h4 custom-flex-justify-center"}>Add New </label>
</DialogTitle>

并定义custom-flex-justify-center类如下

.custom-flex-justify-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

这也适用于 Material UI 5