Veil UI
Components

Navbar

A horizontal top bar for brand, links and actions.

Installation

$ npx veil-ui@latest add navbar

Usage

import { Navbar } from "@/components/ui/navbar";

<Navbar>
  <a href="/" className="font-semibold">
    Acme
  </a>
  <nav aria-label="Main" className="ml-auto flex gap-4 text-sm">
    <a href="/docs">Docs</a>
    <a href="/pricing">Pricing</a>
  </nav>
</Navbar>;

Examples

Basic

Sticky

Sticky barStays at the top while the page scrolls
Scrollable content area

API reference

PropTypeDefaultDescription
stickybooleanfalsePins the bar to the top of the viewport.
borderedbooleantrueAdds a bottom border and backdrop blur.
...propsReact.ComponentProps<"header">—All native header attributes.

Accessibility

  • Use a <header> landmark and keep the brand link first.
  • Wrap links in a <nav> with an aria-label when several navigations coexist on the page.

Vue and plain HTML

This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add navbar --framework vue or switch the framework in components.json.

<script setup lang="ts">
import { cn } from "@/lib/utils";

import type { NavbarProps } from "./types";

defineOptions({ inheritAttrs: false });

const props = withDefaults(defineProps<NavbarProps>(), {
  sticky: false,
  bordered: true,
});
</script>

<template>
  <header
    data-slot="navbar"
    v-bind="$attrs"
    :class="
      cn(
        'mx-auto flex h-14 w-full max-w-7xl items-center gap-4 bg-background/95 px-4 backdrop-blur sm:px-6',
        bordered && 'border-b',
        sticky && 'sticky top-0 z-40',
        props.class,
      )
    "
  >
    <slot />
  </header>
</template>

On this page