Skip to main content
  • Foundation
  • Color palette
  • Typography
  • Icons
  • Golden ratio
  • Grid system
  • Shadows & glow
  • Motion
  • Theme
  • Theme switcher
  • Color rosette
  • Theme customizer
  • Core
  • Button
  • Badge
  • Alert
  • Card
  • Dropdown
  • Menu
  • Popover
  • Doc Search
  • Global Search
  • Floating Action Button
  • Ripple
  • Expanding Cards
  • Spotlight
  • Timeline
  • Template
  • Navigation
  • Feedback
  • Modal
  • Toast
  • Tooltip
  • Chip
  • Skeleton
  • Preloader
  • Data display
  • Avatar
  • Table
  • Collection
  • Breadcrumb
  • Interactive
  • Tabs
  • Accordion
  • Flow
  • Draggable
  • Search
  • Canvas
  • Charts
  • Flowchart
  • Media
  • Image Box
  • Effects
  • Glass
  • Surfaces
  • Morph
  • Parallax
  • Liquid Gradient
  • Forms
  • Form controls
  • Login
  • Form validation
  • Datepicker
  • Timepicker
  • Rating
  • Switch
  • Slider
  • Stepper
  • Autocomplete
  • Transfer
  • Tree
  • Pagination
  • Button group
  • Primitives
  • Progress
  • Spinner
  • Code snippet
  • Layout
  • Primitives
  • Separator
  • Sidenav
  • Sticky
  • Waypoint (Scrollspy)
  • Off-canvas
  • Navbar
  • Oola Dock
  • Footer
Navbar

VdNavbar is a responsive top navigation bar with brand, default, and actions slots, a built-in mobile hamburger + slide-in menu, optional dropdowns, and scroll-aware glass/transparent framing. It emits open/close/toggle and exposes imperative open() / close() / toggle() controls.

Live Demo

A real <VdNavbar> (rendered position="static" so it stays inside the card). Narrow the viewport to reveal the hamburger and slide-in menu.

Brand
  • Home
  • Docs
  • About

Mobile menu is closed (from the @toggle event).

Dark Theme (dark prop)
VD3 UI
  • Home
  • Features
  • Pricing
Floating glass capsule

This is the docs shell recipe shipped by the package: variant="glass" + float + position="fixed" (or sticky). Transparent at rest; frosted once scrolled. Toggle the site theme — light and dark use the same translucent white frost (dark stays near-transparent so the capsule never reads as grey fog).

VD3 UI
  • Docs
  • Effects

Light / dark: scrolled glass always paints rgba(255,255,255,<opacity>) — opacity ~0.42 in light, ~0.08 in dark — plus specular rim. Do not swap in --vd-glass-bg-dark for navbar chrome.

<script setup lang="ts">
import { VdNavbar } from "@vanduo-oss/vd3";
</script>

<template>
  <VdNavbar variant="glass" position="fixed" float>
    <template #brand>
      <a href="/">VD3 UI</a>
    </template>
    <ul class="vd-navbar-nav">
      <li><a class="vd-nav-link active" href="/">Docs</a></li>
      <li><a class="vd-nav-link" href="/effects">Effects</a></li>
    </ul>
  </VdNavbar>
</template>
<!-- Docs shell pattern — float + glass (package CSS; no site overrides) -->
<nav class="vd-navbar vd-navbar-fixed vd-navbar-float vd-navbar-glass">
  <div class="vd-navbar-container">…</div>
</nav>

<!-- Same via VdNavbar -->
<VdNavbar variant="glass" position="fixed" float>
  <template #brand>…</template>
  <ul class="vd-navbar-nav">…</ul>
</VdNavbar>
Usage

Compose the bar with the three named slots. The default slot is the collapsible menu — drop a .vd-navbar-nav list inside it:

<script setup lang="ts">
import { VdNavbar } from "@vanduo-oss/vd3";
</script>

<template>
  <VdNavbar position="sticky">
    <template #brand>
      <a href="/">VD3 UI</a>
    </template>

    <!-- Default slot: the collapsible menu content -->
    <ul class="vd-navbar-nav">
      <li><a class="vd-nav-link active" href="/">Home</a></li>
      <li><a class="vd-nav-link" href="/docs">Docs</a></li>
      <li><a class="vd-nav-link" href="/about">About</a></li>
    </ul>

    <template #actions>
      <button class="vd-btn vd-btn-primary vd-btn-sm">Sign in</button>
    </template>
  </VdNavbar>
</template>
Nested Dropdowns

Wrap a nav item in .vd-navbar-dropdown with a .vd-navbar-dropdown-menu child. Below the collapse breakpoint the parent link toggles the submenu instead of navigating:

<VdNavbar>
  <ul class="vd-navbar-nav">
    <li><a class="vd-nav-link active" href="/">Home</a></li>
    <li class="vd-navbar-dropdown">
      <a class="vd-nav-link" href="#">Products</a>
      <div class="vd-navbar-dropdown-menu">
        <a class="vd-navbar-dropdown-item" href="/app">App</a>
        <a class="vd-navbar-dropdown-item" href="/api">API</a>
      </div>
    </li>
  </ul>
