Navbar
Top horizontal navigation. Logo + links + actions; supports search bar and mobile-collapsible variant.
Overview
The Navbar component is a core building block of the Byteion design system, providing a robust, accessibility-compliant interface for its specific UI capabilities.
Why this exists
The navbar is the primary horizontal navigation. It anchors the app identity, provides top-level section access, and often houses global actions (search, notifications, user menu).
Mental model
A navbar is a fixed or sticky top bar with app branding, primary navigation links, and global actions. It should remain consistent across all pages.
When to use
When not to use
Basic example
The following example demonstrates standard usage, fully compliant with Byteion's token-first approach.
import { Button, Navbar, NavbarBrand, NavbarNav, NavbarActions } from '@byteion/react';
const items = [
{ label: 'Dashboard', href: '/', active: true },
{ label: 'Projects', href: '/projects' },
{ label: 'Team', href: '/team' },
{ label: 'Settings', href: '/settings' },
];
export default function NavbarDemo() {
return (
<Navbar>
<NavbarBrand href="/"><strong>Byteion</strong></NavbarBrand>
<NavbarNav items={items} />
<NavbarActions>
<Button variant="ghost" size="sm">Sign in</Button>
<Button size="sm">Get started</Button>
</NavbarActions>
</Navbar>
);
}
<script setup lang="ts">
import { Button, Navbar, NavbarBrand, NavbarNav, NavbarActions } from '@byteion/vue';
const items = [
{ label: 'Dashboard', href: '/', active: true },
{ label: 'Projects', href: '/projects' },
{ label: 'Team', href: '/team' },
{ label: 'Settings', href: '/settings' },
];
</script>
<template>
<Navbar>
<NavbarBrand href="/"><strong>Byteion</strong></NavbarBrand>
<NavbarNav :items="items" />
<NavbarActions>
<Button variant="ghost" size="sm">Sign in</Button>
<Button size="sm">Get started</Button>
</NavbarActions>
</Navbar>
</template>
Variants
Each variant communicates a different meaning. Choose based on priority, not aesthetics.
Single default variant.
Sizes
Size should match the importance and context of the component.
- md — md size.
States
This component reacts seamlessly to the following interaction and data states:
- default — Resting appearance before interaction.
- hover — Pointer is over the element — visual feedback via color or shadow.
- focus — Keyboard or tab focus — shows ring indicator for accessibility.
- active — Currently selected or in use.
- disabled — Non-interactive — grayed out, cursor not-allowed.
Anatomy
Usage guidelines
- Keep nav links under 7.
- Make the active page visually clear.
- Keep the navbar consistent across pages.
Do and Don't
Do
- Highlight active page.
- Keep links concise.
- Maintain consistency.
Don't
- Do not exceed 7 nav links.
- Do not change navbar between pages.
- Do not put page-specific nav here — use tabs or sidebar.
Accessibility
Uses <nav> with aria-label. Active link has aria-current="page".
Role:navigation
Customization
Height, background, and border follow layout tokens.
Compose with React cva()
Use the exportedcva() +cn() utilities to compose your own variant on top of the Byteion tokens.
import { cva, cn, type VariantProps } from '@byteion/react';
const myNavbar = cva('base classes…', {
variants: {
accent: { soft:'border-primary-200', loud:'border-primary-500' },
},
defaultVariants: { accent:'soft' },
});
type Props = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof myNavbar>;
Compose with Vue cva()
Use the exportedcva() +cn() utilities inside standard Vue setup blocks.
<script setup lang="ts">
import { computed, useAttrs } from 'vue';
import { cva, type VariantProps } from '@byteion/vue';
interface Props { accent?:'soft' |'loud' }
const props = withDefaults(defineProps<Props>(), { accent:'soft' });
const attrs = useAttrs();
const myNavbar = cva('base classes…', {
variants: { accent: { soft:'border-primary-200', loud:'border-primary-500' } },
});
const cls = computed(() => myNavbar({ accent: props.accent, class: attrs.class as string | undefined }));
</script>
Runtime events
Byteion keeps framework APIs idiomatic: HTML uses DOM custom events, React uses callback props, and Vue uses emitted events / v-model updates.
HTML / JS events
No HTML runtime events are declared by this adapter.
React callbacks
No React callback events are declared by this adapter.
Vue emits
No Vue emitted events are declared by this adapter.
Remote / AJAX
This component does not implement Byteion JS remote loading. Use normal HTML form submission, framework state, or your application data layer around it.
API Reference
Static HTML composition.
HTML Data Attributes
No custom data attributes required.
React Props · NavbarProps
Extracted directly fromreact/src/components/Navbar.tsx.
export interface NavbarProps extends HTMLAttributes<HTMLElement> {
/** Visual style. */
variant?: 'default' | 'glass' | 'plain';
/** Stick to the top of the viewport. */
sticky?: boolean;
children?: ReactNode;
}
Vue Props · NavbarProps
Extracted directly fromvue/src/components/Navbar.vue.
export interface NavbarProps {
variant?: 'default' | 'glass' | 'plain';
sticky?: boolean;
}
Developer tips
aria-label="Search" on the input — placeholder is not a replacement.Common mistakes
Production usage tips
- Test desktop and mobile layouts — navbar should collapse at
smbreakpoint. - Test sticky behavior during scroll — verify
sticky top-4 z-30does not overlap with content. - Test keyboard tab order — brand → nav links → search → actions → user menu should flow logically.
- Test active link state on every route — verify
aria-current="page"is correctly applied. - Test search accessibility —
aria-label, visible focus ring, and form submission. - Test user Dropdown and notification actions — Dropdown must be keyboard accessible.
- Test dark mode and branded themes — all tokens (
bg-card,text-foreground,border-border) adapt automatically. - Keep React and Vue output aligned with the core HTML composition — Brand → Nav → Spacer → Actions pattern.
Premium examples
Advanced patterns available in Byteion Pro:
Related components
Unlock Premium Patterns
Get access to copy-paste ready Pro blocks, SaaS templates, and advanced data-tables built with this component.
Explore Pro Components