Rendimiento
Requiere atenciónFrecuencia de fotogramas: 59.7 fps de media, p5 59.5 · Tareas largas: 0 tareas, 0 ms en total, la más larga 0 ms · Código gzip 12 KB · En ejecución 288 KB
AssigneesMITCampoBencho
Componente React de Campo de Lorenzo Cabra. Recopilado sin cambios de Bencho bajo la licencia MIT y mostrado aquí en directo.
Informe de calidad
La nota y la puntuación proceden de comprobaciones automáticas hechas en la compilación o en las pruebas. Si una comprobación no se ejecutó, se marca Como no comprobada: nunca se inventan cifras.
Frecuencia de fotogramas: 59.7 fps de media, p5 59.5 · Tareas largas: 0 tareas, 0 ms en total, la más larga 0 ms · Código gzip 12 KB · En ejecución 288 KB
Problemas 3 · Lector de pantalla: Requiere atención
Sin movimiento continuo
Sin desbordamiento
La frecuencia de fotogramas y las tareas largas se midieron en Chromium sin interfaz, con WebGL por software. Solo son comparables entre componentes de este sitio y no representan un dispositivo real.
No aplica: no hay animación visible en reposo. Las animaciones que se activan al pasar el cursor no se probaron.

Comprobado el 15 nov 2026 · Las cifras salen de un script automatico, no de ejemplos escritos a mano.
Se muestra a tamaño real.
La copia empieza con el aviso de licencia. Consérvalo al usar el código.
<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;
}
}
/* Picker.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.
*/
/* Inter, not the mono class it carried. A handle is a name,
not a code — nothing here needs a fixed advance. */
/* 11.5, which is .pik-role's. The names in these two lists
were matched at 13 already; the second lines were a pixel
apart, and one point of difference between two lists of
people reads as one of them being set slightly wrong rather
than as a distinction anybody meant. */
/* and the same INK as .pik-role, by the same route: the fill's
own on-colour at 45%, falling back to the page's when no
fill is set. --ink-5 is a fixed grey off the light ramp, so
under a dark Fill — which this block takes — the handle
stayed a mid grey on a near-black row while the name above
it inverted properly. An alpha of the row's own ink cannot
come apart from it. */
.rst-at {
font-size: 11px;
letter-spacing: 0em;
color: color-mix(in srgb, var(--fill-on, #17181a) 52%, var(--fill-slab, #ffffff));}
/* ══ People picker ══════════════════════════════════════════
A pill that fills with faces, and the list it fills from.
See Picker.tsx — in particular why the rail's width is an
inline number rather than anything measured. */
.pik {
position: relative;
box-sizing: border-box;
font-family: var(--font-ui);
color: var(--fill-on, var(--ink));}
.pik-pill {
position: relative;
z-index: 2;
display: inline-flex;
align-items: center;
gap: 12px;
height: 44px;
/* tighter on the left, because a face is a filled circle and
a word is not: 16 of air beside "Add people" is the same
amount of air as 8 beside a picture */
padding: 0 12px 0 8px;
border: 0;
background: var(--fill-slab, var(--card));
/* ── NO SHADOW, AND NO HAIRLINE EITHER ────────────────────
Both are gone. The ring came back only when Stroke asks
for it — it carried a permanent one, which made that
switch a control reporting a state it was not producing,
the fault the tilt card and the wheel both had.
The drop shadow went with it. Nothing here needs lifting:
the pill and the card are the fill's own slab and they sit
on the block's grey ground, which separates them on its
own. A shadow under a shape that already reads is the
component insisting it is floating. */
color: inherit;
font: inherit;
font-size: 14px;
font-weight: 500;
cursor: pointer;
letter-spacing: -0.01em;}
[data-stroke="on"] .pik-pill { box-shadow: 0 0 0 1px var(--pane-edge); }
.pik-pill:focus-visible {
outline: none;
box-shadow: 0 0 0 2px rgba(var(--fill-on-rgb, var(--ink-rgb)), 0.45);}
/* ── the rail the faces sit in ──────────────────────────────
Its width is the whole animation. The faces are absolute
inside it, so none of them moves when another arrives — the
rail simply has more room, and the pill is sized by it.
Nothing here measures anything. */
.pik-rail {
position: relative;
flex: none;
height: 28px;
transition: width 220ms cubic-bezier(0.22, 1, 0.36, 1);}
.pik-face {
position: absolute;
/* both corners pinned: the face is placed by its transform,
in the row and in the quad alike, so `left` is an origin
rather than a position */
top: 0;
left: 0;
width: 28px;
height: 28px;
border-radius: 999px;
overflow: hidden;
/* the ring is the CARD's colour, not white: it is the gap
between two overlapping faces, so it has to be whatever is
behind them or the stack grows a halo in dark mode */
box-shadow: 0 0 0 2px var(--fill-slab, var(--card));}
.pik-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* with no faces the rail collapses to nothing but the pill's gap
still sits in front of the word; pull it back so the text is
inset 12 from the edge, matching the pill's own right padding */
.pik-say { margin-left: -6px; color: var(--fill-on, var(--ink)); }
/* ── the chevron IS the hover state ─────────────────────────
With the shadow gone the pill had nothing left to answer the
cursor with, and a fill appearing behind it would be a second
shape arriving on a control whose whole subject is shapes —
the palette's refresh button makes the same call. The glyph
goes to a stronger ink instead: same thing said, nothing new
on screen. */
.pik-chev {
flex: none;
margin-left: -2px;
color: color-mix(in srgb, var(--fill-on, #17181a) 32%, var(--fill-slab, #ffffff));
transition: rotate 220ms cubic-bezier(0.22, 1, 0.36, 1), color 160ms ease;}
.pik-pill:hover .pik-chev { color: color-mix(in srgb, var(--fill-on, #17181a) 72%, var(--fill-slab, #ffffff)); }
.pik-pill[aria-expanded="true"] .pik-chev { rotate: 180deg; }
/* ── the list ───────────────────────────────────────────────
Absolute, so opening it moves nothing. The block reserves
the room for it either way — see the note in Picker.tsx. */
.pik-card {
position: absolute;
top: 54px;
left: 0;
right: 0;
z-index: 1;
box-sizing: border-box;
padding: 8px;
background: var(--fill-slab, var(--card));
/* ── it unfolds from the PILL'S corner ────────────────────
Top left, not the middle: the pill starts at this same
left edge, so the card opens down and out from under it
rather than growing symmetrically out of its own centre,
which is what a box appearing does. */
transform-origin: 0 0;}
[data-stroke="on"] .pik-card { box-shadow: 0 0 0 1px var(--pane-edge); }
.pik-row {
display: flex;
align-items: center;
gap: 12px;
width: 100%;
height: 48px;
padding: 0 8px;
border: 0;
/* the card's corner less its 6px padding — set in Picker.tsx
so it tracks the Corner knob; 16 is the value at the
default 22 */
border-radius: var(--pik-row-r, 14px);
background: transparent;
color: inherit;
font: inherit;
text-align: left;
cursor: pointer;
transition: background 160ms ease;}
.pik-row:hover { background: color-mix(in srgb, var(--fill-on, #17181a) 6%, transparent); }
.pik-row:focus-visible {
outline: none;
background: color-mix(in srgb, var(--fill-on, #17181a) 6%, transparent);}
.pik-av {
flex: none;
width: 32px; height: 32px;
border-radius: 999px;
object-fit: cover;
display: block;}
.pik-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
/* ── the same type as the other two lists ────────────────
It was 13.5 at 500 with a touch of negative tracking, which
is a LABEL's setting — right for a word that names a control
and wrong for a row of people. The selection list and the
reorder list both set their names at the regular weight, and
they are the same object: a face, a name, a thing to press.
Three lists on one bench reading as three different type
systems is the fault; matching `.rst-name` is the fix. */
.pik-name {
font-size: 13px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
letter-spacing: 0em;}
.pik-role {
font-size: 11px;
color: color-mix(in srgb, var(--fill-on, #17181a) 52%, var(--fill-slab, #ffffff));
letter-spacing: 0em;}
/* ── the mark ───────────────────────────────────────────────
Drawn at rest as an empty ring and filled when it is on, so
the row always shows that it CAN be chosen. A control that
only appears once used is one you have to guess at first. */
.pik-mark {
flex: none;
display: grid;
place-items: center;
width: 18px; height: 18px;
/* ── a rounded square, not a disc ────────────────────────
One radius for both states, because it is one box: the
empty mark and the ticked one are the same square with the
fill switched, so the shape cannot disagree with itself
between rows. The radius is 0.3 of the side — round enough
to belong to the pill and the card above it, square enough
that a row of four reads as a column of checkboxes rather
than as a second set of avatars beside the real ones.
18, down from 20. The mark answers the row; it is not the
subject of it, and at 20 against a 28px face it was close
enough in size to read as the second circle in a pair. Two
pixels is enough to put it back behind the name. */
border-radius: 6px;
box-shadow: inset 0 0 0 1.5px rgba(var(--fill-on-rgb, var(--ink-rgb)), 0.22);
transition: background 160ms ease, box-shadow 160ms ease;}
.pik-row[data-on] .pik-mark {
background: var(--fill-on, var(--ink));
box-shadow: inset 0 0 0 1.5px var(--fill-on, var(--ink));}
.pik-tick {
display: grid;
place-items: center;
color: var(--fill-slab, var(--card));}
@media (prefers-reduced-motion: reduce) {
.pik-rail, .pik-chev { transition-duration: 160ms; }
}
// bencho source (MIT). npm i @tabler/icons-react motion react · Tailwind CSS v4
// ── blocks/picker/Picker.tsx (https://github.com/cabralorenzo/bencho/blob/c65992417427bb09e661674ffa800bef29adef49/blocks/picker/Picker.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 { useState } from "react";
import { AnimatePresence, motion } from "motion/react";
import { IconCheck as Check, IconChevronDown as ChevronDown } from "@tabler/icons-react";
/* A drawn placeholder: Bencho's photographs are licensed to
the site and do not travel. Point this at your own. */
const AVATARS: Record<string, string> = {
kai: "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2096%2096%22%20width%3D%2296%22%20height%3D%2296%22%3E%3Crect%20width%3D%2296%22%20height%3D%2296%22%20fill%3D%22rgb%28187%2C187%2C189%29%22%2F%3E%3Ctext%20x%3D%2248%22%20y%3D%2261%22%20text-anchor%3D%22middle%22%20font-family%3D%22Inter%2C%20Helvetica%2C%20Arial%2C%20sans-serif%22%20font-size%3D%2240%22%20font-weight%3D%22500%22%20fill%3D%22%23fff%22%3EA%3C%2Ftext%3E%3C%2Fsvg%3E",
mara: "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2096%2096%22%20width%3D%2296%22%20height%3D%2296%22%3E%3Crect%20width%3D%2296%22%20height%3D%2296%22%20fill%3D%22rgb%28164%2C164%2C166%29%22%2F%3E%3Ctext%20x%3D%2248%22%20y%3D%2261%22%20text-anchor%3D%22middle%22%20font-family%3D%22Inter%2C%20Helvetica%2C%20Arial%2C%20sans-serif%22%20font-size%3D%2240%22%20font-weight%3D%22500%22%20fill%3D%22%23fff%22%3EP%3C%2Ftext%3E%3C%2Fsvg%3E",
sofia: "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2096%2096%22%20width%3D%2296%22%20height%3D%2296%22%3E%3Crect%20width%3D%2296%22%20height%3D%2296%22%20fill%3D%22rgb%28201%2C201%2C203%29%22%2F%3E%3Ctext%20x%3D%2248%22%20y%3D%2261%22%20text-anchor%3D%22middle%22%20font-family%3D%22Inter%2C%20Helvetica%2C%20Arial%2C%20sans-serif%22%20font-size%3D%2240%22%20font-weight%3D%22500%22%20fill%3D%22%23fff%22%3EN%3C%2Ftext%3E%3C%2Fsvg%3E",
ines: "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2096%2096%22%20width%3D%2296%22%20height%3D%2296%22%3E%3Crect%20width%3D%2296%22%20height%3D%2296%22%20fill%3D%22rgb%28178%2C178%2C180%29%22%2F%3E%3Ctext%20x%3D%2248%22%20y%3D%2261%22%20text-anchor%3D%22middle%22%20font-family%3D%22Inter%2C%20Helvetica%2C%20Arial%2C%20sans-serif%22%20font-size%3D%2240%22%20font-weight%3D%22500%22%20fill%3D%22%23fff%22%3EM%3C%2Ftext%3E%3C%2Fsvg%3E",
};
/* ══ Assignees ════════════════════════════════════════════
A pill that opens a list, and fills up with faces as you
assign them. One, two, four — the pill grows to hold them
and they overlap into a stack rather than a row.
It was called "People picker", which named the widget
rather than the job. What this is FOR is putting names
against a thing — assigning a task, adding contributors —
and the pill is the answer to "who is on this".
THE PILL IS THE READOUT. There is no count badge and no
"3 selected" caption: the faces themselves say who, which
is the thing a person actually wants back. A number tells
you how many you picked; a stack of faces tells you whether
you picked the right ones. */
const clamp = (v: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, v));
/* ── the cast ──────────────────────────────────────────────
The same four pictures the rest of the bench uses — there
are only four in avatars.ts and every block that needs
people draws from them — under names of their own, which is
what the selection list and the reorder list both do. Four
blocks sharing one set of names would read as one dataset
being shown four ways rather than four components. */
/* The names follow the PICTURES. avatars.ts keys are `kai`,
`mara`, `sofia`, `ines` and none of them describes who is in
the photograph — the reorder list and the selection list use
the same four faces under different names, so the key is a
slot rather than a person. Checked against the images at
size rather than off the thumbnails: two men, two women. */
const CAST = [
{ id: "kai", name: "Adam Marsh", role: "Design" },
{ id: "mara", name: "Priya Raman", role: "Research" },
{ id: "sofia", name: "Nora Wilder", role: "Engineering" },
{ id: "ines", name: "Marco Bellini", role: "Product" },
];
/* the block's own box. Reserved for the list OPEN, so closing
it does not resize the card underneath — the same bargain
the selection list makes, and for the same reason: a block
that changes height when you press it makes the wall jump. */
const W = 264;
const H = 268;
/* the faces in the pill */
const FACE = 28;
const CORNER = 20;
/* how much of each face the next one covers, px */
const LAP = 10;
/* ── the other way to stack ────────────────────────────────
A row of overlapping faces is the honest default: it says
who, in order, and it grows sideways as you add people. But
it grows sideways, and a pill in a dense toolbar cannot
always afford that.
So the second arrangement packs the same four into the
footprint of ONE. Nothing overlaps — that is the whole point
of it, and the reason it is not simply "a tighter row". A
row hides parts of faces behind other faces; the quad shows
all of every face and pays for it in size.
The box is FACE across whatever the count, so the pill in
this mode does not grow at all. That is the trade the mode
exists to make, and drawing one face big and four faces
small is what makes it visible: the box does not fill up,
it SUBDIVIDES.
Three is the awkward count. It fills reading order and
leaves the last cell empty, which looks like a gap and is
actually the point: the quad is a fixed set of four slots,
and three people occupy three of them. Centring the odd one
balances the picture but breaks the grid — the face lands
where no cell is, and adding the fourth person then shunts
it sideways for no reason the eye can name. */
const quad = (n: number, gut: number) => {
const cell = (FACE - gut) / 2;
const s = cell / FACE;
const a = cell / 2; /* centre of the near cell */
const b = FACE - cell / 2; /* centre of the far one */
const m = FACE / 2;
if (n <= 1) return [{ cx: m, cy: m, s: 1 }];
if (n === 2) return [{ cx: a, cy: m, s }, { cx: b, cy: m, s }];
if (n === 3) return [{ cx: a, cy: a, s }, { cx: b, cy: a, s }, { cx: a, cy: b, s }];
return [
{ cx: a, cy: a, s }, { cx: b, cy: a, s },
{ cx: a, cy: b, s }, { cx: b, cy: b, s },
];
};
export function Picker({
/* the pill's corner and the card's, px */
corner = CORNER,
/* how far the faces overlap, px — 0 is a row of separate
circles, which is a real answer and not a broken one */
overlap = LAP,
/* "Row" or "Grid" — see quad() above */
stack = "Row",
}: {
corner?: number;
overlap?: number;
stack?: string;
} = {}) {
/* open, and with two already chosen. A picker drawn shut is
a pill with a word in it: true of the component and
useless as a picture of it. This is the state worth
landing on — the pill doing its job and the list showing
why. */
const [open, setOpen] = useState(true);
const [picked, setPicked] = useState<string[]>(["kai", "mara"]);
const r = clamp(corner, 0, 26);
const lap = clamp(overlap, 0, 22);
const grid = stack === "Grid";
/* Overlap still means something in the quad, because a knob
that goes dead in half the modes is a knob you have to
explain. It reads as PACKING there rather than as covering:
4px of air at nought, 2px at full. It never reaches zero —
"they never touch" is the arrangement's one promise, and a
slider is not allowed to break it. */
const spots = quad(picked.length, 4 - (lap / 22) * 2);
/* ── the width is COMPUTED, not measured ─────────────────
Framer's `layout` would animate this by measuring screen
rectangles, and every block on this bench is drawn at a
fraction of its own size — see Gooey.tsx. A width worked
out from the count is the same number at any zoom, and CSS
can transition it without knowing where the block is. */
const rail = !picked.length
? 0
: grid
/* one face wide at every count — the quad's whole bargain */
? FACE
: FACE + (picked.length - 1) * (FACE - lap);
/* ── IT DOES NOT CLOSE ON AN OUTSIDE PRESS ───────────────
It did, and that is the right behaviour for a dropdown in
an application — the note that used to be here called it
the one thing every dropdown has to do. It is the wrong
behaviour for a block on this wall.
Measured: one real click anywhere on the page collapsed
the list, and nothing brought it back — so the card spent
the rest of the session showing a pill and nothing else,
which is a demonstration of a third of the component. The
same class of fault as a demo that leaves a toggle on.
The pill is still the toggle, so it is still dismissible
by the person actually using it. What is gone is the case
where something you did to a DIFFERENT block put this one
away.
Anyone lifting this into a real interface wants the
listener back; it is four lines and the reason it is not
here is the wall, not the pattern. */
const toggle = (id: string) => {
setPicked((p) => (p.includes(id) ? p.filter((x) => x !== id) : [...p, id]));
};
return (
<div
className="pik"
style={{
width: W,
height: H,
/* ── concentric, and it follows the knob ───────────
The row's hover pad was a flat 12 against a card cut
at 22, which reads squarer than the box holding it.
The rule the rest of this bench uses is the radius
of a thing inside another, LESS the gap between them
— the card's 6px padding here — so 22 gives 16.
Published from here rather than written in the
stylesheet because the card's corner is a knob: at 0
the pair is square together and at 26 both are as
round as they go, instead of the pad being right at
one setting and wrong at the rest. */
"--pik-row-r": `${Math.max(0, r - 6)}px`,
} as React.CSSProperties}
>
<button
className="pik-pill"
style={{ borderRadius: r }}
onClick={() => { setOpen((v) => !v); }}
aria-expanded={open}
aria-haspopup="listbox"
>
{/* ── the faces ─────────────────────────────────────
Absolutely placed inside a rail whose width is the
arithmetic above, so the pill grows and shrinks by
one CSS transition rather than by anything watching
the DOM.
Reversed z-order: the first face sits on top of the
second, so the stack reads left to right the way the
list does. Painted the other way the newest arrival
covers everyone before it, and adding a fourth
person looks like losing the first three. */}
<span className="pik-rail" style={{ width: rail }}>
<AnimatePresence initial={false}>
{picked.map((id, i) => {
/* ── EVERY face is placed by its transform ─────
It used to ride on `left`, which cannot carry
the quad: that one needs a size and two axes,
and a face swapping arrangements has to travel
rather than teleport. One vector and one scale
describe both layouts, so switching modes is
the same animation as arriving. */
const spot = grid ? spots[Math.min(i, spots.length - 1)] : null;
const tx = spot ? spot.cx - FACE / 2 : i * (FACE - lap);
const ty = spot ? spot.cy - FACE / 2 : 0;
const sc = spot ? spot.s : 1;
return (
<motion.span
key={id}
className="pik-face"
style={{ zIndex: CAST.length - i }}
/* ── a face lands, it does not fade in ──────
It drops from slightly above with a turn on
it and overshoots on the way to rest, so
adding somebody reads as a token being put
down. Leaving is the same move backwards and
quicker — you are removing a name, not
watching an animation.
The rotation is small and it is the reason
this feels different from a scale: a circle
scaling is a circle, and a circle scaling
while it turns is an object.
The drop lands at `ty`, not at nought, and
the pop lands at `sc`, not at one: in the
quad a face's rest is wherever its cell is
and however big its cell is. */
initial={{ scale: 0.2 * sc, opacity: 0, x: tx, y: ty - 10, rotate: -22 }}
animate={{ scale: sc, opacity: 1, x: tx, y: ty, rotate: 0 }}
exit={{ scale: 0.2 * sc, opacity: 0, x: tx, y: ty - 6, rotate: 14 }}
/* ── two springs, and the reason is the knob ──
Position and size are also what the Overlap
slider moves, and a slider wants a follower,
not a bouncer: dragged to an end, a 0.48-zeta
spring wobbles for a third of a second after
the thumb has stopped. So x, y and scale get
a tight one that tracks.
Rotate keeps the loose spring, and it is the
half that was carrying the character anyway —
the face still rocks past level as it sets
down. Nothing drags the rotation, so nothing
is waiting on it. */
transition={{
type: "spring", stiffness: 500, damping: 18, mass: 0.8,
x: { type: "spring", stiffness: 380, damping: 34, mass: 0.7 },
y: { type: "spring", stiffness: 380, damping: 34, mass: 0.7 },
scale: { type: "spring", stiffness: 380, damping: 34, mass: 0.7 },
opacity: { duration: 0.16 },
}}
>
<img src={AVATARS[id]} alt="" draggable={false} />
</motion.span>
);
})}
</AnimatePresence>
</span>
{/* ── what the pill says with nothing in it ────────
It said "Assign", which is an instruction — and the
pill is a READOUT: with faces in it, it reports who
is on this, so with none in it, it should report
that nobody is. One word, the state rather than the
verb, and it goes the moment there is a face,
because a label beside three pictures is the control
describing itself instead of answering. */}
{picked.length === 0 && <span className="pik-say">Unassigned</span>}
<ChevronDown className="pik-chev" size={16} strokeWidth={2} aria-hidden="true" />
</button>
<AnimatePresence>
{open && (
<motion.div
className="pik-card"
style={{ borderRadius: r }}
role="listbox"
aria-multiselectable="true"
/* ── it unfolds OUT OF the pill ──────────────────
The origin is the card's top-left, which is the
pill's own left edge, so it opens down and out
from the corner it belongs to rather than growing
from its middle like a box appearing.
NOT a goo morph, and that was considered first:
the reorder list took the metaball out from
between its card and its button for the reason
that applies here too — two separate objects
joined by a bridge read as welded, not as one
opening. A metaball is for a single body changing
shape, which is also why the faces do not get one:
they are photographs, and the filter thresholds
alpha.
The scale starts high — 0.86 across, 0.72 down —
because a card is a rounded rectangle and a scale
drags its corner radius with it. From a third of
its height the corners arrive visibly squashed;
from three quarters, with the spring doing the
work, they do not. The BOUNCE is where the
character is, not the distance. */
initial={{ opacity: 0, y: -10, scaleX: 0.86, scaleY: 0.72 }}
animate={{ opacity: 1, y: 0, scaleX: 1, scaleY: 1 }}
exit={{ opacity: 0, y: -8, scaleX: 0.92, scaleY: 0.86 }}
transition={{
/* zeta about 0.63 — it goes past and comes back,
which is the whole of "bubbly" */
type: "spring", stiffness: 500, damping: 18, mass: 0.9,
opacity: { duration: 0.16 },
}}
>
{CAST.map((p) => {
const on = picked.includes(p.id);
return (
<motion.button
key={p.id}
className="pik-row"
role="option"
aria-selected={on}
data-on={on || undefined}
onClick={() => toggle(p.id)}
/* they deal out under the card rather than
arriving with it — four rows appearing at
once is a panel, four arriving in order is
a list being handed to you. Fast and close
together: 40ms apart is a stagger you feel
rather than one you wait through. */
initial={{ opacity: 0, y: -8 }}
animate={{ opacity: 1, y: 0 }}
transition={{
type: "spring", stiffness: 380, damping: 34, mass: 0.7,
delay: 0.04 * CAST.indexOf(p) + 0.03,
}}
>
<img className="pik-av" src={AVATARS[p.id]} alt="" draggable={false} />
<span className="pik-who">
<span className="pik-name">{p.name}</span>
<span className="pik-role">{p.role}</span>
</span>
{/* the box is always drawn; only the tick
arrives. A mark that appears WITH its own
container reads as the row growing a
control, rather than as the control being
answered */}
<span className="pik-mark">
<AnimatePresence initial={false}>
{on && (
<motion.span
className="pik-tick"
initial={{ scale: 0.4, opacity: 0 }}
animate={{ scale: 1, opacity: 1 }}
exit={{ scale: 0.4, opacity: 0 }}
transition={{ type: "spring", stiffness: 500, damping: 18, mass: 0.6 }}
>
<Check size={14} strokeWidth={2} />
</motion.span>
)}
</AnimatePresence>
</span>
</motion.button>
);
})}
</motion.div>
)}
</AnimatePresence>
</div>
);
}Controles · HTML · CSS · JS
Edita el código y ajústalo con los controles. La vista previa se actualiza mientras escribes.

Este componente se ejecuta desde un paquete compilado, así que su script es de solo lectura aquí. Edita el HTML y el CSS; el código completo está en la pestaña Código.
Edita cada componente en directo, ajústalo con controles, descarga el código completo y copia los prompts avanzados.
49 $ pago únicoPrecio provisional
Modo de prueba: no se cobra nada real.
Gratis: vista previa, botones de copiar y notas de la lección.
Una etiqueta visible, un borde tranquilo y un foco claro guían la escritura.
Búsqueda, inicio de sesión y campos de texto cortos.
Ajusta la altura, el color del borde y el brillo al enfocar.
Añade el componente "Assignees" de Bencho (github.com/cabralorenzo/bencho) (MIT) a mi aplicación React + Tailwind CSS. Archivo fuente: https://github.com/cabralorenzo/bencho/blob/c65992417427bb09e661674ffa800bef29adef49/blocks/picker/Picker.tsx. Una etiqueta visible, un borde tranquilo y un foco claro guían la escritura. Úsalo para: Búsqueda, inicio de sesión y campos de texto cortos. Ajustes que se pueden cambiar: Ajusta la altura, el color del borde y el brillo al enfocar. Admite temas claro y oscuro y respeta prefers-reduced-motion. Conserva el aviso de licencia MIT.
Un prompt más largo con pasos de ajuste, accesibilidad e integración.