Files
react-test/examples/material-ui-nextjs-ts-v4-v5-migration
how2ice 005cf56baf
Some checks failed
No response / noResponse (push) Has been cancelled
CI / Continuous releases (push) Has been cancelled
CI / test-dev (macos-latest) (push) Has been cancelled
CI / test-dev (ubuntu-latest) (push) Has been cancelled
CI / test-dev (windows-latest) (push) Has been cancelled
Maintenance / main (push) Has been cancelled
init project
2025-12-12 14:26:25 +09:00
..
2025-12-12 14:26:25 +09:00
2025-12-12 14:26:25 +09:00
2025-12-12 14:26:25 +09:00
2025-12-12 14:26:25 +09:00
2025-12-12 14:26:25 +09:00
2025-12-12 14:26:25 +09:00
2025-12-12 14:26:25 +09:00
2025-12-12 14:26:25 +09:00
2025-12-12 14:26:25 +09:00

Material UI and Next.js example with @mui/styles (in TypeScript)

How to use

Download the example or clone the repo:

curl https://codeload.github.com/mui/material-ui/tar.gz/master | tar -xz --strip=2  material-ui-master/examples/material-ui-nextjs-ts-v4-v5-migration
cd material-ui-nextjs-ts-v4-v5-migration

Install it and run:

npm install
npm run dev

or:

Edit on StackBlitz

Edit on CodeSandbox

The idea behind the example

The project uses Next.js, which is a framework for server-rendered React apps. It includes @mui/material and its peer dependencies, including Emotion, the default style engine in Material UI. If you prefer, you can use styled-components instead.

It also includes @mui/styles, the legacy styling solution that uses JSS as an engine. It provides all the necessary config for working with both Emotion and JSS for server-side rendering. The project is intended as a basic starter for migrating your application from v4 to v5, as it lets the JSS style overrides take precedence over the default styles passed to the components by Emotion. It demonstrates what results after handling v5's breaking changes to the theme and components.

Next.js Pages Router has a custom Link component. The example folder provides adapters for usage with Material UI. You can find more information in the documentation.