Navbar

A customizable navigation bar component with support for branding, navigation items, actions, and toggle functionality.

Installation

1. Dependencies

npm install clsx tailwind-merge

2. Paste inside @/lib/utils.ts

import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";

export function cn(...inputs: Parameters<typeof clsx>) {
  return twMerge(clsx(...inputs));
}

3. Copy Navbar Code

Loading...

Copy Navbar Code

Nav Props

NameTypeRequiredDefaultDescription
variant"default" | "bordered" | "floating"No"default"The visual style of the navbar.
stickybooleanNofalseDetermines if the navbar should stick to the top of the page when scrolling.
classNamestringNoundefinedAdditional class names for styling the navbar.
childrenReact.ReactNodeYesundefinedContent to be displayed inside the navbar.

NavContainer Props

NameTypeRequiredDefaultDescription
classNamestringNoundefinedAdditional class names for styling the navbar container.
childrenReact.ReactNodeYesundefinedContent to be displayed inside the navbar container.

NavContent Props

NameTypeRequiredDefaultDescription
classNamestringNoundefinedAdditional class names for styling the navbar content.
childrenReact.ReactNodeYesundefinedContent to be displayed inside the navbar content area.

NavBrand Props

NameTypeRequiredDefaultDescription
classNamestringNoundefinedAdditional class names for styling the navbar brand section.
childrenReact.ReactNodeYesundefinedContent to be displayed inside the navbar brand section.

NavItems Props

NameTypeRequiredDefaultDescription
classNamestringNoundefinedAdditional class names for styling the navbar items container.
childrenReact.ReactNodeYesundefinedNavigation items to be displayed inside the navbar.

NavItem Props

NameTypeRequiredDefaultDescription
hrefstringYesundefinedThe URL the navigation item links to.
activebooleanNofalseIndicates if the navigation item is active.
classNamestringNoundefinedAdditional class names for styling the navigation item.
childrenReact.ReactNodeYesundefinedContent to be displayed inside the navigation item.

NavActions Props

NameTypeRequiredDefaultDescription
classNamestringNoundefinedAdditional class names for styling the navbar actions container.
childrenReact.ReactNodeYesundefinedAction buttons or elements to be displayed inside the navbar.

NavToggle Props

NameTypeRequiredDefaultDescription
onClick() => voidYesundefinedCallback function triggered when the toggle button is clicked.
classNamestringNoundefinedAdditional class names for styling the toggle button.
aria-labelstringNo"Toggle Menu"Accessible label for the toggle button.