suiss/ui
  • Docs
  • Components
  • Patterns
  • Interactions
  • Charts
  • Blocks
GitHubGet started
DocsComponentsPatternsInteractionsChartsBlocks
Blocks56
  • Overview
Bag
  • Checkout
  • Configure
  • Review
Bento
  • Closer Look
  • Features
  • Stats
Chat
  • Conversations
  • Support
  • Thread
Dash
  • Analytics
  • Health
  • Store
Empty
  • Bag
  • Offline
  • Search
Footer
  • Compact
  • Directory
  • Services
Grid
  • Accessories
  • Carousel
  • Lineup
Hero
  • Cinematic
  • Product
  • Tiles
Inbox
  • Categories
  • Mail
  • Support
Log
  • Activity
  • Live
  • Security
Login
  • Account
  • Passkey
  • Sheet
Nav
  • Categories
  • Global
  • Local
Onboarding
  • Onboarding
Permission
  • Primer
Price
  • Bundle
  • Care
  • Storage
Roles
  • Editor
  • Matrix
  • Requests
Settings
  • Account
  • Device
  • Notifications
Signup
  • Form
  • Steps
  • Trial
Users
  • Detail
  • Invite
  • Table
Verify
  • Code
  • Device
  • Email

suiss/ui · Block

Nav Local

A sticky product sub-navigation that highlights the section in view, shown on a dark product page.

Nav Local is an open-source block from suiss/ui for React. The @esuiss/ui CLI copies its source into your project, so you own the code.

components/blocks/nav-local.tsx
"use client"

import * as React from "react"

import { Navbar } from "@/components/patterns/navbar"
import { Button } from "@/components/ui/button"

const images = {
  hero: "https://images.unsplash.com/photo-1714972384975-fbd4f19b1bb3?w=1600&q=80&auto=format&fit=crop",
  detail:
    "https://images.unsplash.com/photo-1695083691065-4f77dfd0f0d5?w=1600&q=80&auto=format&fit=crop",
}

type Section = { id: string; label: string }

const sections: [Section, ...Section[]] = [

A sticky product sub-navigation with the product name on the left and section links and a Buy button on the right, underlining the link for the section in view. The bar gains a blurred background once the page scrolls, and the links collapse into a full-screen menu when space runs out. It renders dark and comes with a sample page of three sections. Use it under a global nav on long product or feature pages.

Installation

CLI

$ pnpm dlx shadcn@latest add @esuiss/nav-local

Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add blocks nav-local

Manual

  1. Add the pieces it builds on: Button, Navbar.

  2. Copy the source into components/blocks/nav-local.tsx:

components/blocks/nav-local.tsx
"use client"

import * as React from "react"

import { Navbar } from "@/components/patterns/navbar"
import { Button } from "@/components/ui/button"

const images = {
  hero: "https://images.unsplash.com/photo-1714972384975-fbd4f19b1bb3?w=1600&q=80&auto=format&fit=crop",
  detail:
    "https://images.unsplash.com/photo-1695083691065-4f77dfd0f0d5?w=1600&q=80&auto=format&fit=crop",
}

type Section = { id: string; label: string }

const sections: [Section, ...Section[]] = [
  1. Update the import paths to match your project.

Usage

import { NavLocal } from "@/components/blocks/nav-local"
<NavLocal />

Edit sections; each id must match an element on your page, because an IntersectionObserver picks the active link from the section in view. Replace the sample sections, highlights and images with your own content, and give Buy a handler.

Notes

Images are Unsplash placeholders.

NextOnboardingPreviousNav Global

On this page

  1. 01Installation
    • CLI
    • Manual
  2. 02Usage
  3. 03Notes