Crystal
Components

CrystalNav

Responsive navigation system with GSAP animations, drawer menu, and fluid scaling.

CrystalNav is a responsive navigation bar built with GSAP timeline animations. It includes a logo, desktop links with animated underlines, a hamburger toggle that morphs to X, and a slide-out drawer for mobile.

Import

import { CrystalNav } from '@artasce/crystal-ui';

Usage

const links = [
  { label: 'Home', href: '/' },
  { label: 'Work', href: '/work', active: true },
  { label: 'About', href: '/about' },
  { label: 'Contact', href: '/contact' },
];

<CrystalNav links={links} />

Props

CrystalNav Props

TokenVariableValue
links
CrystalNavLink[](required)
logo
ReactNodeAC logomark
logoHref
string'/'
position
'fixed' | 'sticky' | 'static''fixed'
mobileBreakpoint
number768
mobileVariant
'drawer' | 'fullscreen' | 'dropdown''drawer'
cta
ReactNode
transparent
booleanfalse
blur
booleantrue
disableEntrance
booleanfalse
isOpen
boolean
onMenuOpen
() => void
onMenuClose
() => void
respectReducedMotion
booleantrue

Values update live with theme changes. Click any row to copy the CSS variable.

interface CrystalNavLink {
  label: string;
  href: string;
  icon?: ReactNode;
  active?: boolean;
  external?: boolean;
}

Examples

With CTA Button

<CrystalNav
  links={links}
  cta={<CrystalMagneticButton variant="solid">Contact</CrystalMagneticButton>}
/>

Transparent Over Hero

<CrystalNav links={links} transparent blur />
<CrystalNav
  links={links}
  logo={<img src="/logo.svg" alt="My Brand" className="h-8" />}
  logoHref="/"
/>

Animation System

CrystalNav uses the useCrystalNavTimelines hook to coordinate four GSAP timelines:

TimelineTriggerEffect
EntrancePage loadLogo blur-to-sharp + links stagger fade-in
HamburgerToggle clickThree-line to X morph
DrawerMenu open/closeRight-side slide with link stagger
Link hoverMouse enter/leaveAnimated underline (desktop only)

All animations respect prefers-reduced-motion and clean up automatically via useGSAP.

Sub-Components

ComponentPurpose
CrystalNavLogoLogo wrapper with link and entrance animation
CrystalNavLinkIndividual link with animated underline
CrystalNavHamburgerAnimated hamburger/X toggle button
CrystalNavDrawerSlide-out mobile navigation panel

These are used internally by CrystalNav but can also be imported individually for custom navigation layouts.