성능
주의프레임 속도: 평균 60 fps, p5 59.9 · 긴 작업: 0개, 총 0 ms, 최장 0 ms · 소스 gzip 12 KB · 런타임 161 KB
Image accordionMIT카드Bencho
Lorenzo Cabra가 만든 카드 React 컴포넌트입니다. MIT 라이선스에 따라 Bencho에서 수정 없이 수집했으며 여기서 실시간으로 보여 줍니다.
품질 보고
등급과 점수는 빌드 또는 테스트 때 실행한 자동 검사에서 나옵니다. 실행하지 않은 항목은 '미검사'로 표시하며, 숫자를 지어내지 않습니다.
프레임 속도: 평균 60 fps, p5 59.9 · 긴 작업: 0개, 총 0 ms, 최장 0 ms · 소스 gzip 12 KB · 런타임 161 KB
문제 0 · 스크린 리더: 주의
지속 움직임 없음
넘침 없음
프레임 속도와 긴 작업 수치는 헤드리스 Chromium에서 소프트웨어 WebGL로 측정했습니다. 이 사이트의 컴포넌트끼리만 비교해야 하며, 실제 기기의 성능이 아닙니다.
해당 없음: 정지 상태에서 보이는 애니메이션이 없습니다. 호버로 시작되는 애니메이션은 검사하지 않았습니다.
axe-core 위반이 없습니다.

