Layouts wrap and persist
A layout.tsx wraps every route at and below its segment. The crucial property: layouts persist across navigation. When a user clicks between sibling pages, the layout component does not unmount. Sidebars, navigation, and any state in the layout stay alive.
The required root layout
Every Next.js app needs a root layout at app/layout.tsx. It must render the <html> and <body> tags — nowhere else does. This is where global font, language attribute, and the body class live.
Layout props
Layouts take children (the nested page or layout) and, in v15+, params as a Promise when the layout is inside a dynamic segment.
What layouts can't do
Layouts don't receive searchParams. If a layout depends on the query string, restructure: pass the data through the URL into a Server Component inside the page, not the layout.