Skip to content
Blocks

Editorial Navigation

A publication masthead with numbered sections and a compact mobile menu.

Open ↗

Make it yours.

Install the editable source and its dependencies into your React + Tailwind project.

Scroll horizontally for long lines
pnpm dlx shadcn@4.0.8 add http://localhost:3000/r/editorial-navigation.json

Use it

Scroll horizontally for long lines
"use client";
import {EditorialNavigation} from '@/components/jez-ui/blocks/editorial-navigation';

export default function Example(){

return <><EditorialNavigation/></>;
}

Props & types

Scroll horizontally for long lines
{
  className?: string;
  items?: { label: string; href: string }[];
  brand?: string;
  home?: string;
}

Source

View 2 source files

registry/blocks/editorial-navigation.tsx

Scroll horizontally for long lines
"use client";
import * as React from "react";
import { Menu, X, ArrowUpRight } from "lucide-react";
import { cn } from "../ui/utils";
const defaults = [
  { label: "Stories", href: "/templates/editorial/preview" },
  { label: "Design", href: "/templates/editorial/preview/category/design" },
  { label: "People", href: "/templates/editorial/preview/author/rowan" },
  { label: "Archive", href: "/templates/editorial/preview/search" },
];
export function EditorialNavigation({
  className,
  items = defaults,
  brand = "Still.",
  home = "/templates/editorial/preview",
}: {
  className?: string;
  items?: { label: string; href: string }[];
  brand?: string;
  home?: string;
}) {
  const [open, setOpen] = React.useState(false);
  return (
    <header className={cn("border-y border-border bg-background", className)}>
      <div className="flex items-center justify-between gap-6 px-6 py-6">
        <a href={home} className="font-serif text-4xl tracking-tight">
          {brand}
        </a>
        <span className="hidden text-xs text-muted-foreground sm:block">
          Ideas worth spending time with.
        </span>
        <button
          aria-label={open ? "Close menu" : "Open menu"}
          aria-expanded={open}
          onClick={() => setOpen(!open)}
          className="grid size-10 place-items-center rounded-full border border-border md:hidden"
        >
          {open ? <X size={17} /> : <Menu size={17} />}
        </button>
        <a
          href="/templates/editorial/preview/search"
          className="hidden items-center gap-2 text-xs md:flex"
        >
          Explore the journal
          <ArrowUpRight size={15} />
        </a>
      </div>
      <nav
        aria-label="Journal navigation"
        className={cn(
          "border-t border-border px-6",
          open ? "grid" : "hidden md:flex",
        )}
      >
        {items.map((item, i) => (
          <a
            key={item.href}
            href={item.href}
            className="flex items-center gap-4 border-b border-border py-4 text-sm last:border-0 hover:text-primary md:mr-8 md:border-0"
          >
            <span className="font-mono text-[10px] text-muted-foreground">
              0{i + 1}
            </span>
            {item.label}
          </a>
        ))}
      </nav>
    </header>
  );
}

registry/ui/utils.ts

Scroll horizontally for long lines
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...values: ClassValue[]) {
  return twMerge(clsx(values));
}

Dependencies

lucide-react@0.577.0 · clsx@2.1.1 · tailwind-merge@3.5.0

Accessibility & behaviour

Provide meaningful labels and preserve keyboard focus styles. Check contrast when customising theme colours.

Read the accessibility and performance guide →