I want to create a custom document for my new nextjs 13 project and use custom design system package. The package requires custom documents in the page directory as the nextjs official doc guided. However, there is no documents for custom document in app directory structure in nextjs 13.
I want to create a custom document for my new nextjs 13 project and use custom design system package. The package requires custom documents in the page directory as the nextjs official doc guided. However, there is no documents for custom document in app directory structure in nextjs 13.
Share Improve this question asked Aug 21, 2023 at 12:46 SkySky 4021 gold badge6 silver badges15 bronze badges 01 Answer
Reset to default 7You can create a app/layout.tsx
(which is called root layout) if you are using app
router.
The root layout replaces the _app.js
and _document.js
files from pages
router.
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}
The root layout is defined at the top level of the app directory and applies to all routes. This layout enables you to modify the initial HTML returned from the server.
https://nextjs/docs/app/building-your-application/routing/pages-and-layouts#root-layout-required
If you are not using TypeScript, you can use the name: app/layout.js
.