Cathedral Design

Menu Book with Click & Open Effect

Navigation 3

About

A hand-painted café menu for site navigation. Click or tap the cover and the links lift off the illustrated page, drop into place and fold away when closed. Supply your own links or actions, resize the book, and use it in light or dark themes. Includes keyboard navigation and reduced-motion support. Built with React and TypeScript, with no animation library.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Menu Book with Click & Open Effect to your project and fits it to your theme.

Code

How Menu Book with Click & Open Effect is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import * as React from "react";
import { MenuBook, type MenuBookItem } from "@/components/ui/menu-book-with-click-open-effect";

const demoStyles = `
.mb-showcase {
  --show-bg: hsl(42 40% 94%);
  --show-ink: hsl(357 25% 22%);
  --show-rule: hsl(33 22% 71%);
  --show-muted: hsl(24 14% 36%);
  --show-glow: 255 251 241;
  --show-paper: var(--color-background,var(--show-bg));
  --show-fg: var(--color-foreground,var(--show-ink));
  --show-border: var(--color-border,var(--show-rule));
  --show-muted-ink: var(--color-muted-foreground,var(--show-muted));
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  isolation: isolate;
  box-sizing: border-box;
  min-height: max(100svh,520px);
  width: 100%;
  overflow: hidden;
  margin: 0;
  padding: 78px 18px 50px;
  color: var(--show-fg);
  background: radial-gradient(ellipse at 45% 31%,rgb(var(--show-glow)/.38),transparent 70%),var(--show-paper);
  font-family: ui-sans-serif,system-ui,sans-serif;
}

.dark .mb-showcase,[data-theme="dark"] .mb-showcase {
  --show-bg: hsl(25 10% 12%);
  --show-ink: hsl(40 36% 91%);
  --show-rule: hsl(31 18% 42%);
  --show-muted: hsl(35 18% 72%);
  --show-glow: 103 83 63;
}

@media(prefers-color-scheme:dark) {
  .mb-showcase {
    --show-bg: hsl(25 10% 12%);
    --show-ink: hsl(40 36% 91%);
    --show-rule: hsl(31 18% 42%);
    --show-muted: hsl(35 18% 72%);
    --show-glow: 103 83 63;
  }
}

.light .mb-showcase,[data-theme="light"] .mb-showcase {
  --show-bg: hsl(42 40% 94%);
  --show-ink: hsl(357 25% 22%);
  --show-rule: hsl(33 22% 71%);
  --show-muted: hsl(24 14% 36%);
  --show-glow: 255 251 241;
}

.mb-showcase * {
  box-sizing: border-box;
}

.mb-imprint {
  display: flex;
  align-items: center;
  gap: 14px;
  position: absolute;
  top: clamp(17px,4.5vh,42px);
  left: 50%;
  transform: translateX(-50%);
  color: var(--show-fg);
  font: normal 22px/1.2 Georgia,serif;
  white-space: nowrap;
  letter-spacing: -.04em;
}

.mb-imprint::after,.mb-imprint::before {
  content: "";
  height: 1px;
  width: 27px;
  background: var(--show-border);
}

.mb-stage {
  --demo-size: clamp(218px,min(85vw,53svh),520px);
  width: var(--demo-size);
  height: calc(var(--demo-size) * .84 + 199px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.mb-hint {
  position: absolute;
  inset-inline: 16px;
  bottom: clamp(16px,3.8vh,34px);
  margin: 0;
  color: var(--show-muted-ink);
  text-align: center;
  font: normal 11px/1.4 ui-sans-serif,system-ui,sans-serif;
  letter-spacing: .095em;
}

.mb-dest {
  border: 1px solid var(--show-border);
  border-radius: 4px;
  padding: clamp(24px,6vw,40px);
  width: min(370px,calc(100vw - 32px));
  max-height: 82svh;
  color: var(--show-fg);
  background: var(--show-paper);
  font: normal 1rem/1.6 ui-sans-serif,system-ui,sans-serif;
  box-shadow: 0 10px 65px #160e0c32;
}

.mb-dest::backdrop {
  background: #241b192e;
}

.mb-dest h2 {
  font: normal 2rem/1.1 Georgia,serif;
  margin: 0 0 16px;
  letter-spacing: -.04em;
}

.mb-dest p,.mb-dest ol {
  margin: 0 0 22px;
}

.mb-dest ol {
  padding-left: 1.3em;
}

.mb-dest li {
  padding: .2em 0;
}

.mb-dest button {
  background: transparent;
  border: 1px solid var(--show-border);
  border-radius: 20px;
  padding: 9px 15px;
  min-height: 44px;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.mb-dest button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

@media(max-height:580px) {
  .mb-showcase {
    padding-top: 42px;
  }
  .mb-imprint {
    top: 14px;
    font-size: 18px;
  }
  .mb-stage {
    --demo-size: clamp(175px,min(75vw,42svh),260px);
  }
}
`;

