1.1.7 • Published 2 years ago

mui-themex v1.1.7

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Use

import {withThemex, useThemex, toggleTheme, isDarkMode} from 'mui-themex'
import {ThemeProvider} from '@mui/material/styles';
import CssBaseline from "@mui/material/CssBaseline"
import { Button, Box } from '@mui/material';


const Child = () => {
  return <Box bgcolor="background.paper">
    <Button onClick={toggleTheme}>Toggle Theme</Button>
  </Box>
}

const App = ({theme}) => {
  
  return (
      <ThemeProvider theme={theme}>
        <CssBaseline />
        <Child />
        <Box bgcolor="background.paper">
          <Button onClick={toggleTheme}>Toggle Theme</Button>
        </Box>
      </ThemeProvider>
  );
};

export default withThemex(App, 'light', (theme) => ({}))

WithThemex

withThemex(ComponentType, defaultMode, customize)
ComponentType

React component

defaultMode
Callback or 'dark' | 'light'

callback: () => 'dark' | 'light'
customize
Customize the theme.

argument type: callback | object

callback: (oldTheme) => material ui theme object
object: material ui theme object

AutoSave

Just add Property in the customize option

{
  autoSave: true
}
1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.1

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago