Skip to content

Ryokan Shoji Hero

Travel hero section for a Kyoto ryokan: a garden photo behind sliding shoji screens, washi copy column and a booking bar.

  • Heroes
  • Travel & hospitality
  • React only · 0 deps
  • 1 file
Full screen

Browser support · All evergreen browsers. Closed shoji use backdrop-filter for the paper glow, with an opaque fallback.

Install. One command, or copy the file.

$npx shadcn@latest add https://freedesignmd.com/r/hero-travel-parallax.json
  • Byte-identical to the preview
  • No Tailwind or config needed
  • SSR-safe · keyboard accessible
  • Respects reduced motion & transparency
components/heroes/hero-travel-parallax.tsx
1/**
2 * HeroTravelParallax, a ryokan hero. A washi-paper column carries the
3 * headline, lede and a ruled row of house facts; the right side is a
4 * photograph of a guest room opening onto the moss garden, framed by two
5 * shoji screens that slide apart on load. The screens can be slid shut again
6 * with a button: the garden then glows through translucent paper. The photo
7 * drifts with the pointer on a spring and sinks on scroll while the copy
8 * lifts away. A booking bar spans both columns.
9 *
10 * Props: brand, kicker, title, lede, facts ({ k, v }[]), image ({ src, alt,
11 * caption }), location, checkIn, checkOut, guests, nightly (number), currency,
12 * onSearch(values).
13 * CSS vars: --fd-alp-paper, --fd-alp-ink, --fd-alp-accent, --fd-alp-wood.
14 *
15 * Browser support: all evergreen browsers. Closed shoji use backdrop-filter
16 * for the paper glow and fall back to an opaque paper tone when unsupported or
17 * when prefers-reduced-transparency is set.
18 * Motion: shoji slide with --fd-ease-in-out over --fd-dur-4 ×2; pointer
19 * parallax on a spring (k=380, c=30, mass 4); scroll-linked depth via rAF +
20 * getBoundingClientRect (transform/opacity only, paused off screen).
21 * prefers-reduced-motion: screens start open, no parallax, no slide.
22 * Accessibility: the booking bar is a real <form> with labelled inputs; the
23 * shoji toggle is a <button aria-pressed>; the photo has alt text.
24 */
25import { useEffect, useId, useRef, useState } from "react";
26import type { FormEvent, ReactNode } from "react";
27
28export interface HeroTravelParallaxProps {
29 brand?: string;
30 kicker?: ReactNode;
31 title?: ReactNode;
32 lede?: ReactNode;
33 facts?: { k: string; v: string }[];
34 image?: { src: string; alt: string; caption?: string };
35 location?: string;
36 checkIn?: string;
37 checkOut?: string;
38 guests?: number;
39 nightly?: number;
40 currency?: string;
41 onSearch?: (v: { location: string; checkIn: string; checkOut: string; guests: number }) => void;
42}
43
44const DEFAULT_FACTS = [
45 { k: "Bath", v: "Hinoki, 06:00 to 23:00" },
46 { k: "Dinner", v: "Kaiseki at 18:30" },
47 { k: "Maples", v: "Peak 18 to 30 Nov" },
48];
49
50export function HeroTravelParallax({
51 brand = "Hanare",
52 kicker = "Higashiyama, Kyoto · 35.00°N · 9 rooms",
53 title = (
54 <>
55 Nine rooms,
56 <br />
57 one garden,
58 <br />
59 <em>no hurry.</em>
60 </>
61 ),
62 lede = "A 1926 machiya off Shinmonzen-dōri, restored joint by joint. Cypress baths, kaiseki by Aya Morikawa, and a moss garden raked at six every morning before anyone is up.",
63 facts = DEFAULT_FACTS,
64 image = {
65 src: "/img/halcyon/ryokan.webp",
66 alt: "A tatami room with a cypress soaking tub, its shoji open onto a moss garden under a red maple",
67 caption: "Room 4, Kaede. North garden, 07:40",
68 },
69 location = "Hanare, Higashiyama, Kyoto",
70 checkIn = "2027-11-18",
71 checkOut = "2027-11-22",
72 guests = 2,
73 nightly = 68000,
74 currency = "¥",
75 onSearch,
76}: HeroTravelParallaxProps) {
77 const root = useRef<HTMLElement>(null);
78 const photo = useRef<HTMLImageElement>(null);
79 const copy = useRef<HTMLDivElement>(null);
80 const uid = useId().replace(/[^a-zA-Z0-9]/g, "");
81 const [vals, setVals] = useState({ location, checkIn, checkOut, guests });
82 const [sent, setSent] = useState(false);
83 const [open, setOpen] = useState(false);
84
85 // slide the shoji open once the page has settled
86 useEffect(() => {
87 if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
88 setOpen(true);
89 return;
90 }
91 const t = window.setTimeout(() => setOpen(true), 450);
92 return () => window.clearTimeout(t);
93 }, []);
94
95 useEffect(() => {
96 const el = root.current;
97 if (!el || window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
98 const sp = { x: 0, y: 0, vx: 0, vy: 0, tx: 0, ty: 0 };
99 const onMove = (e: PointerEvent) => {
100 if (e.pointerType === "touch") return;
101 const r = el.getBoundingClientRect();
102 sp.tx = ((e.clientX - r.left) / r.width) * 2 - 1;
103 sp.ty = ((e.clientY - r.top) / r.height) * 2 - 1;
104 };
105 const onLeave = () => {
106 sp.tx = 0;
107 sp.ty = 0;
108 };
109 el.addEventListener("pointermove", onMove);
110 el.addEventListener("pointerleave", onLeave);
111 let raf = 0;
112 let last = performance.now();
113 let visible = true;
114 let lastSig = "";
115 const frame = (now: number) => {
116 raf = 0;
117 const dt = Math.min((now - last) / 1000, 0.032);
118 last = now;
119 for (let i = 0; i < 2; i++) {
120 const h = dt / 2;
121 sp.vx += ((-380 * (sp.x - sp.tx) - 30 * sp.vx) / 4) * h;
122 sp.vy += ((-380 * (sp.y - sp.ty) - 30 * sp.vy) / 4) * h;
123 sp.x += sp.vx * h;
124 sp.y += sp.vy * h;
125 }
126 const r = el.getBoundingClientRect();
127 const p = Math.min(1, Math.max(0, -r.top / Math.max(1, r.height * 0.8)));
128 const sig = `${sp.x.toFixed(4)}|${sp.y.toFixed(4)}|${p.toFixed(4)}`;
129 if (sig !== lastSig) {
130 lastSig = sig;
131 if (photo.current) photo.current.style.transform = `translate3d(${(-sp.x * 14).toFixed(2)}px, ${(-sp.y * 10 + p * 70).toFixed(2)}px, 0) scale(${(1.08 + p * 0.04).toFixed(4)})`;
132 if (copy.current) {
133 copy.current.style.transform = `translate3d(0, ${(p * -70).toFixed(1)}px, 0)`;
134 copy.current.style.opacity = `${(1 - p * 1.3).toFixed(3)}`;
135 }
136 }
137 if (visible && !document.hidden) raf = requestAnimationFrame(frame);
138 };
139 const start = () => {
140 if (!raf && visible && !document.hidden) {
141 last = performance.now();
142 raf = requestAnimationFrame(frame);
143 }
144 };
145 const io = new IntersectionObserver(([e]) => {
146 visible = e.isIntersecting;
147 if (visible) start();
148 });
149 io.observe(el);
150 document.addEventListener("visibilitychange", start);
151 start();
152 return () => {
153 cancelAnimationFrame(raf);
154 io.disconnect();
155 document.removeEventListener("visibilitychange", start);
156 el.removeEventListener("pointermove", onMove);
157 el.removeEventListener("pointerleave", onLeave);
158 };
159 }, []);
160
161 const submit = (e: FormEvent) => {
162 e.preventDefault();
163 onSearch?.(vals);
164 setSent(true);
165 window.setTimeout(() => setSent(false), 1800);
166 };
167
168 const nights = Math.max(1, Math.round((Date.parse(vals.checkOut) - Date.parse(vals.checkIn)) / 864e5) || 1);
169
170 return (
171 <section ref={root} className="fd-alp" data-open={open ? "" : undefined} aria-label={`${brand}, ryokan in Kyoto`}>
172 <style>{css}</style>
173
174 <div ref={copy} className="fd-alp-copy">
175 <p className="fd-alp-kicker">{kicker}</p>
176 <h1 className="fd-alp-h1">{title}</h1>
177 <p className="fd-alp-lede">{lede}</p>
178 <dl className="fd-alp-facts">
179 {facts.map((f) => (
180 <div key={f.k}>
181 <dt>{f.k}</dt>
182 <dd>{f.v}</dd>
183 </div>
184 ))}
185 </dl>
186 </div>
187
188 <div className="fd-alp-pic">
189 <img ref={photo} className="fd-alp-img" src={image.src} alt={image.alt} width={1024} height={1024} fetchPriority="high" />
190 <div className="fd-alp-shoji fd-alp-shoji-l" aria-hidden="true">
191 <i className="fd-alp-hikite" />
192 </div>
193 <div className="fd-alp-shoji fd-alp-shoji-r" aria-hidden="true">
194 <i className="fd-alp-hikite" />
195 </div>
196 <div className="fd-alp-picbar">
197 {image.caption && <p className="fd-alp-cap">{image.caption}</p>}
198 <button type="button" className="fd-alp-slide" aria-pressed={!open} onClick={() => setOpen((o) => !o)}>
199 <svg viewBox="0 0 20 14" width="20" height="14" aria-hidden="true">
200 <rect x="0.75" y="0.75" width="18.5" height="12.5" fill="none" stroke="currentColor" strokeWidth="1.2" />
201 <path d="M10 1v12M5.4 1v12M14.6 1v12M1 7h18" stroke="currentColor" strokeWidth="0.9" />
202 </svg>
203 {open ? "Close the shoji" : "Open the shoji"}
204 </button>
205 </div>
206 </div>
207
208 <form className="fd-alp-book" onSubmit={submit} aria-label="Check availability">
209 <label className="fd-alp-f fd-alp-f-loc">
210 <span>Where</span>
211 <input value={vals.location} onChange={(e) => setVals({ ...vals, location: e.target.value })} />
212 </label>
213 <label className="fd-alp-f">
214 <span>Check in</span>
215 <input type="date" value={vals.checkIn} onChange={(e) => setVals({ ...vals, checkIn: e.target.value })} />
216 </label>
217 <label className="fd-alp-f">
218 <span>Check out</span>
219 <input type="date" value={vals.checkOut} onChange={(e) => setVals({ ...vals, checkOut: e.target.value })} />
220 </label>
221 <div className="fd-alp-f fd-alp-f-g">
222 <span id={`${uid}-g`}>Guests</span>
223 <div className="fd-alp-step" role="group" aria-labelledby={`${uid}-g`}>
224 <button type="button" aria-label="Fewer guests" onClick={() => setVals({ ...vals, guests: Math.max(1, vals.guests - 1) })}>
225 −
226 </button>
227 <output aria-live="polite">{vals.guests}</output>
228 <button type="button" aria-label="More guests" onClick={() => setVals({ ...vals, guests: Math.min(4, vals.guests + 1) })}>
229 +
230 </button>
231 </div>
232 </div>
233 <button type="submit" className="fd-alp-go">
234 <span>{sent ? "Checking the ledger…" : "Check availability"}</span>
235 <small>
236 {nights} {nights === 1 ? "night" : "nights"}, from {currency}
237 {(nightly * nights).toLocaleString("en-US")}
238 </small>
239 </button>
240 </form>
241 </section>
242 );
243}
244
245const lattice = (c: string) =>
246 `linear-gradient(90deg, ${c} 3px, transparent 3px), linear-gradient(180deg, ${c} 3px, transparent 3px)`;
247
248const css = `
249.fd-alp, .fd-alp *, .fd-alp *::before, .fd-alp *::after { box-sizing: border-box; }
250.fd-alp {
251 --fd-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
252 --fd-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
253 --fd-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
254 --fd-dur-1: 120ms; --fd-dur-2: 240ms; --fd-dur-3: 420ms; --fd-dur-4: 700ms;
255 --fd-alp-paper: #F1ECE2;
256 --fd-alp-ink: #1F1B17;
257 --fd-alp-muted: #6B6158;
258 --fd-alp-accent: #A8382A;
259 --fd-alp-wood: #4A3526;
260 --fd-alp-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
261 --fd-alp-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
262 --fd-alp-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
263 --fd-alp-gutter: max(40px, calc(50vw - 640px));
264 position: relative; display: block; overflow: hidden; margin: 0; padding: 0; height: 100vh; min-height: 760px; max-height: 1000px;
265 background: var(--fd-alp-paper); color: var(--fd-alp-ink); font: 400 1rem/1.5 var(--fd-alp-sans); isolation: isolate;
266}
267
268.fd-alp-copy { position: absolute; left: var(--fd-alp-gutter); top: 0; bottom: 150px; width: calc(42% - var(--fd-alp-gutter) - 32px); display: flex; flex-direction: column; justify-content: center; margin: 0; padding: 76px 0 0; will-change: transform, opacity; }
269.fd-alp-kicker {
270 margin: 0 0 26px; padding: 0; color: var(--fd-alp-muted);
271 font: 500 0.6875rem/1 var(--fd-alp-mono); letter-spacing: 0.14em; text-transform: uppercase;
272 animation: fd-alp-rise var(--fd-dur-4) var(--fd-ease-out) 200ms both;
273}
274.fd-alp-h1 {
275 margin: 0; padding: 0; color: var(--fd-alp-ink);
276 font: 400 clamp(3rem, 5.4vw, 5.5rem)/0.96 var(--fd-alp-serif); letter-spacing: -0.035em;
277 animation: fd-alp-rise 1000ms var(--fd-ease-out) 260ms both;
278}
279.fd-alp-h1 em { font-style: italic; color: var(--fd-alp-accent); }
280.fd-alp-lede {
281 margin: 26px 0 0; padding: 0; max-width: 30rem; color: #4A423B;
282 font: 400 1.0625rem/1.6 var(--fd-alp-sans); letter-spacing: -0.008em; text-wrap: pretty;
283 animation: fd-alp-rise var(--fd-dur-4) var(--fd-ease-out) 480ms both;
284}
285.fd-alp-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 32px 0 0; padding: 0; max-width: 32rem; border-top: 1px solid rgba(31,27,23,0.16); animation: fd-alp-rise var(--fd-dur-4) var(--fd-ease-out) 600ms both; }
286.fd-alp-facts > div { margin: 0; padding: 12px 12px 0 0; }
287.fd-alp-facts > div + div { padding-left: 12px; border-left: 1px solid rgba(31,27,23,0.1); }
288.fd-alp-facts dt { margin: 0; padding: 0; font: 500 0.625rem/1 var(--fd-alp-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--fd-alp-accent); }
289.fd-alp-facts dd { margin: 6px 0 0; padding: 0; font: 400 0.8125rem/1.35 var(--fd-alp-sans); color: var(--fd-alp-ink); }
290
291.fd-alp-pic { position: absolute; top: 0; right: 0; bottom: 0; width: 58%; margin: 0; overflow: hidden; background: #2A211B; }
292.fd-alp-img { position: absolute; inset: -4%; display: block; width: 108%; height: 108%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; object-fit: cover; object-position: 60% 50%; will-change: transform; transform: scale(1.08); }
293.fd-alp-shoji {
294 position: absolute; top: 0; bottom: 0; width: 50.5%; margin: 0;
295 background-color: rgba(246,240,229,0.72);
296 background-image: ${lattice("rgba(74,53,38,0.9)")}, radial-gradient(120% 90% at 50% 40%, rgba(255,250,240,0.55), rgba(232,222,204,0.2));
297 background-size: 25% 12.5%, 25% 12.5%, 100% 100%;
298 background-position: -1px -1px, -1px -1px, 0 0;
299 border: 9px solid var(--fd-alp-wood);
300 -webkit-backdrop-filter: blur(9px) saturate(0.7) brightness(1.15); backdrop-filter: blur(9px) saturate(0.7) brightness(1.15);
301 box-shadow: inset 0 0 40px rgba(74,53,38,0.25);
302 transition: transform 1400ms var(--fd-ease-in-out);
303}
304.fd-alp-shoji-l { left: 0; }
305.fd-alp-shoji-r { right: 0; }
306.fd-alp[data-open] .fd-alp-shoji-l { transform: translateX(-101%); }
307.fd-alp[data-open] .fd-alp-shoji-r { transform: translateX(101%); }
308.fd-alp-hikite { position: absolute; top: 50%; width: 10px; height: 34px; margin: -17px 0 0; border-radius: 9999px; background: var(--fd-alp-wood); box-shadow: inset 0 0 0 2px rgba(0,0,0,0.25); }
309.fd-alp-shoji-l .fd-alp-hikite { right: 14px; }
310.fd-alp-shoji-r .fd-alp-hikite { left: 14px; }
311
312.fd-alp-picbar { position: absolute; left: 28px; right: 28px; top: 92px; display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0; padding: 0; z-index: 2; }
313.fd-alp-cap { margin: 0; padding: 7px 10px; background: rgba(31,27,23,0.62); color: #F1ECE2; font: 500 0.6875rem/1 var(--fd-alp-mono); letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
314.fd-alp-slide {
315 appearance: none; -webkit-appearance: none; cursor: pointer; flex: none; display: inline-flex; align-items: center; gap: 9px; height: 36px; margin: 0; padding: 0 14px; border: 0; border-radius: 9999px;
316 background: var(--fd-alp-paper); color: var(--fd-alp-ink); font: 500 0.8125rem/1 var(--fd-alp-sans); letter-spacing: -0.005em;
317 box-shadow: 0 8px 24px -10px rgba(0,0,0,0.5);
318 transition: transform var(--fd-dur-2) var(--fd-spring), background var(--fd-dur-1);
319}
320.fd-alp-slide svg { display: block; color: var(--fd-alp-wood); }
321.fd-alp-slide:hover { background: #fff; }
322.fd-alp-slide:active { transform: scale(0.96); transition-duration: var(--fd-dur-1); }
323
324.fd-alp-book {
325 position: absolute; left: var(--fd-alp-gutter); right: 40px; bottom: 40px; z-index: 3; margin: 0; padding: 8px;
326 display: grid; grid-template-columns: 1.5fr 1fr 1fr 0.8fr auto; gap: 0; align-items: stretch;
327 border-radius: 4px; background: var(--fd-alp-paper); border: 1px solid rgba(31,27,23,0.14);
328 box-shadow: 0 30px 70px -36px rgba(31,27,23,0.55);
329 animation: fd-alp-bar 1000ms var(--fd-ease-out) 700ms both;
330}
331.fd-alp-f { display: flex; flex-direction: column; justify-content: center; gap: 6px; margin: 0; padding: 10px 18px; border-radius: 2px; min-width: 0; transition: background var(--fd-dur-1); }
332.fd-alp-f + .fd-alp-f { box-shadow: inset 1px 0 0 rgba(31,27,23,0.1); }
333.fd-alp-f:hover, .fd-alp-f:focus-within { background: #E8E1D4; }
334.fd-alp-f > span { display: block; margin: 0; font: 500 0.625rem/1 var(--fd-alp-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--fd-alp-muted); }
335.fd-alp-f input {
336 appearance: none; -webkit-appearance: none; display: block; width: 100%; margin: 0; padding: 0; border: 0; outline: 0; background: transparent;
337 font: 500 0.9375rem/1.3 var(--fd-alp-sans); letter-spacing: -0.01em; color: var(--fd-alp-ink); min-width: 0;
338}
339.fd-alp-f input::-webkit-calendar-picker-indicator { opacity: 0.45; }
340.fd-alp-step { display: flex; align-items: center; gap: 12px; }
341.fd-alp-step button {
342 appearance: none; -webkit-appearance: none; display: grid; place-items: center; width: 26px; height: 26px; margin: 0; padding: 0; border-radius: 9999px; cursor: pointer;
343 border: 1px solid rgba(31,27,23,0.22); background: transparent; color: var(--fd-alp-ink); font: 500 0.9375rem/1 var(--fd-alp-sans);
344 transition: transform var(--fd-dur-2) var(--fd-spring), background var(--fd-dur-1);
345}
346.fd-alp-step button:hover { background: rgba(31,27,23,0.06); }
347.fd-alp-step button:active { transform: scale(0.9); transition-duration: var(--fd-dur-1); }
348.fd-alp-step output { min-width: 1ch; font: 500 0.9375rem/1 var(--fd-alp-sans); color: var(--fd-alp-ink); font-variant-numeric: tabular-nums; }
349.fd-alp-go {
350 appearance: none; -webkit-appearance: none; cursor: pointer; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 5px;
351 margin: 0; padding: 0 26px; border: 0; border-radius: 2px; background: var(--fd-alp-ink); color: #F1ECE2; text-align: left;
352 transition: transform var(--fd-dur-2) var(--fd-spring), background var(--fd-dur-1);
353}
354.fd-alp-go span { font: 600 0.9375rem/1.1 var(--fd-alp-sans); letter-spacing: -0.01em; white-space: nowrap; }
355.fd-alp-go small { font: 400 0.75rem/1 var(--fd-alp-sans); color: rgba(241,236,226,0.7); white-space: nowrap; font-variant-numeric: tabular-nums; }
356.fd-alp-go:hover { background: var(--fd-alp-accent); }
357.fd-alp-go:active { transform: scale(0.96); transition-duration: var(--fd-dur-1); }
358.fd-alp-go:focus-visible, .fd-alp-step button:focus-visible, .fd-alp-slide:focus-visible { outline: 2px solid rgba(168,56,42,0.7); outline-offset: 2px; }
359
360@keyframes fd-alp-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
361@keyframes fd-alp-bar { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
362
363@media (max-width: 1100px) {
364 .fd-alp-copy { width: calc(46% - var(--fd-alp-gutter) - 24px); }
365 .fd-alp-pic { width: 54%; }
366 .fd-alp-facts { grid-template-columns: 1fr; }
367 .fd-alp-facts > div + div { padding-left: 0; border-left: 0; }
368}
369@media (max-width: 860px) {
370 .fd-alp { display: flex; flex-direction: column; height: auto; min-height: 844px; max-height: none; --fd-alp-gutter: 20px; }
371 .fd-alp-copy { position: relative; left: auto; top: auto; bottom: auto; width: auto; margin: 0; padding: 92px 20px 28px; }
372 .fd-alp-kicker { margin-bottom: 18px; font-size: 0.625rem; }
373 .fd-alp-h1 { font-size: 3.25rem; }
374 .fd-alp-lede { margin-top: 18px; font-size: 0.9375rem; }
375 .fd-alp-facts { display: none; }
376 .fd-alp-pic { position: relative; top: auto; right: auto; bottom: auto; width: 100%; height: 330px; flex: none; }
377 .fd-alp-picbar { top: auto; bottom: 64px; left: 16px; right: 16px; justify-content: flex-end; }
378 .fd-alp-cap { display: none; }
379 .fd-alp-shoji { border-width: 6px; }
380 .fd-alp-book { position: relative; left: auto; right: auto; bottom: auto; margin: -44px 16px 24px; grid-template-columns: 1fr 1fr; padding: 6px; }
381 .fd-alp-f { padding: 10px 12px; }
382 .fd-alp-f + .fd-alp-f { box-shadow: none; }
383 .fd-alp-f-loc, .fd-alp-go { grid-column: 1 / -1; }
384 .fd-alp-f-loc { box-shadow: inset 0 -1px 0 rgba(31,27,23,0.1); }
385 .fd-alp-go { min-height: 56px; margin-top: 4px; flex-direction: row; justify-content: space-between; align-items: center; padding: 0 18px; }
386}
387@media (prefers-reduced-motion: reduce) {
388 .fd-alp *, .fd-alp *::before { animation: none !important; }
389 .fd-alp-shoji { transition: none; }
390}
391@media (prefers-reduced-transparency: reduce) { .fd-alp-shoji { background-color: #EDE6D8; -webkit-backdrop-filter: none; backdrop-filter: none; } }
392`;
393
394/* ───────────────────────── Demo ───────────────────────── */
395
396export function Demo() {
397 return (
398 <div className="fd-alp-demo">
399 <style>{demoCss}</style>
400 <header className="fd-alp-demo-nav">
401 <a className="fd-alp-demo-logo" href="#top">
402 <svg viewBox="0 0 22 22" width="22" height="22" aria-hidden="true">
403 <rect x="1" y="1" width="20" height="20" fill="none" stroke="#1F1B17" strokeWidth="1.6" />
404 <path d="M11 1v20M1 11h20" stroke="#1F1B17" strokeWidth="1.1" />
405 <rect x="12.4" y="12.4" width="7.2" height="7.2" fill="#A8382A" />
406 </svg>
407 Hanare
408 </a>
409 <nav aria-label="Primary">
410 <a href="#rooms">Rooms</a>
411 <a href="#bath">Bath</a>
412 <a href="#kaiseki">Kaiseki</a>
413 <a href="#kyoto">Kyoto notes</a>
414 </nav>
415 <a className="fd-alp-demo-cta" href="#reserve">Reserve</a>
416 </header>
417 <HeroTravelParallax />
418 <section className="fd-alp-demo-after" aria-label="Rooms">
419 <p>Nine rooms, each with its own corner of the garden.</p>
420 <ul>
421 <li><b>Tsuki</b><span>Garden room · 32 m²</span><em>from ¥68,000</em></li>
422 <li><b>Kaede</b><span>Corner room, hinoki tub · 41 m²</span><em>from ¥84,000</em></li>
423 <li><b>Hanare</b><span>The detached house · 66 m²</span><em>from ¥142,000</em></li>
424 </ul>
425 </section>
426 </div>
427 );
428}
429
430const demoCss = `
431.fd-alp-demo { position: relative; margin: 0; padding: 0; min-height: 100vh; background: #F1ECE2; }
432.fd-alp-demo *, .fd-alp-demo *::before, .fd-alp-demo *::after { box-sizing: border-box; }
433.fd-alp-demo-nav {
434 position: absolute; z-index: 10; top: 0; left: 0; right: 0; height: 76px; margin: 0; padding: 0 40px 0 max(40px, calc(50vw - 640px));
435 display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 40px;
436 animation: fd-alp-demo-in 900ms cubic-bezier(0.22, 1, 0.36, 1) 300ms both;
437}
438.fd-alp-demo-logo { display: inline-flex; align-items: center; gap: 10px; margin: 0; color: #1F1B17; text-decoration: none; font: 400 1.375rem/1 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; letter-spacing: 0.02em; }
439.fd-alp-demo-logo svg { display: block; }
440.fd-alp-demo-nav nav { display: flex; gap: 26px; margin: 0; padding: 0; }
441.fd-alp-demo-nav nav a { color: #4A423B; text-decoration: none; font: 500 0.8125rem/1 ui-sans-serif, -apple-system, "Inter", sans-serif; letter-spacing: 0; transition: color 120ms; }
442.fd-alp-demo-nav nav a:hover { color: #A8382A; }
443.fd-alp-demo-cta { grid-column: 3; display: inline-flex; align-items: center; height: 38px; padding: 0 18px; border-radius: 9999px; color: #1F1B17; background: #F1ECE2; text-decoration: none; font: 600 0.8125rem/1 ui-sans-serif, -apple-system, "Inter", sans-serif; box-shadow: 0 8px 24px -10px rgba(0,0,0,0.5); }
444.fd-alp-demo-nav a:focus-visible { outline: 2px solid rgba(168,56,42,.7); outline-offset: 2px; }
445.fd-alp-demo-after { margin: 0; padding: 96px max(20px, calc(50vw - 560px)) 120px; background: #1F1B17; color: #F1ECE2; }
446.fd-alp-demo-after p { margin: 0; padding: 0; max-width: 22ch; font: 400 clamp(1.75rem, 3.4vw, 2.75rem)/1.1 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; letter-spacing: -0.02em; text-wrap: balance; }
447.fd-alp-demo-after ul { margin: 40px 0 0; padding: 0; list-style: none; border-top: 1px solid rgba(241,236,226,0.16); }
448.fd-alp-demo-after li { display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; gap: 16px; align-items: baseline; margin: 0; padding: 18px 0; border-bottom: 1px solid rgba(241,236,226,0.1); }
449.fd-alp-demo-after b { font: 400 1.25rem/1.2 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; color: #fff; }
450.fd-alp-demo-after span { font: 400 0.875rem/1.3 ui-sans-serif, -apple-system, "Inter", sans-serif; color: rgba(241,236,226,0.62); }
451.fd-alp-demo-after em { font: 500 0.8125rem/1 ui-monospace, "SF Mono", Menlo, monospace; font-style: normal; color: #E9A99E; }
452@keyframes fd-alp-demo-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
453@media (max-width: 1100px) { .fd-alp-demo-nav nav { display: none; } }
454@media (max-width: 860px) {
455 .fd-alp-demo-nav { height: 64px; padding: 0 20px; }
456 .fd-alp-demo-cta { background: #1F1B17; color: #F1ECE2; box-shadow: none; height: 36px; }
457 .fd-alp-demo-after li { grid-template-columns: 1fr auto; }
458 .fd-alp-demo-after li span { grid-column: 1 / -1; grid-row: 2; }
459}
460@media (prefers-reduced-motion: reduce) { .fd-alp-demo-nav { animation: none; } }
461`;

