Skip to main content
Our new developer certification is live!

UtilityLink

Reusable utility navigation link component. Handles both internal and external links.

Props

PropTypeRequiredDefaultDescription
linkUtilityNavItemYes-Utility navigation link data
classNamestringNo-CSS classes
onClick() => voidNo-Click handler

Usage

import { UtilityLink } from '@/components/layout/UtilityLink';

<UtilityLink
  link={utilityNavItem}
  className="hover:text-text-default-strong"
  onClick={() => closeMenu()}
/>

Features

  • Smart routing: Uses Next.js Link for internal routes, <a> for external
  • External link handling: Proper target and rel attributes
  • Simple API: Minimal props for easy reuse

Behavior

  • Returns null if href is missing or '#'
  • Detects external links by checking if href starts with 'http' or target is '_blank'
  • Applies target and rel attributes for external links
  • Uses Next.js Link component for internal navigation

Notes

  • Used by AnnouncementBar for utility navigation
  • Used by MobileNavigation for utility links in drawer
  • No CSLP support (utility links are typically not editable in Live Preview)
  • Automatically handles link type detection