Navigation is the top-level navigation bar used by Layout. It renders a dark header with a brand logo link and three route links — /, /features, and /about — using React Router for client-side navigation.
Source
src/components/Navigation.tsx
How it works
The component uses two different React Router APIs:Link— for the brand logo. A plain client-side link, no active-state styling needed.NavLink— for the route links.NavLinkexposes anisActiveboolean in its render function andclassNamecallback, which the component uses to applybg-white/10highlight to the currently active route.
Button with variant="ghost" and text-white so it appears as a white text button on the dark bg-gray-800 header.
Routes covered
| Label | Path | Page component |
|---|---|---|
| Home | / | HomePage |
| Features | /features | FeaturesPage |
| About | /about | AboutPage |
src/routes/AppRoutes.tsx.
Relationship with AppRoutes
Navigation links and route definitions must stay in sync:- Every path in
AppRoutes.tsxthat you want users to reach from the nav needs a corresponding entry in theNavigationlink array. - Every path in the array must point to a route that exists in
AppRoutes.tsx.
Navigation is a separate component (rather than inline JSX in Layout) to keep concerns separated. The layout shell handles structure; the navigation component handles which links to show.
How to add a new link
When you add a new route, add a matching entry to the navigation array inNavigation.tsx.
How to customize
Change the header background
Replacebg-gray-800 on the <header> element with any Tailwind color:
Change link styles
The active-state highlight is set via theisActive flag in both the NavLink className callback and the inner Button className. Update bg-white/10 and hover:bg-gray-700 to match your design:
Add icons to links
Pair each label with an icon fromlucide-react, which is already a dependency in this template:
Move Navigation to a sidebar
Navigation is rendered as a direct child of the outer flex-col container in Layout. To move it to a sidebar, change the outer container to flex-row in Layout.tsx and adjust the nav’s width and height styles:
src/components/Layout.tsx