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
| Token | Variable | Value |
|---|---|---|
links | CrystalNavLink[] | (required) |
logo | ReactNode | AC logomark |
logoHref | string | '/' |
position | 'fixed' | 'sticky' | 'static' | 'fixed' |
mobileBreakpoint | number | 768 |
mobileVariant | 'drawer' | 'fullscreen' | 'dropdown' | 'drawer' |
cta | ReactNode | — |
transparent | boolean | false |
blur | boolean | true |
disableEntrance | boolean | false |
isOpen | boolean | — |
onMenuOpen | () => void | — |
onMenuClose | () => void | — |
respectReducedMotion | boolean | true |
Values update live with theme changes. Click any row to copy the CSS variable.
CrystalNavLink Type
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 />Custom Logo
<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:
| Timeline | Trigger | Effect |
|---|---|---|
| Entrance | Page load | Logo blur-to-sharp + links stagger fade-in |
| Hamburger | Toggle click | Three-line to X morph |
| Drawer | Menu open/close | Right-side slide with link stagger |
| Link hover | Mouse enter/leave | Animated underline (desktop only) |
All animations respect prefers-reduced-motion and clean up automatically via useGSAP.
Sub-Components
| Component | Purpose |
|---|---|
CrystalNavLogo | Logo wrapper with link and entrance animation |
CrystalNavLink | Individual link with animated underline |
CrystalNavHamburger | Animated hamburger/X toggle button |
CrystalNavDrawer | Slide-out mobile navigation panel |
These are used internally by CrystalNav but can also be imported individually for custom navigation layouts.