Morphing Navbar
Web (React)
A premium, scroll-aware header that dynamically adjusts its layout density and logo scale based on scroll position.
A premium, scroll-aware navigation header that dynamically adjusts its layout, logo scale, and background density as the user scrolls. Part of the Premium UI series.
Installation
CLI
npx @modus-ui/cli add morphing-navbarManual
- Copy the code from the component tab.
- Create a file at
components/ui/morphing-navbar.tsx. - Paste the code.
Usage
tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | "Morphing Navbar" | The title text displayed next to the logo. |
logo | ElementType | GraduationCap | The icon component to display as the logo. |
breadcrumbSteps | Step[] | [] | Array of breadcrumb steps to display in expanded mode. |
onHomeClick | () => void | - | Called when the home button is clicked. |
onProfileClick | () => void | - | Called when the profile avatar is clicked. |
onToggleSidebar | () => void | - | Called when the sidebar toggle is clicked. |
sidebarOpen | boolean | false | Whether the sidebar is open (sets the mobile toggle icon). |
scrollThreshold | number | 36 | Scroll distance in pixels before morphing to collapsed state. |
targetId | string | - | Optional ID of a scrollable container to track instead of the window. |
Comments