Overview
TheNavLink interface represents a navigation link item used throughout the application’s navigation components. It provides a simple structure for defining menu items with labels and routing paths.
Type Definition
source/types.ts:3-6
Properties
The display text for the navigation link that appears in the UI.
The route path for navigation. Should be a valid React Router path (e.g.,
/, /nosotros, /blog).Usage Examples
Basic Navigation Links
The most common usage ofNavLink is in the site navigation configuration:
source/data/data.tsx:44-49
Usage in Navbar Component
TheNavLink interface is imported and used in the Navbar component to type the navigation links:
source/components/Navbar.tsx:4-64
Related Types
- Service - Contains more complex navigation data for solutions pages
- BlogPost - Used for blog navigation and routing
Best Practices
Use meaningful labels
Use meaningful labels
Keep labels concise and descriptive. They should clearly indicate the page destination.
Use consistent path format
Use consistent path format
Always use absolute paths starting with
/ for consistency with React Router.Keep navigation arrays flat
Keep navigation arrays flat
TypeScript Notes
- Both properties are required (no optional fields)
- The interface is exported from
types.tsfor use throughout the application - Can be used in arrays for multiple navigation items
- Compatible with React Router’s
NavLinkandLinkcomponents