성능
주의프레임 속도: 평균 60 fps, p5 59.9 · 긴 작업: 0개, 총 0 ms, 최장 0 ms · 소스 gzip 11 KB · 런타임 291 KB
Emoji reactionsMIT버튼Bencho
Lorenzo Cabra가 만든 버튼 React 컴포넌트입니다. MIT 라이선스에 따라 Bencho에서 수정 없이 수집했으며 여기서 실시간으로 보여 줍니다.
품질 보고
등급과 점수는 빌드 또는 테스트 때 실행한 자동 검사에서 나옵니다. 실행하지 않은 항목은 '미검사'로 표시하며, 숫자를 지어내지 않습니다.
프레임 속도: 평균 60 fps, p5 59.9 · 긴 작업: 0개, 총 0 ms, 최장 0 ms · 소스 gzip 11 KB · 런타임 291 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;
}
}
/* Reactions.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.
*/
/* ══ Emoji reactions ═════════════════════════════════════ */
.rxn {
position: relative;
width: 300px;
/* the pill needs room above the row; the message gives it.
No left inset: at 16px the message fills the 300px frame
itself, so the block sits in the middle of its card while
everything in it stays left-aligned */
padding: 8px 0 0 0;
font-family: var(--font-ui);
color: var(--fill-on, var(--ink));}
/* the name and time on their own line, then the message as a
pill that hugs its words */
.rxn-msg {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 8px;}
.rxn-who {
display: flex;
align-items: center;
gap: 8px;
padding-left: 4px;
font-size: 12px;
letter-spacing: 0em;}
.rxn-face {
width: 20px;
height: 20px;
border-radius: 50%;
object-fit: cover;}
.rxn-who b { font-weight: 500; }
.rxn-who span { color: color-mix(in srgb, var(--fill-on, #17181a) 52%, var(--fill-slab, #ffffff)); }
/* the message's pill, and the picker it turns into: the surface is
this, its width and corner sprung by the component */
.rxn-morph {
position: relative;
/* the words sit in the middle of the pill whatever width the
spring is at, so a measuring pixel can never pile up on one side */
display: flex;
align-items: center;
justify-content: center;
background: var(--fill-slab, var(--card));
border-radius: var(--rxn-r);}
[data-stroke="on"] .rxn-morph { box-shadow: 0 0 0 1px var(--pane-edge); }
.rxn-text {
display: block;
width: max-content;
padding: 0 20px;
font-size: 16px;
line-height: 22px;
white-space: nowrap;
transform-origin: 50% 50%;
letter-spacing: -0.01em;}
.rxn-row {
position: relative;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
min-height: 36px;
margin-top: 8px;}
.rxn-chip {
display: flex;
align-items: center;
gap: 8px;
height: 36px;
padding: 0 16px 0 12px;
border: 0;
border-radius: 999px;
background: var(--fill-slab, var(--card));
color: inherit;
font: inherit;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: background-color 160ms ease, box-shadow 160ms ease;
letter-spacing: -0.01em;}
/* the ones you are in carry a coloured edge — the fill stays the
chip's own */
.rxn-chip[data-mine] {
background: var(--fill-slab, var(--card));
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--signal, #2231dd) 35%, transparent);
color: var(--signal, #2231dd);}
/* the signal blue is too deep on a dark chip: a lighter blue there */
[data-theme="dark"] .rxn-chip[data-mine],
[data-fill="dark"] .rxn-chip[data-mine] {
color: #8c9bff;
box-shadow: inset 0 0 0 1px rgba(140, 155, 255, 0.4);}
[data-theme="dark"] [data-fill="light"] .rxn-chip[data-mine] {
color: var(--signal, #2231dd);
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--signal, #2231dd) 35%, transparent);}
.rxn-chip-e { font-size: 20px; line-height: 1; transition: opacity 160ms ease; letter-spacing: -0.02em; }
.rxn-chip-e[data-landing] { opacity: 0; }
/* ── each emoji's own arrival ─────────────────────────────── */
.rxn-p {
position: relative;
display: inline-block;
font-style: normal;
line-height: 1;}
.rxn-p[data-play][data-k="launch"] { animation: rxn-launch 640ms cubic-bezier(0.3, 1.2, 0.4, 1); }
/* its exhaust: a small puff left behind under it */
.rxn-p[data-play][data-k="launch"]::after {
content: "";
position: absolute;
left: 20%;
top: 70%;
width: 7px;
height: 7px;
border-radius: 50%;
background: color-mix(in srgb, var(--fill-on, #17181a) 20%, transparent);
animation: rxn-puff 520ms ease-out forwards;}
.rxn-p[data-play][data-k="flicker"] { animation: rxn-flicker 620ms ease-out; }
.rxn-p[data-play][data-k="confetti"] { animation: rxn-pop 420ms cubic-bezier(0.3, 1.6, 0.4, 1); }
.rxn-bits { position: absolute; left: 50%; top: 50%; pointer-events: none; }
.rxn-bits b {
position: absolute;
width: 3px;
height: 3px;
margin: -1.5px;
border-radius: 1px;
background: var(--c);
animation: rxn-bit 560ms cubic-bezier(0.2, 0.8, 0.3, 1) forwards;}
.rxn-p[data-play][data-k="glance"] { animation: rxn-glance 700ms ease-in-out; }
.rxn-p[data-play][data-k="tick"] { animation: rxn-tick 460ms cubic-bezier(0.3, 1.6, 0.4, 1); }
.rxn-p[data-play][data-k="beat"] { animation: rxn-beat 620ms ease-in-out; }
.rxn-p[data-play][data-k="nod"] { animation: rxn-nod 520ms cubic-bezier(0.3, 1.4, 0.4, 1); transform-origin: 50% 90%; }
.rxn-p[data-play][data-k="laugh"] { animation: rxn-laugh 560ms ease-in-out; }
.rxn-p[data-play][data-k="wow"] { animation: rxn-wow 520ms cubic-bezier(0.3, 1.5, 0.4, 1); transform-origin: 50% 100%; }
.rxn-p[data-play][data-k="droop"] { animation: rxn-droop 700ms ease-in-out; transform-origin: 50% 100%; }
.rxn-p[data-play][data-k="bow"] { animation: rxn-bow 620ms ease-in-out; transform-origin: 50% 100%; }
@media (prefers-reduced-motion: reduce) {
.rxn-p[data-play], .rxn-p[data-play]::after, .rxn-bits b { animation: none; }
}
.rxn-count { display: inline-flex; font-variant-numeric: tabular-nums; }
.rxn-col { display: inline-block; height: 1.4em; overflow: hidden; line-height: 1.4em; }
.rxn-strip {
display: flex;
flex-direction: column;
transition: transform 220ms cubic-bezier(0.24, 1.34, 0.38, 1);}
.rxn-strip > span { height: 1.4em; }
.rxn-add-wrap { display: flex; }
.rxn-add {
display: grid;
place-items: center;
width: 36px;
height: 36px;
padding: 0;
border: 0;
border-radius: 999px;
background: var(--fill-slab, var(--card));
color: color-mix(in srgb, var(--fill-on, #17181a) 52%, var(--fill-slab, #ffffff));
cursor: pointer;
/* a finger holds and slides from here: no scroll, no text
selection, no system menu getting in the way */
touch-action: none;
user-select: none;
-webkit-user-select: none;
-webkit-touch-callout: none;
transition: color 160ms ease, scale 160ms cubic-bezier(0.24, 1.34, 0.38, 1);}
.rxn-add:hover, .rxn-add[aria-expanded="true"] { color: var(--fill-on, var(--ink)); scale: 1.06; }
/* the pill floats above the row, from the row's start, so it
never runs off the block whatever the chips have pushed the
button to */
/* the emoji row, laid inside the message's pill once it has opened */
.rxn-pill {
position: absolute;
z-index: 5;
left: 0;
top: 0;
display: flex;
align-items: center;
/* the same 6px round the row on every side — the emoji's own
box is its glyph, so the air above and below is the padding
and nothing else */
padding: 8px;}
.rxn-emo {
display: grid;
place-items: center;
width: 34px;
height: 30px;
padding: 0;
border: 0;
background: transparent;
cursor: pointer;}
.rxn-emo span {
display: block;
font-size: 20px;
line-height: 1;
transform: scale(var(--s, 1));
transform-origin: 50% 90%;
/* still one at a time, but it eases up to size and back with a
soft settle rather than snapping */
transition: transform 220ms cubic-bezier(0.24, 1.34, 0.38, 1);
letter-spacing: -0.02em;}
.rxn-tip {
position: absolute;
bottom: calc(100% + 10px);
translate: -50% 0;
padding: 4px 8px;
border-radius: 6px;
background: var(--slab, #17181a);
color: var(--on-slab, #fff);
font-size: 11px;
font-weight: 400;
white-space: nowrap;
pointer-events: none;
letter-spacing: 0em;}
.rxn-fly {
position: absolute;
z-index: 6;
left: 0;
top: 0;
width: 24px;
height: 24px;
margin: -12px 0 0 -12px;
display: grid;
place-items: center;
font-size: 16px;
pointer-events: none;
letter-spacing: -0.01em;}
@keyframes rxn-launch {
0% { transform: translate(0, 0) rotate(0); }
30% { transform: translate(2px, -7px) rotate(-12deg); }
60% { transform: translate(-1px, 1px) rotate(4deg); }
100% { transform: translate(0, 0) rotate(0); }}
@keyframes rxn-puff {
0% { opacity: 0; transform: scale(0.4); }
25% { opacity: 1; }
100% { opacity: 0; transform: translate(-5px, 6px) scale(1.6); }}
@keyframes rxn-flicker {
0% { transform: scale(1); filter: brightness(1); }
15% { transform: scale(1.18, 1.1); filter: brightness(1.35); }
30% { transform: scale(0.94, 1.08); filter: brightness(1); }
48% { transform: scale(1.1, 0.96); filter: brightness(1.25); }
66% { transform: scale(0.98, 1.04); }
100% { transform: scale(1); filter: brightness(1); }}
@keyframes rxn-pop { 0% { transform: scale(0.7) rotate(-12deg); } 50% { transform: scale(1.18) rotate(6deg); } 100% { transform: none; } }
@keyframes rxn-bit {
0% { transform: rotate(var(--a)) translateY(0) scale(1); opacity: 1; }
100% { transform: rotate(var(--a)) translateY(-16px) scale(0.6); opacity: 0; }}
@keyframes rxn-glance {
0%, 100% { transform: translateX(0); }
25% { transform: translateX(-2.5px); }
60% { transform: translateX(2.5px); }}
@keyframes rxn-tick { 0% { transform: scale(0.6) rotate(-14deg); } 55% { transform: scale(1.2) rotate(4deg); } 100% { transform: none; } }
@keyframes rxn-beat {
0%, 100% { transform: scale(1); }
15% { transform: scale(1.26); }
30% { transform: scale(1); }
45% { transform: scale(1.18); }
60% { transform: scale(1); }}
@keyframes rxn-nod { 0% { transform: rotate(0); } 35% { transform: rotate(-16deg) translateY(-2px); } 100% { transform: rotate(0); } }
@keyframes rxn-laugh {
0%, 100% { transform: rotate(0); }
20% { transform: rotate(-10deg); }
40% { transform: rotate(9deg); }
60% { transform: rotate(-7deg); }
80% { transform: rotate(4deg); }}
@keyframes rxn-wow { 0% { transform: scale(1); } 35% { transform: scale(0.92, 1.22); } 100% { transform: scale(1); } }
@keyframes rxn-droop { 0%, 100% { transform: none; } 40% { transform: translateY(2px) rotate(-8deg) scale(0.96); } }
@keyframes rxn-bow { 0%, 100% { transform: none; } 40% { transform: translateY(2px) scale(1, 0.9); } 60% { transform: translateY(1px) scale(1, 0.95); } }
// bencho source (MIT). npm i @tabler/icons-react motion react · Tailwind CSS v4
// ── blocks/emoji-reactions/Reactions.tsx (https://github.com/cabralorenzo/bencho/blob/c65992417427bb09e661674ffa800bef29adef49/blocks/emoji-reactions/Reactions.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, useLayoutEffect, useRef, useState } from "react";
import { AnimatePresence, motion } from "motion/react";
import { IconMoodPlus as SmilePlus } from "@tabler/icons-react";
/* ══ Emoji reactions ══════════════════════════════════════
A message, the reactions under it, and a button that turns the
MESSAGE ITSELF into a pill of emoji. Pick one and it FLIES from
the pill down to its chip, lands with a squash, and the count
rolls up — and the pill turns back into the message.
── THE MESSAGE BECOMES THE PICKER ──────────────────────
One surface, two contents. Opening, the message's pill eases
to the width of the emoji row while its words fade and blur
away and the emoji rise in, one after another; closing runs it
back. Nothing appears from nowhere above the row — the thing
you were reacting to is what offers the reactions.
── ONE EMOJI AT A TIME ─────────────────────────────────
The emoji under the pointer is big and every other one is its
own size — no falloff into the neighbours, and a quick pop
rather than a slow grow, so it is always clear which one a
press will pick. A small label names it.
── A REACTION TRAVELS ──────────────────────────────────
The chip it is going to is laid out first, with its emoji held
back, so the landing spot is a real measured place; then a
copy arcs there from where you picked it, and only when it
lands does the chip show it and the count move. The count
rolls, a digit strip like the counter's, so a reaction you add
is a number going up rather than a number being replaced.
── YOURS, AND EVERYONE ELSE'S ──────────────────────────
Chips others left sit plain; the ones you are in are tinted.
Press a chip to add yourself, or to take yourself off — at
nobody left it shrinks away. */
/* ── 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. */
/* 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;
const SETS: Record<string, { e: string; label: string }[]> = {
Work: [
{ e: "👍", label: "Nice" }, { e: "🎉", label: "Celebrate" }, { e: "👀", label: "Looking" },
{ e: "✅", label: "Done" }, { e: "🚀", label: "Ship it" }, { e: "🔥", label: "Fire" },
],
Classic: [
{ e: "👍", label: "Like" }, { e: "❤️", label: "Love" }, { e: "😂", label: "Haha" },
{ e: "😮", label: "Wow" }, { e: "😢", label: "Sad" }, { e: "🙏", label: "Thanks" },
],
Hearts: [
{ e: "❤️", label: "Red" }, { e: "🧡", label: "Orange" }, { e: "💛", label: "Yellow" },
{ e: "💚", label: "Green" }, { e: "💙", label: "Blue" }, { e: "💜", label: "Purple" },
],
};
type Chip = { e: string; n: number; mine: boolean; landing: boolean };
/* ── every emoji has a way of arriving ──────────────────────
Not one generic bounce for all of them: the rocket launches,
the fire flickers, the party popper bursts, the eyes glance.
It plays when a reaction lands on its chip, when you join a
chip, and when you rest on it in the pill. */
const KIND: Record<string, string> = {
"🚀": "launch", "🔥": "flicker", "🎉": "confetti", "👀": "glance", "✅": "tick",
"👍": "nod", "😂": "laugh", "😮": "wow", "😢": "droop", "🙏": "bow",
"❤️": "beat", "🧡": "beat", "💛": "beat", "💚": "beat", "💙": "beat", "💜": "beat",
};
/* the emoji, wearing its own motion when `play` is on. The party
popper's confetti is six dots flung out at set angles */
function Emo({ e, play }: { e: string; play: boolean }) {
const k = KIND[e] ?? "nod";
return (
<i className="rxn-p" data-k={k} data-play={play || undefined}>
{e}
{play && k === "confetti" && (
<span className="rxn-bits" aria-hidden="true">
{[0, 60, 120, 180, 240, 300].map((a, i) => (
<b key={a} style={{ "--a": `${a + 15}deg`, "--c": ["#f5a524", "#e5484d", "#2f6bff", "#12a150", "#a855f7", "#f5a524"][i] } as React.CSSProperties} />
))}
</span>
)}
</i>
);
}
type Flight = { e: string; fx: number; fy: number; tx: number; ty: number };
const START: Chip[] = [
{ e: "🚀", n: 3, mine: false, landing: false },
{ e: "🔥", n: 2, mine: false, landing: false },
];
const EMO = 34;
/* a count whose digits roll */
function Count({ n }: { n: number }) {
const s = String(Math.max(0, n));
return (
<span className="rxn-count" aria-label={s}>
{s.split("").map((d, i) => (
<span key={s.length - i} className="rxn-col">
<span className="rxn-strip" style={{ transform: `translateY(${-Number(d) * 1.4}em)` }}>
{"0123456789".split("").map((x) => <span key={x}>{x}</span>)}
</span>
</span>
))}
</span>
);
}
export function Reactions({
/* how much the emoji under the pointer swells, 0..100 */
magnify = 50,
/* how springy the pill and the landings are, 0..100 */
bounce = 45,
set = "Work",
corner = 20,
}: {
magnify?: number;
bounce?: number;
set?: string;
corner?: number;
} = {}) {
const still = stillness();
const emo = SETS[set] ?? SETS.Work;
const [chips, setChips] = useState<Chip[]>(START);
const [open, setOpen] = useState(false);
const [hx, setHx] = useState<number | null>(null);
const [flight, setFlight] = useState<Flight | null>(null);
/* the chip that has just been landed on, for its squash */
const [landed, setLanded] = useState<string | null>(null);
const pending = useRef<{ e: string; fx: number; fy: number } | null>(null);
const root = useRef<HTMLDivElement>(null);
const shut = useRef(0);
useEffect(() => () => clearTimeout(shut.current), []);
const spring = { type: "spring" as const, bounce: (bounce / 100) * 0.55, duration: 0.42 };
/* the message turning into the picker is quicker than a landing:
it answers a press, so it should feel immediate */
const quick = { type: "spring" as const, bounce: (bounce / 100) * 0.45, duration: 0.22 };
/* ── opening and closing the pill ──────────────────────────
A mouse CLICKS the button to open it and clicks again, or
anywhere else, to shut it; passing over the button does
nothing. A finger HOLDS the button: after a beat the pill
opens, and without lifting the finger slides along it, the
emoji under it swelling, and lifts on the one it wants — or
off the pill, which picks nothing. A quick tap still toggles
it, for anybody who does not know to hold. */
const show = () => {
clearTimeout(shut.current);
if (!open) { setOpen(true); }
};
const hide = (ms = 0) => {
clearTimeout(shut.current);
shut.current = window.setTimeout(() => { setOpen(false); setHx(null); }, ms);
};
const pill = useRef<HTMLDivElement>(null);
/* the message's own width, so the pill can spring to and from it */
const textRef = useRef<HTMLSpanElement>(null);
const [textW, setTextW] = useState(0);
useLayoutEffect(() => {
if (textRef.current) setTextW(textRef.current.offsetWidth);
}, [corner]);
const hold = useRef<{ t: number; sliding: boolean; touch: boolean }>({ t: 0, sliding: false, touch: false });
/* a press anywhere outside the button and the pill shuts it */
useEffect(() => {
if (!open) return;
const away = (e: PointerEvent) => {
/* the button and the picker both count as inside */
const wrap = root.current?.querySelector(".rxn-add-wrap");
const msg = root.current?.querySelector(".rxn-morph");
const n = e.target as Node;
if (wrap && !wrap.contains(n) && !msg?.contains(n)) hide();
};
document.addEventListener("pointerdown", away, true);
return () => document.removeEventListener("pointerdown", away, true);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [open]);
/* where a finger is along the pill, in the pill's own pixels */
const along = (clientX: number) => {
const p = pill.current;
if (!p) return null;
const b = p.getBoundingClientRect();
const k = b.width / p.offsetWidth || 1;
const x = (clientX - b.left) / k;
return x < 0 || x > p.offsetWidth ? null : x;
};
const onAddDown = (e: React.PointerEvent<HTMLButtonElement>) => {
const touch = e.pointerType === "touch" || e.pointerType === "pen";
hold.current.touch = touch;
if (!touch) return;
try { e.currentTarget.setPointerCapture(e.pointerId); } catch { /* a scripted pointer */ }
clearTimeout(hold.current.t);
hold.current.sliding = false;
hold.current.t = window.setTimeout(() => {
hold.current.sliding = true;
show();
}, 260);
};
const onAddMove = (e: React.PointerEvent) => {
if (!hold.current.sliding) return;
setHx(along(e.clientX));
};
const onAddUp = (e: React.PointerEvent<HTMLButtonElement>) => {
if (!hold.current.touch) return;
clearTimeout(hold.current.t);
try { e.currentTarget.releasePointerCapture(e.pointerId); } catch { /* never captured */ }
if (hold.current.sliding) {
/* lifted: on an emoji picks it, anywhere else lets go */
hold.current.sliding = false;
const x = along(e.clientX);
const i = x === null ? -1 : Math.floor((x - 6) / EMO);
const el = i >= 0 ? pill.current?.querySelectorAll<HTMLElement>(".rxn-emo")[i] : undefined;
if (el && emo[i]) pick(emo[i].e, el);
else hide();
return;
}
/* a quick tap: toggle */
if (open) hide(); else show();
};
/* a point on the page, in the block's own pixels */
const local = (r: DOMRect) => {
const b = root.current!.getBoundingClientRect();
const k = b.width / root.current!.offsetWidth || 1;
return { x: (r.left + r.width / 2 - b.left) / k, y: (r.top + r.height / 2 - b.top) / k };
};
/* ── picking ───────────────────────────────────────────── */
const pick = (e: string, from: HTMLElement) => {
const at = local(from.getBoundingClientRect());
setOpen(false);
setHx(null);
const had = chips.find((c) => c.e === e);
if (had?.mine) { return; }
pending.current = { e, fx: at.x, fy: at.y };
setChips((l) => had
? l.map((c) => (c.e === e ? { ...c, n: c.n + 1, mine: true, landing: !still } : c))
: [...l, { e, n: 1, mine: true, landing: !still }]);
};
/* the chip is laid out now: measure where the emoji lands and
send the copy there */
useLayoutEffect(() => {
const p = pending.current;
if (!p || still) { pending.current = null; return; }
const el = root.current?.querySelector<HTMLElement>(`[data-emoji="${p.e}"] .rxn-chip-e`);
if (!el) return;
pending.current = null;
const to = local(el.getBoundingClientRect());
setFlight({ e: p.e, fx: p.fx, fy: p.fy, tx: to.x, ty: to.y });
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [chips]);
const land = () => {
const f = flight;
setFlight(null);
if (!f) return;
setChips((l) => l.map((c) => (c.e === f.e ? { ...c, landing: false } : c)));
setLanded(f.e);
window.setTimeout(() => setLanded((x) => (x === f.e ? null : x)), 700);
};
/* ── pressing a chip: in, or out ───────────────────────── */
const press = (e: string) => {
setChips((l) => l
.map((c) => (c.e !== e ? c : c.mine ? { ...c, n: c.n - 1, mine: false } : { ...c, n: c.n + 1, mine: true }))
.filter((c) => c.n > 0));
const c = chips.find((x) => x.e === e);
/* joining a chip plays its emoji's arrival */
if (c && !c.mine) {
setLanded(e);
window.setTimeout(() => setLanded((x) => (x === e ? null : x)), 700);
}
};
/* which emoji the pointer is on — that one is big, every other
one is its own size. No falloff into the neighbours: a
reaction is one choice, so it is one emoji or another, never
a smear between them */
const on = hx === null ? -1 : Math.max(0, Math.min(emo.length - 1, Math.floor((hx - 6) / EMO)));
/* a gentle lift, not a balloon: 1.17 at the default, 1.34 at the top of Magnify */
const swell = (i: number) => (i === on && !still ? 1 + (magnify / 100) * 0.34 : 1);
const r = Math.max(0, corner);
return (
<div ref={root} className="rxn" style={{ "--rxn-r": `${r}px` } as React.CSSProperties}>
{/* the message, and the picker it turns into: one pill whose
width and corner spring between the two */}
<div className="rxn-msg">
<motion.div
className="rxn-morph"
initial={false}
animate={{
width: open ? EMO * emo.length + 12 : textW || "auto",
height: 48,
borderRadius: open ? 24 : r,
}}
transition={quick}
>
<motion.span
ref={textRef}
className="rxn-text"
initial={false}
animate={open ? { opacity: 0, filter: "blur(4px)", scale: 0.96 } : { opacity: 1, filter: "blur(0px)", scale: 1 }}
transition={{ duration: open ? 0.09 : 0.22, delay: open ? 0 : 0.08 }}
aria-hidden={open || undefined}
>
Shipped the new onboarding flow
</motion.span>
<AnimatePresence>
{open && (
<motion.div
ref={pill}
className="rxn-pill"
role="menu"
exit={{ opacity: 0, transition: { duration: 0.16 } }}
onPointerLeave={() => setHx(null)}
onPointerMove={(e) => {
const b = e.currentTarget.getBoundingClientRect();
const k = b.width / e.currentTarget.offsetWidth || 1;
setHx((e.clientX - b.left) / k);
}}
>
{emo.map((m, i) => (
<motion.button
key={m.e}
type="button"
role="menuitem"
className="rxn-emo"
aria-label={m.label}
initial={{ opacity: 0, y: 8, scale: 0.5, filter: "blur(3px)" }}
animate={{ opacity: 1, y: 0, scale: 1, filter: "blur(0px)", transition: { ...quick, delay: 0.02 + i * 0.018 } }}
style={{ "--s": swell(i) } as React.CSSProperties}
onClick={(e) => pick(m.e, e.currentTarget)}
>
<span><Emo e={m.e} play={i === on} /></span>
</motion.button>
))}
<AnimatePresence>
{on >= 0 && (
<motion.span
key="tip"
className="rxn-tip"
initial={{ opacity: 0, y: 4 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.16 }}
style={{ left: 6 + on * EMO + EMO / 2 }}
>
{emo[on].label}
</motion.span>
)}
</AnimatePresence>
</motion.div>
)}
</AnimatePresence>
</motion.div>
</div>
<motion.div className="rxn-row" layout transition={spring}>
<AnimatePresence initial={false} mode="popLayout">
{chips.map((c) => (
<motion.button
key={c.e}
layout
type="button"
className="rxn-chip"
data-emoji={c.e}
data-mine={c.mine || undefined}
aria-pressed={c.mine}
aria-label={`${c.e} ${c.n}`}
initial={{ opacity: 0, scale: 0.5 }}
animate={{ opacity: 1, scale: 1, transition: spring }}
exit={{ opacity: 0, scale: 0.5, transition: { duration: 0.16 } }}
whileTap={{ scale: 0.92 }}
onClick={() => press(c.e)}
>
<span className="rxn-chip-e" data-landing={c.landing || undefined}><Emo e={c.e} play={landed === c.e} /></span>
<Count n={c.landing ? c.n - 1 : c.n} />
</motion.button>
))}
<motion.span key="add" layout className="rxn-add-wrap">
<button
type="button"
className="rxn-add"
aria-label="Add a reaction"
aria-expanded={open}
onPointerDown={onAddDown}
onPointerMove={onAddMove}
onPointerUp={onAddUp}
onPointerCancel={onAddUp}
onContextMenu={(e) => e.preventDefault()}
onClick={() => {
/* a touch was handled on the way up */
if (hold.current.touch) { hold.current.touch = false; return; }
if (open) hide(); else show();
}}
>
<SmilePlus size={18} strokeWidth={2} />
</button>
</motion.span>
</AnimatePresence>
</motion.div>
{/* the reaction on its way: an arc from the pill to its chip */}
{flight && (
<motion.span
className="rxn-fly"
aria-hidden="true"
initial={{ x: flight.fx, y: flight.fy, scale: 1.4 }}
animate={{
x: [flight.fx, (flight.fx + flight.tx) / 2, flight.tx],
y: [flight.fy, Math.min(flight.fy, flight.ty) - 46, flight.ty],
scale: [1.4, 1.25, 1],
rotate: [0, -14, 0],
}}
transition={{ duration: 0.6, ease: [0.35, 0, 0.3, 1], times: [0, 0.45, 1] }}
onAnimationComplete={land}
>
{flight.e}
</motion.span>
)}
</div>
);
}컨트롤 · HTML · CSS · JS
코드를 고치고 컨트롤로 다듬어 보세요. 입력하는 대로 미리보기가 바뀝니다.

이 컴포넌트는 번들된 빌드로 실행되므로 여기서는 스크립트를 읽기만 할 수 있습니다. HTML과 CSS는 수정할 수 있고 전체 소스는 코드 탭에 있습니다.
모든 컴포넌트를 바로 편집하고, 컨트롤로 다듬고, 전체 소스를 내려받고, 고급 프롬프트를 복사하세요.
1회 결제 $49임시 가격
테스트 모드: 실제 결제는 이루어지지 않습니다.
무료: 미리보기, 복사 버튼, 레슨 설명.
분명한 모양, 강한 한 가지 색, 짧은 눌림 반응이 손에 잡히는 느낌을 줍니다.
주요 동작, 행동 유도, 툴바.
모서리 둥글기, 안쪽 여백, 호버 전환 시간을 바꿉니다.
Bencho (github.com/cabralorenzo/bencho)(MIT)의 "Emoji reactions" 컴포넌트를 내 React + Tailwind CSS 앱에 추가해 줘. 소스 파일: https://github.com/cabralorenzo/bencho/blob/c65992417427bb09e661674ffa800bef29adef49/blocks/emoji-reactions/Reactions.tsx. 분명한 모양, 강한 한 가지 색, 짧은 눌림 반응이 손에 잡히는 느낌을 줍니다. 사용처: 주요 동작, 행동 유도, 툴바. 조정할 설정: 모서리 둥글기, 안쪽 여백, 호버 전환 시간을 바꿉니다. 라이트와 다크 테마를 지원하고 prefers-reduced-motion을 존중해 줘. MIT 라이선스 고지는 유지해 줘.
조정, 접근성, 연동 단계까지 담은 긴 프롬프트입니다.