More Heroes. Same file contract.

Ledger Card Hero, heroes preview: Fintech hero section with a CSS 3D metal card that tilts to the cursor, then flips and docks on scroll as…

Ledger Card Hero

Fintech hero section with a CSS 3D metal card that tilts to the cursor, then flips and docks on scroll as stats count up.

Agent Terminal Hero, heroes preview: AI hero section with a terminal that types a prompt and streams an agent's plan while a dashboard assembles…

Agent Terminal Hero

AI hero section with a terminal that types a prompt and streams an agent's plan while a dashboard assembles beside it.

Maison Editorial Hero, heroes preview: Editorial fashion hero section: a giant serif masthead over three campaign photos, revealed by clip-path wipes

Maison Editorial Hero

Editorial fashion hero section: a giant serif masthead over three campaign photos, revealed by clip-path wipes.

Questions about Ryokan Shoji Hero

Run npx shadcn@latest add https://freedesignmd.com/r/hero-travel-parallax.json, or open the page and copy the file into your project. It has zero dependencies besides React. What you copy is the exact file that renders the live demo.

Travel hero section for a Kyoto ryokan: a garden photo behind sliding shoji screens, washi copy column and a booking bar. It is a free, MIT-licensed React heroes component from the freedesignmd library.

Yes. It is free and MIT-licensed, use, modify and ship it in personal and commercial projects without attribution.

All evergreen browsers. Closed shoji use backdrop-filter for the paper glow, with an opaque fallback.

Yes. It is a plain React component with its own styles, so it runs in Next.js, Vite, Remix and Lovable projects, and it needs no Tailwind setup. It has zero dependencies besides React.