검사일 2026년 11월 15일 · 수치는 자동 스크립트에서 오며, 손으로 쓴 예시가 아닙니다.
실제 크기로 보여 줍니다.
복사한 내용은 라이선스 고지로 시작합니다. 코드를 쓸 때 남겨 두세요.
<div id="root"></div>:root{--bg:#f6f4f0;--ink:#17181a;--background:40 20% 96%;--foreground:24 10% 8%;--card:0 0% 100%}html,body{min-height:100%;margin:0;background:var(--bg);color:var(--ink)}html,body{height:100%;overflow:hidden}body{display:grid;place-items:center}#root{display:grid;place-items:center;max-width:100%;max-height:100%;box-sizing:border-box;padding:16px;color:hsl(var(--foreground))}#root.full{width:100%;height:100%;padding:0}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-play-state:paused!important;transition-duration:0s!important}}
/*
MIT License
Copyright (c) 2026 Lorenzo Cabra
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
Not covered by this licence: the Bencho name and the goat mark, and the
photographs shown on bencho.dev (none are included here). Third-party
material keeps its own licence; see THIRD_PARTY.md.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
Sample photographs were replaced with Incidental AI assets. The Bencho name and goat mark are not licensed for marketing use.
*/
/* ── Bencho tokens ─────────────────────────────────────────
The custom properties the free blocks read, at the values
bencho.dev draws them with. Light by default; dark under
[data-theme="dark"] on any ancestor, or automatically with
the system setting unless [data-theme="light"] says otherwise.
Map these to your own theme rather than keeping two: a block
only ever reads the names, never the values. */
:root {
--font-ui: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
--bg: #ffffff;
--board: #ffffff;
--card: #f7f7f6;
--surface: #f7f7f6;
--surface-2: #f1f1f0;
--surface-3: #ecebe7;
--ink: #17181a;
--ink-rgb: 23, 24, 26;
--ink-2: #3c3b37;
--ink-3: #5c5b56;
--ink-4: #6f6e68;
--ink-5: #85847e;
--on-ink: #ffffff;
--on-ink-rgb: 255, 255, 255;
--slab: #17181a;
--on-slab: #ffffff;
--slab-dark: #0e0f11;
--fill-slab: #ffffff;
--fill-on: #17181a;
--fill-on-rgb: 23, 24, 26;
--pane: var(--fill-slab);
--pane-edge: rgba(23, 24, 26, 0.08);
--pane-thumb: rgba(23, 24, 26, 0.07);
--inlay: rgba(255, 255, 255, 0.55);
--inlay-hi: rgba(23, 24, 26, 0.09);
--elev-rgb: 255, 255, 255;
--glass-rgb: 255, 255, 255;
--shadow-rgb: 23, 24, 26;
--wash: 0.06;
--pick: #0d99ff;
--signal: #2231dd;
--focus: #2231dd;
--ok: #15803d;
--ember: #b8431c;
color-scheme: light;
}
[data-theme="dark"] {
--bg: #000000;
--board: #1a1a1a;
--card: #0a0a0a;
--surface: #0f0f0f;
--surface-2: #181818;
--surface-3: #202020;
--ink: #ffffff;
--ink-rgb: 255, 255, 255;
--ink-2: #b4b4b4;
--ink-3: #9a9a9a;
--ink-4: #828282;
--ink-5: #6b6b6b;
--on-ink: #000000;
--on-ink-rgb: 0, 0, 0;
--slab: #1a1a1a;
--on-slab: #ffffff;
--slab-dark: #262626;
--fill-slab: #262626;
--fill-on: #ffffff;
--fill-on-rgb: 255, 255, 255;
--pane-edge: rgba(255, 255, 255, 0.08);
--pane-thumb: rgba(255, 255, 255, 0.07);
--inlay: rgba(255, 255, 255, 0.1);
--inlay-hi: rgba(255, 255, 255, 0.09);
--elev-rgb: 32, 32, 32;
--shadow-rgb: 0, 0, 0;
--wash: 0.09;
--pick: #3aa9ff;
--ok: #34d17a;
color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: #000000;
--board: #1a1a1a;
--card: #0a0a0a;
--surface: #0f0f0f;
--surface-2: #181818;
--surface-3: #202020;
--ink: #ffffff;
--ink-rgb: 255, 255, 255;
--ink-2: #b4b4b4;
--ink-3: #9a9a9a;
--ink-4: #828282;
--ink-5: #6b6b6b;
--on-ink: #000000;
--on-ink-rgb: 0, 0, 0;
--slab: #1a1a1a;
--on-slab: #ffffff;
--slab-dark: #262626;
--fill-slab: #262626;
--fill-on: #ffffff;
--fill-on-rgb: 255, 255, 255;
--pane-edge: rgba(255, 255, 255, 0.08);
--pane-thumb: rgba(255, 255, 255, 0.07);
--inlay: rgba(255, 255, 255, 0.1);
--inlay-hi: rgba(255, 255, 255, 0.09);
--elev-rgb: 32, 32, 32;
--shadow-rgb: 0, 0, 0;
--wash: 0.09;
--pick: #3aa9ff;
--ok: #34d17a;
color-scheme: dark;
}
}
/* Accordion.css */
/*
MIT License
Copyright (c) 2026 Lorenzo Cabra
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
Not covered by this licence: the Bencho name and the goat mark, and the
photographs shown on bencho.dev (none are included here). Third-party
material keeps its own licence; see THIRD_PARTY.md.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
Sample photographs were replaced with Incidental AI assets. The Bencho name and goat mark are not licensed for marketing use.
*/
/* ══ Image accordion ════════════════════════════════════════
A row of pictures cropped to slivers, one of which opens
under the pointer. The arithmetic of who pays for that is
in Accordion.tsx — five grow numbers on five springs — and
what is here is the box they negotiate inside and the crop
that keeps a photograph a photograph while it happens. */
.acc {
display: flex;
flex-direction: row;
align-items: stretch;
/* the strip's radius is set in the component and it is the
SAME number every picture takes — see RMAX in
Accordion.tsx. It used to be a flat 12 of its own, which
cut the first picture's left corners and the last one's
right at a radius the other three never saw.
The clip stays because flex widths land on fractions and a
cell can overhang its container by a sub-pixel; it is no
longer doing any shaping of its own. */
overflow: hidden;
-webkit-user-select: none;
user-select: none;
/* a picture is not a text selection, and a finger dragged
across the strip should read as a hover rather than as an
attempt to scroll the page sideways */
touch-action: pan-y;}
.acc-cell {
position: relative;
/* ── the grow number is the WHOLE story ──────────────────
`flex-basis: 0` so nothing is reserved before the
negotiation starts — with `auto` the pictures' own widths
get a vote and the grow numbers only divide what is left
over, which makes the same setting mean different things
at different counts.
And `min-width: 0`, which is the one that bites: a flex
item will not shrink below its content by default, and
the content here is an image. Without it the four
pictures paying for the open one stop shrinking at their
intrinsic width and the row overflows its own strip. */
flex-basis: 0;
flex-shrink: 1;
min-width: 0;
overflow: hidden;
/* the radius is set per cell from the gap — see RMAX in
Accordion.tsx — because a rounded picture against a
rounded picture with no air between them shows a notch of
page at every join */}
.acc-cell img {
display: block;
width: 100%;
height: 100%;
/* ── `cover`, and the height is what fixes the scale ──────
The strip's height never changes, and the pictures are
all the same ratio, so the scale `cover` picks never
changes either. Widening a cell therefore admits more of
the photograph on each side and moves nothing that was
already showing — which is what makes this read as a
window opening rather than as a picture being pulled
about. `contain` would letterbox and a plain width would
stretch; both were the wrong answer to the same question. */
object-fit: cover;
-webkit-user-drag: none;}
// bencho source (MIT). npm i motion react · Tailwind CSS v4
// ── blocks/image-accordion/Accordion.tsx (https://github.com/cabralorenzo/bencho/blob/c65992417427bb09e661674ffa800bef29adef49/blocks/image-accordion/Accordion.tsx)
/*
MIT License
Copyright (c) 2026 Lorenzo Cabra
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
Not covered by this licence: the Bencho name and the goat mark, and the
photographs shown on bencho.dev (none are included here). Third-party
material keeps its own licence; see THIRD_PARTY.md.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
Sample photographs were replaced with Incidental AI assets. The Bencho name and goat mark are not licensed for marketing use.
*/
import { useEffect, useRef, useState } from "react";
/* ── inlined from lab/spring ──────────────────────── */
/* ── one spring, for everything that settles ───────────────
The maths was already on this bench twice, copied by hand:
Humidity's wheel and Brightness's column both accumulate
velocity toward a target, damp it, and snap when both the
delta and the velocity fall under 0.02. Two copies is a
coincidence; five would be a policy, so it comes out here
before the elastic blocks are written against it.
The two shipped copies are deliberately NOT refactored onto
this. They work, they are tuned, and rewriting the innards
of two live components to prove a point about duplication
is how a good afternoon becomes a bad one. This is the one
new code uses.
Frames, not milliseconds. `dt` is expressed in sixtieths of
a second and the damping is RAISED to it rather than
multiplied by it, so a dropped frame decays the same amount
of energy as the two frames it replaced. Multiplying is the
version that makes a spring behave differently on a busy
page, which is the hardest kind of bug to see.
The loop parks itself the moment the value has settled.
CLAUDE.md is not complimentary about the one permanent
requestAnimationFrame already on this bench and there is no
case for five more. */
/* 0..100 into the two numbers a spring actually has.
50 is what Humidity and Brightness were tuned at, which is
the rule every elastic knob on this bench follows — see
lab/motion. Turn the panel to the middle and nothing has
changed.
Both ends have to be usable, which is what fixes the range:
at 0 it is slow and heavy and still arrives, at 100 it is
quick with a visible overshoot, and nowhere in between does
it ring for longer than it takes to read. */
/* The pair is chosen by DAMPING RATIO and then written back
as stiffness and decay, because the ratio is the thing a
person is actually setting and the two numbers on their own
do not say what they add up to.
zeta = -ln(d) / (2 * sqrt(k))
The first version of this ran 0.06..0.26 stiffness against
0.93..0.74 decay, which reads as a sensible spread and is
not one: it puts zeta between 0.15 and 0.16 across the
WHOLE range, so every setting overshot by about sixty per
cent and the knob only changed how fast it did it. Pull's
return went 130px past its own resting position and lifted
the content off the top of the card.
0 → zeta ~0.85, heavy, arrives without a ring
50 → zeta ~0.41, near where Humidity and Brightness sit
100 → zeta ~0.20, lively, two visible rebounds
Both ends shippable, which is the constraint that fixed the
numbers rather than taste. */
const springOf = (tune: number) => ({
/* stiffness: how hard it is pulled toward the target */
k: 0.08 + (tune / 100) * 0.16,
/* decay, per frame: how much of the velocity survives */
d: 0.62 + (tune / 100) * 0.2,
});
/* Units matter. The snap threshold is absolute, so a caller
works in pixels or in 0..100 — a spring driven over 0..1
would be "settled" before it had visibly moved. */
function useSpring(target: number, tune = 50, instant = false) {
const [at, setAt] = useState(target);
const cur = useRef(target);
const vel = useRef(0);
const raf = useRef(0);
useEffect(() => {
if (instant) {
cur.current = target;
vel.current = 0;
setAt(target);
return;
}
const { k, d } = springOf(tune);
let prev = 0;
const tick = (t: number) => {
const dt = prev ? clamp((t - prev) / 16.67, 0, 2.5) : 1;
prev = t;
vel.current += (target - cur.current) * k * dt;
vel.current *= Math.pow(d, dt);
cur.current += vel.current * dt;
if (Math.abs(target - cur.current) < 0.02 && Math.abs(vel.current) < 0.02) {
cur.current = target;
vel.current = 0;
setAt(target);
raf.current = 0;
return;
}
setAt(cur.current);
raf.current = requestAnimationFrame(tick);
};
raf.current = requestAnimationFrame(tick);
return () => {
cancelAnimationFrame(raf.current);
raf.current = 0;
};
/* `tune` sits here beside `target` for the reason
Brightness spells out: the loop closes over it, so
without it a knob turned mid-flight would do nothing
until something else restarted the effect. Restarting
picks up from the refs, so it continues rather than
snapping. */
}, [target, tune, instant]);
return at;
}
/* Read once, the way the wheel and the pill nav do. A
preference, not a live input. */
const stillness = () =>
typeof window !== "undefined" &&
!!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
/* A drawn placeholder: Bencho's photographs are licensed to
the site and do not travel. Point this at your own. */
const SHOTS: { name: string; src: string }[] = [
{ name: "bird", src: "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20800%201200%22%20width%3D%22800%22%20height%3D%221200%22%20preserveAspectRatio%3D%22xMidYMid%20slice%22%3E%0A%3Cdefs%3E%3ClinearGradient%20id%3D%22s%22%20x1%3D%220%22%20y1%3D%220%22%20x2%3D%220%22%20y2%3D%221%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22rgb%28228%2C228%2C230%29%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22rgb%28193%2C193%2C195%29%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%0A%3Crect%20width%3D%22800%22%20height%3D%221200%22%20fill%3D%22url%28%23s%29%22%2F%3E%0A%3Ccircle%20cx%3D%22243%22%20cy%3D%22309%22%20r%3D%2272%22%20fill%3D%22rgb%28246%2C246%2C248%29%22%2F%3E%0A%3Cpath%20d%3D%22M0%2C1200%20L0%2C678.1%20L100%2C638.9%20L200%2C715.1%20L300%2C752.7%20L400%2C675.8%20L500%2C639.7%20L600%2C717.4%20L700%2C751.8%20L800%2C673.4%20L800%2C1200%20Z%22%20fill%3D%22rgb%28161%2C161%2C163%29%22%2F%3E%0A%3Cpath%20d%3D%22M0%2C1200%20L0%2C848.5%20L100%2C816.2%20L200%2C856.9%20L300%2C908.4%20L400%2C892.1%20L500%2C832.8%20L600%2C821.2%20L700%2C874.9%20L800%2C912.0%20L800%2C1200%20Z%22%20fill%3D%22rgb%28124%2C124%2C126%29%22%2F%3E%0A%3Cpath%20d%3D%22M0%2C1200%20L0%2C1049.7%20L100%2C1068.0%20L200%2C1050.9%20L300%2C1015.2%20L400%2C996.0%20L500%2C1012.3%20L600%2C1048.0%20L700%2C1067.9%20L800%2C1052.5%20L800%2C1200%20Z%22%20fill%3D%22rgb%2880%2C80%2C82%29%22%2F%3E%0A%3C%2Fsvg%3E" },
{ name: "cow", src: "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20800%201200%22%20width%3D%22800%22%20height%3D%221200%22%20preserveAspectRatio%3D%22xMidYMid%20slice%22%3E%0A%3Cdefs%3E%3ClinearGradient%20id%3D%22s%22%20x1%3D%220%22%20y1%3D%220%22%20x2%3D%220%22%20y2%3D%221%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22rgb%28237%2C237%2C239%29%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22rgb%28196%2C196%2C198%29%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%0A%3Crect%20width%3D%22800%22%20height%3D%221200%22%20fill%3D%22url%28%23s%29%22%2F%3E%0A%3Ccircle%20cx%3D%22338%22%20cy%3D%22400%22%20r%3D%2272%22%20fill%3D%22rgb%28246%2C246%2C248%29%22%2F%3E%0A%3Cpath%20d%3D%22M0%2C1200%20L0%2C636.0%20L100%2C678.1%20L200%2C745.7%20L300%2C742.5%20L400%2C673.1%20L500%2C636.3%20L600%2C684.6%20L700%2C749.1%20L800%2C738.0%20L800%2C1200%20Z%22%20fill%3D%22rgb%28166%2C166%2C168%29%22%2F%3E%0A%3Cpath%20d%3D%22M0%2C1200%20L0%2C908.0%20L100%2C863.4%20L200%2C819.5%20L300%2C830.1%20L400%2C882.2%20L500%2C912.0%20L600%2C883.0%20L700%2C830.8%20L800%2C819.2%20L800%2C1200%20Z%22%20fill%3D%22rgb%28119%2C119%2C121%29%22%2F%3E%0A%3Cpath%20d%3D%22M0%2C1200%20L0%2C998.3%20L100%2C1000.7%20L200%2C1025.8%20L300%2C1055.3%20L400%2C1068.0%20L500%2C1054.7%20L600%2C1025.1%20L700%2C1000.4%20L800%2C998.5%20L800%2C1200%20Z%22%20fill%3D%22rgb%2891%2C91%2C93%29%22%2F%3E%0A%3C%2Fsvg%3E" },
{ name: "house", src: "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20800%201200%22%20width%3D%22800%22%20height%3D%221200%22%20preserveAspectRatio%3D%22xMidYMid%20slice%22%3E%0A%3Cdefs%3E%3ClinearGradient%20id%3D%22s%22%20x1%3D%220%22%20y1%3D%220%22%20x2%3D%220%22%20y2%3D%221%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22rgb%28223%2C223%2C225%29%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22rgb%28193%2C193%2C195%29%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%0A%3Crect%20width%3D%22800%22%20height%3D%221200%22%20fill%3D%22url%28%23s%29%22%2F%3E%0A%3Ccircle%20cx%3D%22452%22%20cy%3D%22314%22%20r%3D%2272%22%20fill%3D%22rgb%28246%2C246%2C248%29%22%2F%3E%0A%3Cpath%20d%3D%22M0%2C1200%20L0%2C753.4%20L100%2C725.1%20L200%2C650.7%20L300%2C648.1%20L400%2C721.3%20L500%2C754.5%20L600%2C695.0%20L700%2C637.1%20L800%2C672.5%20L800%2C1200%20Z%22%20fill%3D%22rgb%28154%2C154%2C156%29%22%2F%3E%0A%3Cpath%20d%3D%22M0%2C1200%20L0%2C881.3%20L100%2C828.0%20L200%2C821.7%20L300%2C870.6%20L400%2C910.9%20L500%2C889.9%20L600%2C835.1%20L700%2C818.0%20L800%2C861.0%20L800%2C1200%20Z%22%20fill%3D%22rgb%28121%2C121%2C123%29%22%2F%3E%0A%3Cpath%20d%3D%22M0%2C1200%20L0%2C997.4%20L100%2C1007.9%20L200%2C1045.4%20L300%2C1067.9%20L400%2C1050.3%20L500%2C1012.2%20L600%2C996.3%20L700%2C1020.3%20L800%2C1057.4%20L800%2C1200%20Z%22%20fill%3D%22rgb%2891%2C91%2C93%29%22%2F%3E%0A%3C%2Fsvg%3E" },
{ name: "man", src: "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20800%201200%22%20width%3D%22800%22%20height%3D%221200%22%20preserveAspectRatio%3D%22xMidYMid%20slice%22%3E%0A%3Cdefs%3E%3ClinearGradient%20id%3D%22s%22%20x1%3D%220%22%20y1%3D%220%22%20x2%3D%220%22%20y2%3D%221%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22rgb%28223%2C223%2C225%29%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22rgb%28181%2C181%2C183%29%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%0A%3Crect%20width%3D%22800%22%20height%3D%221200%22%20fill%3D%22url%28%23s%29%22%2F%3E%0A%3Ccircle%20cx%3D%22219%22%20cy%3D%22318%22%20r%3D%2272%22%20fill%3D%22rgb%28246%2C246%2C248%29%22%2F%3E%0A%3Cpath%20d%3D%22M0%2C1200%20L0%2C734.1%20L100%2C664.9%20L200%2C637.3%20L300%2C688.3%20L400%2C749.6%20L500%2C739.2%20L600%2C671.1%20L700%2C636.2%20L800%2C681.4%20L800%2C1200%20Z%22%20fill%3D%22rgb%28158%2C158%2C160%29%22%2F%3E%0A%3Cpath%20d%3D%22M0%2C1200%20L0%2C861.3%20L100%2C816.1%20L200%2C856.9%20L300%2C910.5%20L400%2C880.7%20L500%2C821.0%20L600%2C838.4%20L700%2C901.7%20L800%2C897.4%20L800%2C1200%20Z%22%20fill%3D%22rgb%28123%2C123%2C125%29%22%2F%3E%0A%3Cpath%20d%3D%22M0%2C1200%20L0%2C1065.8%20L100%2C1064.9%20L200%2C1045.3%20L300%2C1018.2%20L400%2C998.9%20L500%2C998.4%20L600%2C1016.9%20L700%2C1044.0%20L800%2C1064.3%20L800%2C1200%20Z%22%20fill%3D%22rgb%2882%2C82%2C84%29%22%2F%3E%0A%3C%2Fsvg%3E" },
{ name: "queue", src: "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20800%201200%22%20width%3D%22800%22%20height%3D%221200%22%20preserveAspectRatio%3D%22xMidYMid%20slice%22%3E%0A%3Cdefs%3E%3ClinearGradient%20id%3D%22s%22%20x1%3D%220%22%20y1%3D%220%22%20x2%3D%220%22%20y2%3D%221%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22rgb%28223%2C223%2C225%29%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22rgb%28174%2C174%2C176%29%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%0A%3Crect%20width%3D%22800%22%20height%3D%221200%22%20fill%3D%22url%28%23s%29%22%2F%3E%0A%3Ccircle%20cx%3D%22301%22%20cy%3D%22405%22%20r%3D%2272%22%20fill%3D%22rgb%28246%2C246%2C248%29%22%2F%3E%0A%3Cpath%20d%3D%22M0%2C1200%20L0%2C735.3%20L100%2C651.0%20L200%2C655.9%20L300%2C740.3%20L400%2C736.9%20L500%2C652.5%20L600%2C654.3%20L700%2C738.8%20L800%2C738.5%20L800%2C1200%20Z%22%20fill%3D%22rgb%28158%2C158%2C160%29%22%2F%3E%0A%3Cpath%20d%3D%22M0%2C1200%20L0%2C903.3%20L100%2C846.3%20L200%2C816.5%20L300%2C859.7%20L400%2C909.5%20L500%2C889.4%20L600%2C830.3%20L700%2C823.0%20L800%2C878.7%20L800%2C1200%20Z%22%20fill%3D%22rgb%28119%2C119%2C121%29%22%2F%3E%0A%3Cpath%20d%3D%22M0%2C1200%20L0%2C1062.6%20L100%2C1037.2%20L200%2C1008.1%20L300%2C996.0%20L400%2C1009.5%20L500%2C1038.9%20L600%2C1063.5%20L700%2C1065.7%20L800%2C1043.9%20L800%2C1200%20Z%22%20fill%3D%22rgb%2884%2C84%2C86%29%22%2F%3E%0A%3C%2Fsvg%3E" },
];
/* ══ Image accordion ═══════════════════════════════════════
A row of pictures cropped to slivers. Point at one and it
opens; the others give up exactly what it takes.
── THE ROW IS A FIXED WIDTH, AND THAT IS THE COMPONENT ───
Nothing here grows. The strip is 340px whatever is
happening inside it, so opening a picture is a NEGOTIATION
rather than an expansion: every pixel the one you are
pointing at gains, the other four have paid for between
them. That is what makes it feel like one object with
pieces rather than five cards that happen to be in a line —
and it is why the layout is flexbox with five grow numbers
rather than five widths worked out by hand. Flex does the
arithmetic of who pays, at every count and every gap, and
it cannot be got wrong.
── AND THE SWELL CARRIES ─────────────────────────────────
The neighbours of the open picture open a little too. The
reflex is one panel wide and four panels narrow, which
reads as a switch being thrown; a falloff reads as a force
arriving somewhere. Same argument the magnetic select makes
about its cluster, and the same shape of arithmetic.
`Reach` is that falloff, exposed — and it is the knob worth
having here, because the two ends are two different
components. Tight, ONE picture opens and the rest stay a
set of slivers. Wide, the whole row leans toward your
cursor and the open one is only the middle of a swell.
── WHY POINTING IS STABLE ────────────────────────────────
Worth writing down, because a row that resizes under the
cursor sounds like it should oscillate and does not: the
picture you point at is the one that GROWS. Its edges move
away from your pointer, never across it, so it cannot
shrink out from under you and hand the hover to a
neighbour. Everything that shrinks is something you are not
on.
Taken from a pattern Toggle Supply publishes — the fixed
row, the falloff into the neighbours, the cover crop that
re-frames instead of stretching. Written from scratch
against Bencho's own spring and knobs rather than copied. */
const clamp = (v: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, v));
/* ── the strip's own size ──────────────────────────────────
Fixed, like every block here: the wall measures what a
component draws and scales it, so a block that sized itself
from its container would be a different shape in the wall,
the overlay and the canvas.
340 across and 300 down. At the default gap that is five
pictures a little under 62 wide against 300 tall — about
one to five, which is the ratio at which a photograph stops
being a photograph and becomes a stripe of colour. That is
the point of the shut state: you can see there are five
pictures and you cannot see what any of them is.
The strip's width is NOT a function of the count. Take a
picture out of KEEP and the rest get wider rather than the
block getting narrower — which is the right way round: the
wall scales a block by its longest side, so a narrower strip
would be a TALLER tile drawn smaller, and the block would
change its footprint over a decision about its contents. */
const W = 340;
const H = 300;
/* ── the pictures ──────────────────────────────────────────
The carousel's five, reused rather than another set of
photographs inlined into the bundle. They are already
800x1200 portrait, which is the one shape this block wants,
and a second 150KB of base64 to show the same idea would be
most of a megabyte of prompt for the person who copies it.
── NAMED, NOT TAKEN WHOLE ───────────────────────────────
`SHOTS` itself would do the same thing today and would
silently do something else the moment a sixth picture went
into src/assets/carousel: the order there is whatever the
filenames sort to, so a new file would arrive in this strip
and change what it is, unasked. shots.ts carries each
filename for exactly this reason and the carousel already
picks by name.
So this list is the block's own, and it is the one place to
change what is in the strip or how many. */
const KEEP = ["bird", "cow", "house", "man", "queue"];
const PICS = KEEP.map((name) => SHOTS.find((s) => s.name === name)!);
/* ── the corner, and it FOLLOWS THE GAP ────────────────────
A rounded picture next to a rounded picture with no air
between them leaves a little notch of page showing at every
join — eight of them, top and bottom, right down the middle
of the strip. The usual fix is to pin the radius, which
trades a knob for a bug.
So the radius is the gap, capped at its own maximum. At Gap
0 the pictures are square and the strip is one continuous
band; by Gap 12 each picture is fully rounded and standing
on its own. There is no setting in between where a notch
can appear, because the radius can never be larger than the
air it has to fit into.
── AND THE STRIP TAKES THE SAME NUMBER ──────────────────
It used to keep a flat 12 of its own and clip, on the
argument that the band should have round outer corners at
Gap 0 whatever the pictures were doing. That argument was
wrong and the result was visible: the strip's clip cuts the
first picture's LEFT corners and the last one's RIGHT, so
at any gap under 12 the two pictures on the ends were
rounder on their outside edge than on their inside one, and
rounder than the three in the middle. Five pictures, three
different corners. Measured at the default: 12 on the ends
against 8 everywhere else.
One number now, read by the strip and by every picture in
it, so they cannot disagree. The cost is real and small:
at Gap 0 the band's own corners are square too. The clip
stays, because flex widths land on fractions and a cell can
overhang its container by a sub-pixel. */
const RMAX = 12;
/* ── how much the open one takes ───────────────────────────
As a share of what an unopened picture has. 50 is the value
this was drawn at — 1.8, so the open picture is nearly
three times a resting one — which is the rule every elastic
knob here follows: turn the panel to the middle and nothing
has changed.
Both ends are a row of pictures. At 0 it is a lean rather
than an opening, which is a real and quieter version of
this block; at 100 the open one is about two fifths of the
strip and the rest are edges. */
const lift = (open: number) => 0.4 + (clamp(open, 0, 100) / 100) * 2.8;
/* ── and how far the swell carries ─────────────────────────
A gaussian on the distance in pictures, so it is smooth and
it never reaches a sixth picture in a row of five with
anything you could see.
0.35 puts the first neighbour at three ten-thousandths —
off, in every sense that matters — and 1.25 puts it at
better than half. The default of 35 lands it at a tenth,
which is where a neighbour is visibly paying less than the
ones further out without looking like it is opening too. */
const fall = (d: number, reach: number) => {
const s = 0.35 + (clamp(reach, 0, 100) / 100) * 0.9;
return Math.exp(-((d / s) ** 2));
};
export function Accordion({
/* how much the open picture takes, 0..100 */
open = 50,
/* how far the swell carries into its neighbours, 0..100 */
reach = 35,
/* the spring, 0..100 — see springOf in ./spring */
bounce = 10,
/* the air between pictures, in px. The corner follows it. */
gap = 8,
}: {
open?: number;
reach?: number;
bounce?: number;
gap?: number;
} = {}) {
/* which picture the pointer is on, by index. Null rather
than -1 so "none" cannot be confused with the first. */
const [at, setAt] = useState<number | null>(null);
const still = stillness();
/* ── one spring each, and NO stagger ───────────────────────
Every other cascade on this bench opens one element after
another, and it would be wrong here. These five are not
five things responding in turn, they are one width being
divided — if the picture at the end gave up its share a
beat after the one next to it, the strip would visibly
fail to add up for that beat. They move together because
they are the same measurement.
Five, and one per picture: a hook cannot be drawn
conditionally, and the count is the number of pictures
rather than a knob — so KEEP above and this list are the
same length, and changing one is changing both.
Driven over 0..100 rather than over the grow number
itself, which is the units note on useSpring — a spring
run across a range of two would be settled before it had
visibly moved. */
const want = (i: number) => (at === null ? 0 : fall(Math.abs(i - at), reach) * 100);
const a0 = useSpring(want(0), bounce, still);
const a1 = useSpring(want(1), bounce, still);
const a2 = useSpring(want(2), bounce, still);
const a3 = useSpring(want(3), bounce, still);
const a4 = useSpring(want(4), bounce, still);
const swell = [a0, a1, a2, a3, a4];
const g = clamp(gap, 0, 20);
const k = lift(open);
return (
<div
className="acc"
/* the same radius the pictures take — see RMAX */
style={{ width: W, height: H, gap: g, borderRadius: Math.min(RMAX, g) }}
/* ── `out` with a containment test, not `leave` ───────
The same swap the tilt card and the card stack make,
and for the same reason: the rehearsal's last beat
walks a scripted pointer off the block carrying
`relatedTarget: null`, which React never turns into a
leave — so every copy on the wall would finish its
demo with a picture still held open. */
onPointerOut={(e) => {
const to = e.relatedTarget as Node | null;
if (!to || !e.currentTarget.contains(to)) setAt(null);
}}
onPointerCancel={() => setAt(null)}
>
{PICS.map((pic, i) => {
const u = swell[i] / 100;
return (
<div
key={pic.name}
className="acc-cell"
data-open={at === i || undefined}
style={{
/* the whole layout, in one number per picture.
`flex-basis: 0` so the grow numbers are the
entire story and the pictures' own widths have
no vote — which is also why the cell carries
`min-width: 0` in the sheet: a flex item will
not shrink below its content by default, and
the content here is an image. */
flexGrow: 1 + k * u,
borderRadius: Math.min(RMAX, g),
}}
onPointerEnter={() => {
if (at === i) return;
setAt(i);
/* the dock's note: a sound carrying `at` turns
running along a set into a scale rather than a
row of identical clicks */
}}
>
{/* `cover` re-frames rather than stretching, which
is the whole reason this reads as a window
opening onto a picture instead of a picture
being pulled about. The scale is set by the
height, and the height never changes — so as
the cell widens the crop simply admits more of
the photograph on both sides, and nothing in it
moves or resizes. */}
<img src={pic.src} alt="" draggable={false} />
{/* ── AND THERE IS NOTHING OVER THE PICTURE ──────
The filename sat here in the corner of whichever
one was open, on a scrim to keep it legible over
snow. Both are gone.
The argument for it was that the point of
opening a panel is holding something a sliver
cannot — which is a true thing about accordions
and was not true about this one. What it
actually held was a word nobody needed, and the
scrim it needed in order to be read was a dark
wash laid across the bottom of the one
photograph you had just asked to see more of.
The block says the picture being looked at is
the one you can see more of; a caption over it
is the first thing arguing with that. */}
</div>
);
})}
</div>
);
}컨트롤 · HTML · CSS · JS
코드를 고치고 컨트롤로 다듬어 보세요. 입력하는 대로 미리보기가 바뀝니다.

