This is perhaps a simple Material UI Theme Customization question.
What I want to do is to override the default styling on (and other commo
Here is an example of overriding this aspect of CssBaseline
:
import PropTypes from "prop-types";
import { withStyles } from "@material-ui/core/styles";
const styles = theme => ({
"@global": {
body: {
...theme.typography.body1
}
}
});
function MyCssBaseline() {
return null;
}
MyCssBaseline.propTypes = {
classes: PropTypes.object.isRequired
};
export default withStyles(styles)(MyCssBaseline);
import React from "react";
import ReactDOM from "react-dom";
import CssBaseline from "@material-ui/core/CssBaseline";
import MyCssBaseline from "./MyCssBaseline";
function App() {
return (
<>
<CssBaseline />
<MyCssBaseline />
<span>
Here is some text in the body that is getting the body1 styling due to
MyCssBaseline.
</span>
</>
);
}
ReactDOM.render(<App />, document.querySelector("#root"));
Reference: https://material-ui.com/styles/advanced/#global-css