export function MenuBookDemo() {
  const [open, setOpen] = React.useState(false);
  const [destination, setDestination] = React.useState<"wedding" | "process" | null>(null);
  const [replay, setReplay] = React.useState(0);
  const dialog = React.useRef<HTMLDialogElement>(null);
  const stage = React.useRef<HTMLDivElement>(null);
  const titleId = React.useId();
  React.useEffect(() => {
    if (destination && !dialog.current?.open) dialog.current?.showModal();
  }, [destination]);

  function restart() {
    setDestination(null);
    setOpen(false);
    setReplay(value => value + 1);
  }

  React.useEffect(() => {
    if (replay) stage.current?.querySelector("button")?.focus({ preventScroll: true });
  }, [replay]);

  const items: MenuBookItem[] = [
    { id: "intro", label: "Restart Intro", onSelect: restart },
    { id: "wedding", label: "Wedding Demo", onSelect: () => setDestination("wedding") },
    { id: "process", label: "How We Work", onSelect: () => setDestination("process") },
    { id: "contact", label: "Contact", href: "https://leinvite.com/contact" },
  ];

  return (
    <main className="mb-showcase" aria-label="Le Invite menu demonstration">
      <style>{demoStyles}</style>
      <div className="mb-imprint">Le Invite</div>
      <div className="mb-stage" ref={stage}>
        <MenuBook key={replay} items={items} size="100%"
          navigationLabel="Le Invite pages" onOpenChange={setOpen} />
      </div>
      <p className="mb-hint">{open ? "Choose a page, or close the cover." : "Click or tap the cover to open."}</p>
      <dialog className="mb-dest" ref={dialog} aria-labelledby={titleId}
        onClose={() => setDestination(null)}>
        {destination === "wedding" ? <>
          <h2 id={titleId}>A September in Provence</h2>
          <p>Join Camille and Louis for three days beneath the olive trees.</p>
          <ol><li>Friday 17 · The first toast</li><li>Saturday 18 · The day we say oui</li><li>Sunday 19 · One more coffee</li></ol>
        </> : <>
          <h2 id={titleId}>How we work</h2>
          <p>We start with your story, sketch the invitation on paper, and bring the illustrations to life on screen.</p>
        </>}
        <button type="button" onClick={() => dialog.current?.close()}>Back to the book</button>
      </dialog>
    </main>
  );
}

export default MenuBookDemo;

More by Cathedral Design

View all
  • Envelope Scroll to Open with Ribbon

    Envelope Scroll to Open with Ribbon

    254
  • Agency Interactive Awards Feature

    Agency Interactive Awards Feature

    62
  • Smokey Lettering

    Smokey Lettering

    11
  • Premium Embossed Wedding Invitation with Vellum Reveal

    Premium Embossed Wedding Invitation with Vellum Reveal

    4

More in Navigation

View all
  • Footer with Big Wordmark

    Footer with Big Wordmark

    162
  • Liquid Glass Expandable Sidebar

    Liquid Glass Expandable Sidebar

    427
  • Meniscus — Liquid Bottom Navigation Bar

    Meniscus — Liquid Bottom Navigation Bar

    27
  • Sidebar

    Sidebar

    441
  • Tabs

    Tabs

    38
  • Footer Section

    Footer Section

    2
  • Sidebar

    Sidebar

    366
  • Pagination

    Pagination

    119