How can I place title center on CardHeader (Material-UI)?
I am using Material-UI v0.18.7
Here is my code. I tried with textAlign: 'center' to titleStyle prop but that doesn't work.
const myTheme = {
cardHeaderStylePref:{
background: 'linear-gradient(to right bottom, #430089, #82ffa1)',
color: config.actualWhite,
height: 30,
padding: 0
}
}
<Card>
<CardHeader
title={this.props.prefName}
style={myTheme.cardHeaderStylePref}
subtitleColor={myTheme.color}
titleColor={myTheme.color}
titleStyle={{textAlign: 'center'}}
>
</CardHeader>
<CardText>
Sample text
</CardText>
</Card>
Use css style textAlign to move title center
style={{ textAlign: 'center' }}
Instead of doing inline styling, passing a class name should be a good option.
<CardHeader title="Subscribe" className={classes.heading} />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With