Masthead navbar
React newspaper masthead: a newspaper masthead that folds into one slim line as you scroll.
Features
- A dateline, the title set large in the middle and the sections between two rules
- Folds into one slim line on scroll, the title shrinking into the section row
- The section you're reading is underlined
- Only transform, opacity and a clip move, so the fold stays smooth
- On phones the sections scroll sideways under the title
Best for: Magazines, newsletters, blogs and editorial studios that publish in issues and sections.
Installation
npm install motion @radix-ui/react-slot class-variance-authority clsx tailwind-mergeThen copy the files from the Code tab into the same paths in your project, in TypeScript or JavaScript.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| title | ReactNode | - | The publication's name, large at the top, small once folded. |
| dateline | ReactNode | - | Small print on the left: the date, the issue. |
| items | NavItem[] | - | One link per section: label and href. |
| login | { label: string; href: string } | - | Optional quiet log in link. |
| cta | { label: string; href: string } | - | Optional button, such as Subscribe. |
| className | string | - | Extra classes for the header. |
FAQ
Is the Masthead navbar free to use?
Yes. Masthead is free to copy into your own projects. Open the Code tab and paste the files into your app.
Does Masthead work with Next.js and React?
Yes. It's a React client component made for the Next.js App Router, styled with Tailwind CSS and animated with Framer Motion (the motion package).
Can I use Masthead in JavaScript instead of TypeScript?
Yes. Every file comes in TypeScript and JavaScript. Switch the language in the Code tab.
What does Masthead need installed?
motion, @radix-ui/react-slot, class-variance-authority, clsx, tailwind-merge, plus the shared helpers from the Installation page.
Is Masthead accessible?
Every link and button is reachable by keyboard with a visible focus ring, and the animation stays still for visitors who ask for reduced motion.