Next.js + Material UI
Google's Material Design components (MUI v9). This page shows exactly what pickstack adds to a Next.js project for Material UI: the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.
$ npm create pickstack@latest my-app -- --framework next --modules mui --yesCustomize in the configurator
Packages it adds
| Package | Version | Type |
|---|---|---|
@emotion/cache | ^11.14.0 | runtime |
@emotion/react | ^11.14.0 | runtime |
@emotion/styled | ^11.14.1 | runtime |
@mui/material | ^9.6.0 | runtime |
@mui/material-nextjs | ^9.6.0 | runtime |
New files
"use client";
import { createTheme } from "@mui/material/styles";
const theme = createTheme({
cssVariables: true,
});
export default theme;
Changes to existing files
⋯ 2 unchanged lines <section className="page"> <h1 className="title">About</h1> <p className="text">+ Built with Next.js (App Router), React 19, TypeScript, Material UI.− Built with Next.js (App Router), React 19, TypeScript. </p> </section> );⋯ 2 unchanged lines
+import CssBaseline from "@mui/material/CssBaseline";+import { ThemeProvider } from "@mui/material/styles";+import { AppRouterCacheProvider } from "@mui/material-nextjs/v16-appRouter"; import type { Metadata } from "next"; import Link from "next/link";+import theme from "@/theme"; import "./globals.css"; export const metadata: Metadata = {⋯ 5 unchanged lines return ( <html lang="en"> <body>+ <AppRouterCacheProvider>+ <ThemeProvider theme={theme}>+ <CssBaseline />+ <main className="app">+ <nav className="nav">+ <Link className="link" href="/">+ Home+ </Link>+ <Link className="link" href="/about">+ About+ </Link>+ </nav>+ {children}+ </main>+ </ThemeProvider>+ </AppRouterCacheProvider>− <main className="app">− <nav className="nav">− <Link className="link" href="/">− Home− </Link>− <Link className="link" href="/about">− About− </Link>− </nav>− {children}− </main> </body> </html> );⋯ 2 unchanged lines
"use client"; +import Button from "@mui/material/Button";+import Card from "@mui/material/Card";+import CardActions from "@mui/material/CardActions";+import CardContent from "@mui/material/CardContent";+import Typography from "@mui/material/Typography"; import { useState } from "react"; export default function Counter() { const [count, setCount] = useState(0); return (+ <Card variant="outlined" sx={{ minWidth: 240, textAlign: "center" }}>+ <CardContent>+ <Typography variant="h6" component="h2">+ Counter+ </Typography>+ <Typography+ variant="h3"+ component="p"+ sx={{ fontWeight: 700, fontVariantNumeric: "tabular-nums" }}− <div className="card">− <p className="count">{count}</p>− <div className="row">− <button− type="button"− className="btn"− onClick={() => setCount((n) => n - 1)} >+ {count}+ </Typography>+ </CardContent>+ <CardActions sx={{ justifyContent: "center", pb: 2 }}>+ <Button variant="outlined" onClick={() => setCount((n) => n - 1)}> -1+ </Button>+ <Button variant="contained" onClick={() => setCount((n) => n + 1)}>− </button>− <button− type="button"− className="btn"− onClick={() => setCount((n) => n + 1)}− > +1+ </Button>+ </CardActions>+ </Card>− </button>− </div>− </div> ); }
Project files
.gitignoreREADME.mdapp/about/page.tsxapp/globals.cssapp/layout.tsxapp/page.tsxcomponents/Counter.tsxnext.config.tspackage.jsontheme.tstsconfig.json