Overview - Layout files (+layout.svelte)
What is it?
In SvelteKit, a +layout.svelte file defines a layout component that wraps pages and other layouts. It lets you create shared UI parts like headers, footers, or navigation that appear on multiple pages. This file automatically applies its layout to all nested routes inside its folder. Layout files help organize your app's structure and avoid repeating code.
Why it matters
Without layout files, you would have to copy the same UI elements on every page, making your app harder to maintain and update. Layouts let you keep common parts in one place, so changes apply everywhere instantly. This saves time, reduces bugs, and makes your app feel consistent and professional.
Where it fits
Before learning layouts, you should understand basic Svelte components and routing in SvelteKit. After mastering layouts, you can explore nested layouts, layout data loading, and advanced page transitions to build complex, smooth user experiences.