Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

cieloazul310/gatsby-material-ui-darkmode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gatsby MUI dark mode example

Gatsby MUI dark mode example

How to use

$ git clone [email protected]:cieloazul310/gatsby-material-ui-darkmode.git
$ cd gatsby-material-ui-darkmode

# develop
$ yarn run develop

# build
$ yarn run build

Toggle color mode

import * as React from 'react';
import Button from '@mui/material/Button';
import ColorModeContext from './ColorModeContext';

function ToggleButton() {
  const colorMode = React.useContext(ColorModeContext);
  return (
    <Button onClick={colorMode.toggleColorMode}>
      Toggle Color Mode
    </Button>
  );
}