Two-tier navigation in React
A strip of practical details (phone, opening hours) above the main navigation.
Here is an excerpt of this component's code in React. The full code is free for members, ready to copy into your project.
This component also comes in
The code in React
import { useMobileMenu } from "./useMobileMenu";
export type NavLink = { label: string; href: string; current?: boolean };
type TwoTierNavbarProps = {
brand: { name: string; highlight: string };
phone: { display: string; href: string };
hours: string;
links: NavLink[];
cta: { label: string; href: string };
};
import { useEffect, useState, type KeyboardEvent } from "react";
/** Open state of a mobile navigation panel, closed with Escape and when the viewport grows. */
export function useMobileMenu(desktopQuery = "(min-width: 768px)") {
const [open, setOpen] = useState(false);
useEffect(() => {
const media = window.matchMedia(desktopQuery);
const close = () => media.matches && setOpen(false);
media.addEventListener("change", close);
return () => media.removeEventListener("change", close);
}, [desktopQuery]);Free component: copy it freely, including for commercial projects.
Other navigation bars components in React
Navigation bars components in React
A navigation that sits at the bottom of the screen, under the thumb, on phones, and becomes a horizontal bar at the top on desktop.
- Tailwind
- React
- CSS
- WordPress

Logo on the left, links in the middle, call to action on the right, collapsible menu on mobile.
- Tailwind
- React
- CSS
- WordPress

The house name in the middle, links split on each side, restaurant or designer-shop style.
- Tailwind
- React
- CSS
- WordPress