Skip to main content
Version: 1.0.3

Navbar

The Navbar component is a versatile and animated navigation bar that supports multiple styles, animations, and layouts. Built with Framer Motion, it offers smooth animations and various interactive features including submenu support and spotlight effects.

Installation

ignix add component navbar

Usage

Import the component:

import { Navbar } from '@ignix-ui/navbar';

Basic Usage

function BasicNavbar() {
return (
<Navbar variant="default" size="md">
<div className="flex gap-4">
<Button>Home</Button>
<Button>About</Button>
<Button>Contact</Button>
</div>
</Navbar>
);
}

Responsive Navigation

Create a responsive navigation bar that adapts to different screen sizes:

import { useState } from 'react';
import { Menu, X } from 'lucide-react';

function ResponsiveNavbar() {
const [isOpen, setIsOpen] = useState(false);

return (
<Navbar variant="default" size="md">
<div className="flex justify-between w-full">
<div className="flex gap-4 items-center">
<Button>Logo</Button>
</div>

{/* Mobile menu button */}
<button
className="md:hidden"
onClick={() => setIsOpen(!isOpen)}
>
{isOpen ? <X /> : <Menu />}
</button>

{/* Desktop menu */}
<div className="hidden md:flex gap-4">
<Button>Home</Button>
<Button>About</Button>
<Button>Contact</Button>
</div>

{/* Mobile menu */}
{isOpen && (
<div className="absolute top-16 left-0 right-0 bg-white md:hidden">
<div className="flex flex-col gap-2 p-4">
<Button>Home</Button>
<Button>About</Button>
<Button>Contact</Button>
</div>
</div>
)}
</div>
</Navbar>
);
}

Props

PropTypeDefaultDescription
variant'default' | 'dark' | 'transparent' | 'glass' | 'gradient' | 'primary''default'Visual style variant of the navbar
size'sm' | 'md' | 'lg' | 'xl''md'Height of the navbar
animationType'slide' | 'glow' | 'basic' | 'spotlight' | 'hoverSubmenu' | 'clickSubmenu''slide'Type of entrance or interaction animation
direction'horizontal' | 'vertical''horizontal'Layout direction of the navbar items
headerstring-Header text, primarily used with submenu variants
submenuContentReact.ReactNode-Content to display in the submenu dropdown
weight'light' | 'normal' | 'medium' | 'semibold' | 'bold''semibold'Font weight of the navbar text
align'left' | 'center' | 'right''left'Text alignment within the navbar
textColor'default' | 'muted' | 'primary' | 'secondary' | 'accent' | 'white''default'Color variant for the navbar text
classNamestring-Additional CSS classes to apply to the root element
childrenReact.ReactNode-Content to be displayed inside the navbar
All Framer Motion propsHTMLMotionProps<"nav">-Supports standard Framer Motion animation and layout props