mui-theme-switcher
A dark mode theme switcher for Material UI
Install
npm install --save mui-theme-switcher
Usage
index.js
)
In App root (example: ;; ;; ReactDOM.render , document.getElementById"root";
App.js
)
In your component (example: ; ;
Props
Prop | Type | Description |
---|---|---|
children | node |
The app which will be themed |
darkTheme | Theme |
Dark variant of the theme. Theme object created using @material-ui 's createMuiTheme |
lightTheme | Theme |
Light variant of the theme. Theme object created using @material-ui 's createMuiTheme |
followSystem | boolean (default false ) |
Whether the App should follow system/browser theme. |
persist | boolean (default false ) |
Whether the App should save the theme locally |
appId | string (Required if using persist ) |
Unique ID of the App. |
defaultTheme | enum "dark" | "light" |
Default theme of the App |
smoothTransition | boolean (default true ) |
Whether to smooth out the transition between themes. This only affects the background color |
License
This hook is created using create-react-hook.