Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to center Dialog title in MUI?

How can I center the DialogTitle (MUI)? My code:

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

  Dialog boby...
</Dialog>

title with text "Ingreso de Procedimientos" centered please

like image 503
Simplicio Carcamo Avatar asked Mar 10 '16 20:03

Simplicio Carcamo


3 Answers

I believe this is the shortest way in MUI v5. It is possible because DialogTitle returns a styled Typography which leverages system properties.

<DialogTitle textAlign="center">

Live Demo

Codesandbox Demo

like image 88
NearHuscarl Avatar answered Nov 06 '22 06:11

NearHuscarl


This works for me:

<Dialog
   titleStyle={{textAlign: "center"}}
   ... />
like image 39
Larry Maccherone Avatar answered Nov 06 '22 07:11

Larry Maccherone


u can just simply use the dialog title component and add typography component in there

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

hope this help :))

like image 3
SKy - Avatar answered Nov 06 '22 08:11

SKy -