Skip to content

[docs] Update the snippet to use latest Next.js template #45946

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

siriwatknp
Copy link
Member

closes #45922

  • Change the snippet from diff to tsx so that users can copy and paste to their project

@siriwatknp siriwatknp added docs Improvements or additions to the documentation nextjs labels Apr 18, 2025
@@ -175,50 +175,55 @@ Inside the `pages/_document.tsx` file:
- Import `documentGetInitialProps` and use it as the Document's `getInitialProps`.
- Import `DocumentHeadTags` and render it inside the `<Head>`.

```diff title="pages/_document.tsx"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mnajdova diff is hard for copy pasting so I changed to tsx. Do you think this is a better experience? If yes, I will update the App Router guide too.

Copy link
Member

@oliviertassinari oliviertassinari Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Between https://deploy-preview-45946--material-ui.netlify.app/material-ui/integrations/nextjs/#configuration-2 and https://deploy-preview-45944--material-ui.netlify.app/material-ui/integrations/nextjs/#configuration-2 It feels like the diff UX wins with a long shot for my use case: I can't copy and paste the whole demo, I have ton of custom logic in my _document.js, but with a diff, I know what to look at.

The best solution is to have CLI that applies the changes, like Shadcn does, but that's a different story #39588 and #40062.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The best solution is to have CLI that applies the changes, like Shadcn does, but that's a different story #39588 and #40062.

As you said, it's a different story.

For this PR, the change display the smallest snippet to demonstrate the integration. I think it's better than the previous one.

@mui-bot
Copy link

mui-bot commented Apr 18, 2025

Netlify deploy preview

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 412ffdc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation nextjs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[docs] Next.js integration improvements
3 participants