Navigation Snippets — Free HTML CSS JS Copy-Paste Nav Components

55 navigation components · Hamburger, Tabs, Breadcrumb, Dropdown, Bottom Nav, Animated Tabs, Stepper, Accordion, Drawer, Tooltip · Exports to React, Vue, Angular & Tailwind

Share & Support

What's included

Features

12 navigation components covering every production navigation pattern
Hamburger nav: 3-span CSS × animation + backdrop-filter blur + ESC/click-outside close
Tab bar: margin-bottom: -2px border overlap trick for connected active indicator
Breadcrumb: CSS li+li::before separator, semantic ol/li, aria-current="page" — zero JS
Dropdown: scale(0.97)+opacity animation, closest() click-outside, ESC keydown close
Animated tabs: offsetLeft/offsetWidth sliding pill, CSS left+width transition
Stepper: done/active/pending states, connecting line fill, boundary guards
Bottom nav: data-page routing, fadeIn page panels, independent badge counter
CSS tooltip: content: attr(data-tip) pseudo-element, 4 directions — zero JavaScript

About this tool

Navigation Snippets — Free Menus, Tabs, Breadcrumbs, Drawers, Steppers & More

Navigation is the first UI element users interact with. It determines whether visitors can find what they need — and directly affects bounce rate, session depth, and task completion rate. Poorly built navigation (menu items that do not close, menus that cover clickable content, tabs that do not indicate the active state) creates frustration. Well-built navigation feels invisible. This collection covers every navigation pattern used in production web products.

Every snippet is plain HTML, CSS, and minimal vanilla JavaScript. No library dependencies — just copy and paste.

Hamburger Navigation animates three span elements into an × on open: the top span translates down and rotates 45°, the middle span fades out, the bottom span translates up and rotates -45°. The menu panel uses backdrop-filter: blur(12px) for a frosted glass effect. Click-outside and ESC key close the menu. The animation is pure CSS — the JavaScript only toggles the .open class.

Tab Bar uses the border-bottom: -2px margin overlap trick for the active indicator. The active tab button has border-bottom: 2px solid accent — identical to the container's border. A negative margin-bottom: -2px pulls it 2px down so it overlaps and hides the container's bottom border, creating a connected tab-to-panel appearance with no JavaScript positioning.

Dropdown Menu uses scale(0.97) + opacity: 0 as the hidden state and scale(1) + opacity: 1 as the open state. CSS transition handles the animation. Click-outside detection uses e.target.closest(".dropdown") — if the click was outside the dropdown container, the menu closes. ESC keydown also closes it. Both escape paths prevent the menu from being stuck open.

Animated Tabs renders a sliding pill indicator that moves to the selected tab. moveIndicator() reads btn.offsetLeft and btn.offsetWidth — the actual pixel position and width of the clicked tab — and sets CSS left and width on the indicator element. CSS transition: left 0.2s, width 0.2s animates the pill. This works for any tab label length without hardcoded positions.

Bottom Navigation implements iOS-style page switching with data-page attributes. Clicking a nav item deactivates all items, activates the clicked item, hides all pages, and shows the page matching the data-page value. A badge counter on one item increments independently.

Breadcrumb uses the CSS li+li::before combinator to insert a separator character (/) before every list item except the first — no JS, no extra HTML, no separator elements. aria-current="page" marks the current page for screen readers.

Stepper shows three states per step: done (filled circle with checkmark), active (accent ring with pulsing outer glow), and pending (grey circle). The connecting lines between steps fill in as each step completes. Navigation guards prevent advancing if the current step is incomplete.

Side Drawer slides in from the left via translateX(-100%) → translateX(0). An overlay backdrop appears simultaneously and clicking it closes the drawer. ESC also closes. A push effect option shifts the main content right instead of overlaying it.

Accordion FAQ, Scroll Progress Bar, Context Menu, and CSS Tooltip complete the collection with the remaining critical navigation patterns.

Real-world uses

Common Use Cases

Mobile-first and responsive navigation patterns
Hamburger nav for responsive sites that collapse to a slide-down mobile menu. Bottom navigation for mobile apps and PWAs following iOS/Android tab bar conventions. Both work natively on touch devices without any JavaScript library or gesture library.
Web application routing and section navigation
Animated tabs for settings panels, dashboard sections, and content-switching views. Side drawer for secondary navigation and context menus. Dropdown for account menus, action lists, and any trigger-on-click sub-menu pattern.
Study CSS navigation techniques that work without JS
Breadcrumb teaches the li+li::before CSS combinator separator trick — zero HTML, zero JavaScript. CSS tooltip teaches content: attr(data-tip) pseudo-element dynamic content. Tab bar teaches the negative margin border overlap that creates a connected tab appearance.
Multi-step checkout flows, onboarding wizards, and setup guides
Stepper for e-commerce checkout (cart → shipping → payment → confirm), SaaS onboarding (account → profile → billing → launch), and software setup flows. Accordion FAQ for progressive disclosure on help pages, documentation, and feature explanation sections.
Context menus, tooltips, and right-click interactions
Context menu for right-click file managers, data table row actions, and desktop-style application interfaces. CSS tooltip for labelling icon-only buttons and providing inline help text. Both handle viewport edge clamping to prevent overflow off-screen.
Accessible navigation with keyboard support and ARIA markup
All navigation components use semantic HTML (nav, ol, button) with correct ARIA attributes. Keyboard navigation works on every component — Tab to focus, Enter to activate, ESC to close menus, Arrow keys to move through dropdown items. Screen readers receive meaningful state announcements.

Got questions?

Frequently Asked Questions

Breadcrumb and CSS Tooltip need zero JavaScript — they are pure HTML and CSS. The li+li::before combinator inserts the breadcrumb separator automatically. The tooltip uses content: attr(data-tip) to read text from a data attribute. Scroll Progress Bar needs only 4 lines of JS (window scroll event + width percentage). All other components need minimal vanilla JavaScript for open/close state management.

Add aria-expanded="false" to the burger button element and toggle it to "true" when the menu opens. Add aria-controls="nav-menu" pointing to the nav ul id. Add aria-label="Toggle navigation" so screen readers announce the button purpose. When the menu opens, move focus to the first menu item. When the menu closes (ESC or click-outside), return focus to the burger button. Trap focus inside the open menu on mobile.

moveIndicator() reads btn.offsetLeft (the button's left position relative to its parent) and btn.offsetWidth (the button's actual pixel width) at the moment of the click — not hardcoded values. It sets the indicator's CSS left and width to match. CSS transition: left 0.2s, width 0.2s animates the pill smoothly between positions. This works for any label length, any font size, and any number of tabs without needing to recalculate anything.

Yes. Every component has a JSX export button. The Hamburger Nav exports with onClick replacing inline onclick and useState managing the open boolean. The Animated Tabs uses useRef for the indicator element and useEffect to run moveIndicator on mount for the default active tab. The Dropdown uses useEffect to add and remove the click-outside document event listener, cleaning it up on unmount. The Side Drawer passes an onClose prop for the overlay click handler.