-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to change the color of CardHeader Title #10779
Comments
👋 Thanks for using Material-UI! We use the issue tracker exclusively for bug reports and feature requests, however, If you would like to link from here to your question on SO, it will help others find it. |
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from 'material-ui/styles';
import CardHeader from 'material-ui/Card';
const styles = theme => ({
title: {
color: 'red',
}
});
class RecipeReviewCard extends React.Component {
render() {
const { classes } = this.props;
return (
<CardHeader
classes={{
title: classes.title,
}}
title="Shrimp and Chorizo Paella"
subheader="September 14, 2016"
/>
);
}
}
RecipeReviewCard.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(RecipeReviewCard); |
Change size and color :
|
is it possible without HOC? |
Yep, works fine in hooks too. const useStyles = makeStyles(() => ({
title: {
color: 'red',
margin: 50,
padding: 60,
fontSize: 300,
}
}));
const classes = useStyles();
<CardHeader className={classes.title} title="Delete My Account - WARNING PERMANENT" /> |
How to use the default theme? I get a error saying theme is not defined. |
Why cant i use this => theme.palette.primary.light |
Do you have the |
I cannot seem to be able to change the color of the CardHeader title text.
I have a 'styles' constant as follows:
And my
React.Component
as follows:The
backgroundColor
is applying to theCardHeader
vialoginCardHeader
but thecolor
is not.The text was updated successfully, but these errors were encountered: