Components
Navbar
A horizontal top bar for brand, links and actions.
Installation
$ npx veil-ui@latest add navbarUsage
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
Scrollable content area
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| sticky | boolean | false | Pins the bar to the top of the viewport. |
| bordered | boolean | true | Adds a bottom border and backdrop blur. |
| ...props | React.ComponentProps<"header"> | — | All native header attributes. |
Accessibility
- Use a
<header>landmark and keep the brand link first. - Wrap links in a
<nav>with anaria-labelwhen 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>