Skip to content

Instantly share code, notes, and snippets.

@jfrumar
Created October 29, 2025 22:02
Show Gist options
  • Select an option

  • Save jfrumar/0c58f183938dcc8c9c63d869fc467424 to your computer and use it in GitHub Desktop.

Select an option

Save jfrumar/0c58f183938dcc8c9c63d869fc467424 to your computer and use it in GitHub Desktop.
Quick instructions for running up Next.js with MUI

Quick setup

Installing Next.js

  • pnpm create next-app@latest my-app --yes
  • cd my-app
  • pnpm dev

Installing MUI

Deps

pnpm add @mui/material @emotion/react @emotion/styled @fontsource/roboto @mui/icons-material @mui/material-nextjs @emotion/cache

MUI

Integrate MUI:

  • Add theme file app/theme.ts:
'use client';
import { createTheme } from '@mui/material/styles';

const theme = createTheme({
    palette: {
        mode: 'dark',
    },
    typography: {
        fontFamily: 'var(--font-roboto)',
    },
});

export default theme;
  • Add theming to app.layout.tsx:
import { Roboto } from 'next/font/google';
import { ThemeProvider } from '@mui/material/styles';
import theme from '../theme';
const roboto = Roboto({
  weight: ['300', '400', '500', '700'],
  subsets: ['latin'],
  display: 'swap',
  variable: '--font-roboto',
});

 export default function RootLayout(props) {
   const { children } = props;
   return (
    <html lang="en" className={roboto.variable}>
       <body>
           <ThemeProvider theme={theme}>
              {children}
           </ThemeProvider>
       </body>
     </html>
   );
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment