Classic Navbar
NewInstallation
npx shadcn@latest add https://uibrik.com/r/classic-navbar.jsonInstall the packages
npm install motionAdd the cn helper
Imports
cnfrom@/lib/utils, whichshadcn initcreates. Add it by hand without shadcn.Copy the source into your project
components/uibrik/classic-navbar/classic-navbar.tsx"use client"; // A full-width bar for any site: a hairline appears under it once the page // scrolls, it steps out of the way while you scroll down and returns as soon // as you scroll up, and an underline slides to the current page. On small // screens the menu is a full-screen sheet that wipes down from under the bar, // with large links rising in one after another. Links sit left, centred or // right; zero, one or two CTAs. import { AnimatePresence, motion, useReducedMotion } from "motion/react"; import { useCallback, useEffect, useId, useState, type ReactNode } from "react"; import { cn } from "@/lib/utils"; const EASE_OUT: [number, number, number, number] = [0.23, 1, 0.32, 1]; const SPRING = { type: "spring", duration: 0.35, bounce: 0 } as const; const FOCUS = "outline-none focus-visible:ring-2 focus-visible:ring-neutral-400 focus-visible:ring-offset-2 focus-visible:ring-offset-background"; export type NavLink = { label: string; href?: string }; export type NavbarProps = { /** Text beside the mark. */
Adds the files to
components/uibrik/classic-navbar and installs motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/classic-navbar.Props
ClassicNavbar- align
- Type "left" | "center" | "right"
- "left"
- Where the links sit: beside the logo, centred, or beside the CTAs.
- ctas
- Type "none" | "one" | "two"
- "two"
- How many call-to-action buttons.
- brand
- Type string
- "Acme"
- Text beside the mark.
- links
- Type string[]
- ["Product","Features","Pricing","Customers","Docs"]
- Link labels, in order.
- primaryLabel
- Type string
- "Get started"
- Label of the main button.
- secondaryLabel
- Type string
- "Sign in"
- Label of the quieter button.
- hideOnScroll
- Type boolean
- true
- Slide out of view while scrolling down; come back on scroll up.
- logo
- Type ReactNode
- –
- Your own logo; replaces the default mark.
- current
- Type string
- –
- Label of the current page's link.
- primaryHref / secondaryHref
- Type string
- –
- Where the CTAs go.
- className
- Type string
- –
- Classes for the header.
- maxWidth
- Type number
- 1120
- Width of the content inside the bar, in px.
- onNavigate
- Type (label) => void
- –
- Called when a link is chosen, for client-side routing.