이 컴포넌트는 번들된 빌드로 실행되므로 여기서는 스크립트를 읽기만 할 수 있습니다. HTML과 CSS는 수정할 수 있고 전체 소스는 코드 탭에 있습니다.
모든 컴포넌트를 바로 편집하고, 컨트롤로 다듬고, 전체 소스를 내려받고, 고급 프롬프트를 복사하세요.
1회 결제 $49임시 가격
테스트 모드: 실제 결제는 이루어지지 않습니다.
무료: 미리보기, 복사 버튼, 레슨 설명.
넉넉한 여백, 부드러운 모서리, 하나의 강조색이 내용을 앞에 세웁니다.
기능 목록, 프로필, 상품 타일, 대시보드.
여백, 그림자 깊이, 강조색을 조정합니다.
Bencho (github.com/cabralorenzo/bencho)(MIT)의 "Image accordion" 컴포넌트를 내 React + Tailwind CSS 앱에 추가해 줘. 소스 파일: https://github.com/cabralorenzo/bencho/blob/c65992417427bb09e661674ffa800bef29adef49/blocks/image-accordion/Accordion.tsx. 넉넉한 여백, 부드러운 모서리, 하나의 강조색이 내용을 앞에 세웁니다. 사용처: 기능 목록, 프로필, 상품 타일, 대시보드. 조정할 설정: 여백, 그림자 깊이, 강조색을 조정합니다. 라이트와 다크 테마를 지원하고 prefers-reduced-motion을 존중해 줘. MIT 라이선스 고지는 유지해 줘.
조정, 접근성, 연동 단계까지 담은 긴 프롬프트입니다.