Layout is the root-level wrapper for all pages in this template. React Router renders it as the parent route element, and each page renders inside it via <Outlet />.
Structure
The component is a full-height flex column with three sections stacked vertically:Navigation
Fixed at the top. Renders links to all routes.
Main
Grows to fill remaining height. Renders the active page via
<Outlet />.Footer
Fixed at the bottom. Displays the current year and template credit.
Source
src/components/Layout.tsx
How it works
The Outlet
<Outlet /> is a React Router placeholder that renders the component matched by the current URL. When a user visits /features, React Router replaces <Outlet /> with <FeaturesPage />.
This means you never render <Layout> directly in a page component. Instead, you define it as the element of the root route in src/routes/AppRoutes.tsx:
src/routes/AppRoutes.tsx
CSS breakdown
| Element | Classes | Effect |
|---|---|---|
Outer div | min-h-screen flex flex-col bg-gray-50 | Full viewport height, column flex, light gray background |
main | grow container mx-auto p-4 md:p-8 | Expands to fill space, centered, responsive padding |
footer | bg-gray-200 p-4 text-center text-gray-600 border-t | Gray bar pinned to bottom with a top border |
Footer
The footer renders the current year dynamically usingnew Date().getFullYear(), so it stays up to date without manual changes.
How to customize
Change the background color
Replacebg-gray-50 on the outer div with any Tailwind background class:
Adjust the main content padding
Edit thep-4 md:p-8 classes on the main element:
Update the footer content
Replace the footer’s children with your own text or JSX:Swap out the navigation
The<Navigation /> component is imported at the top. You can replace it with your own component or extend Navigation.tsx directly. See Navigation for details.
Adding a new page
When you add a new route toAppRoutes.tsx as a child of the root route, Layout automatically wraps it. You don’t need to touch Layout.tsx itself.
Add a nav link
Add a link to the new route in
src/components/Navigation.tsx so users can reach it. See Navigation.