MUI's default ThemeProvider
always expects complete theme
object to override at any child level.
ThemeOptionsProvider
ThemeOptions
at each level in Component TreeuseThemeOptions().setThemeOptions()
Also Implements Responsive Font Sizes
ThemeOptionsProvider
import { ThemeOptionsProvider } from "mui-extended"; // wrap all child components const component = ( <ThemeOptionsProvider themeOptions={themeOptions}> {children} </ThemeOptionsProvider> );
useThemeOptions
to update the theme from inside the child components
import { useThemeOptions } from "mui-extended"; import { ThemeOptions } from "@mui/material"; // within the child component const { setThemeOptions } = useThemeOptions(); const newThemeOptions: ThemeOptions = { palette: { primary: { main: "#0000ff" } } }; setThemeOptions(newThemeOptions); // updates primary main color to "#0000ff"
pallete.mode
palette.primary.main
components.MuiTextField.defaultProps.variant
components.MuiFormControl.defaultProps.size
Write an email to opensource@sodaru.com