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
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
55 lines
2.3 KiB
Markdown
55 lines
2.3 KiB
Markdown
# Material UI - Next.js Pages Router example
|
||
|
||
## How to use
|
||
|
||
Download the example [or clone the repo](https://github.com/mui/material-ui):
|
||
|
||
<!-- #target-branch-reference -->
|
||
|
||
```bash
|
||
curl https://codeload.github.com/mui/material-ui/tar.gz/master | tar -xz --strip=2 material-ui-master/examples/material-ui-nextjs-pages-router
|
||
cd material-ui-nextjs-pages-router
|
||
```
|
||
|
||
Install it and run:
|
||
|
||
```bash
|
||
npm install
|
||
npm run dev
|
||
```
|
||
|
||
or:
|
||
|
||
<!-- #target-branch-reference -->
|
||
|
||
[](https://stackblitz.com/github/mui/material-ui/tree/master/examples/material-ui-nextjs-pages-router)
|
||
|
||
[](https://codesandbox.io/p/sandbox/github/mui/material-ui/tree/master/examples/material-ui-nextjs-pages-router)
|
||
|
||
## The idea behind the example
|
||
|
||
**Note:** This example is set up to use the Next.js Pages Router.
|
||
As of Next.js 13.4, the newer App Router pattern is stable.
|
||
We recommend starting new projects with the [Material UI with Next.js (App Router) example](https://github.com/mui/material-ui/tree/master/examples/material-ui-nextjs) unless you need (or prefer) the Pages Router.
|
||
|
||
<!-- #host-reference -->
|
||
|
||
The project uses [Next.js](https://github.com/vercel/next.js), which is a framework for server-rendered React apps.
|
||
It includes `@mui/material` and its peer dependencies, including [Emotion](https://emotion.sh/docs/introduction), the default style engine in Material UI.
|
||
If you prefer, you can [use styled-components instead](https://mui.com/material-ui/integrations/interoperability/#styled-components).
|
||
|
||
## The Link component
|
||
|
||
<!-- #target-branch-reference -->
|
||
<!-- #host-reference -->
|
||
|
||
The [example folder](https://github.com/mui/material-ui/tree/HEAD/examples/material-ui-nextjs-pages-router) provides an adapter for the use of [Next.js's Link component](https://nextjs.org/docs/pages/api-reference/components/link) with Material UI.
|
||
More information [in the documentation](https://mui.com/material-ui/integrations/routing/#next-js-pages-router).
|
||
|
||
## What's next?
|
||
|
||
<!-- #host-reference -->
|
||
|
||
You now have a working example project.
|
||
You can head back to the documentation and continue by browsing the [templates](https://mui.com/material-ui/getting-started/templates/) section.
|