</VdNavbar>
CSS Variables
VariableDefault
--vd-navbar-bgvar(--vd-color-white)
--vd-navbar-text-colorvar(--vd-text-primary)
--vd-navbar-link-colorvar(--vd-text-primary)
--vd-navbar-link-hover-colorvar(--vd-color-primary)
--vd-navbar-link-active-colorvar(--vd-color-primary)
--vd-navbar-height3.4375rem (55px, fib)
--vd-navbar-padding-x1.3125rem (21px, fib)
--vd-navbar-nav-gap1.3125rem (21px, fib)
--vd-navbar-actions-gap2.125rem (34px, fib)
--vd-navbar-mobile-menu-width233px (fib)
--vd-navbar-float-insetResponsive fib inset (8 → 13 → 21px by breakpoint)
--vd-navbar-float-radius2.125rem (34px fib capsule)
--vd-navbar-glass-specular0.58 light / 0.38 dark (inset highlight alpha)
--vd-navbar-glass-elevationSoft drop shadow under the frosted capsule (theme-tuned in dark)
API Reference

Props

PropTypeDescription
variant"solid" | "transparent" | "glass"Surface treatment (default "solid"). glass/transparent gain scroll-activated framing (the .vd-navbar-scrolled class engages once you scroll past the threshold). variant="glass" ships the perfected liquid frost (light + dark — translucent white wash, never grey fog).
darkbooleanApplies the dark navbar theme (.vd-navbar-dark). Orthogonal to variant. Default false. Prefer page theme + variant="glass" for frosted chrome; dark is for solid inverse bars.
position"static" | "fixed" | "fixed-bottom" | "sticky"Positioning modifier (default "static"). fixed / fixed-bottom / sticky attach the bar to the viewport.
floatbooleanOpt-in floating capsule (.vd-navbar-float): Fibonacci inset from the viewport edges + large radius + optical vertical padding. Pair with variant="glass" and position fixed/sticky. Default false (edge-to-edge — back-compat).
scrollThresholdnumberScroll distance in px before .vd-navbar-scrolled engages for glass/transparent variants (default: component-resolved).
toggleLabelstringAccessible label for the mobile hamburger toggle (default "Toggle navigation").
closeOnNavigatebooleanClose the mobile menu when a non-dropdown nav link is clicked (default true).

Events

EventPayloadDescription
open—Emitted when the mobile menu opens.
close—Emitted when the mobile menu closes.
toggleopen: booleanEmitted on every open/close with the new menu state.

Slots

SlotDescription
brandBrand / logo area, rendered inside .vd-navbar-brand. Omitted from the DOM when empty.
defaultThe collapsible menu content — place your <ul class="vd-navbar-nav"> here. Rendered inside .vd-navbar-menu.
actionsTrailing CTA area (buttons, theme switcher…), rendered inside .vd-navbar-actions. Omitted when empty.

Exposed (template ref)

MemberDescription
isOpenReactive boolean reflecting the mobile-menu open state.
open()Imperatively open the mobile menu.
close()Imperatively close the mobile menu.
toggle()Imperatively toggle the mobile menu.

CSS Classes (slot content)

ClassDescription
.vd-navbar-navList wrapper for a group of navigation links (place in the default slot).
.vd-nav-linkIndividual link within the menu. Append .active for the current route.
.vd-navbar-dropdownWraps a nav item that owns a nested menu; below the breakpoint its link toggles the submenu instead of navigating.
.vd-navbar-dropdown-menuContainer for the nested dropdown items (add .is-open is handled for you on mobile).
.vd-navbar-dropdown-itemIndividual link inside a dropdown menu.
.vd-navbar-floatInset floating capsule for fixed/sticky top bars (Fibonacci margin + large radius + optical padding). Works with .vd-navbar-glass.
.vd-navbar-glassSeemore frosted chrome: translucent white wash, saturate blur, inset specular rim (CodePen-inspired). Same frost recipe in light and dark — dark stays near-transparent (no grey fog). Scroll-activated with .vd-navbar-scrolled.

Composable API (useNavbarGlassScroll)

import { ref } from "vue";
import { useNavbarGlassScroll } from "@vanduo-oss/vd3";

const navbarEl = ref<HTMLElement | null>(null);
// Returns Ref<boolean> (true when window.scrollY exceeds data-scroll-threshold or navbar height)
const isScrolled = useNavbarGlassScroll(navbarEl);
Symbol / AttributeDescription
useNavbarGlassScroll(navbarRef)Composable for custom <nav class="vd-navbar vd-navbar-glass"> or .vd-navbar-transparent elements; returns Ref<boolean> indicating whether window.scrollY has passed the scroll threshold.
data-scroll-thresholdOptional pixel threshold attribute on the navbar element read by useNavbarGlassScroll (falls back to navbar.offsetHeight || 60).
Accessibility
  • VdNavbar renders a semantic <nav> landmark.
  • The mobile hamburger button sets :aria-label="toggleLabel" (default "Toggle navigation") and :aria-expanded="isOpen".
  • Pressing Escape closes open dropdown menus and the mobile navigation drawer.
  • Clicking outside the navbar or activating a navigation link (when closeOnNavigate is true) automatically closes the mobile menu and releases body scroll lock.