Select — shift-click range
Variant: Shift range
Range selection, shown as the gesture it really is: anchor, modifier, far end. The pointer settles for 120ms before each click, so neither reads as a drive-by. The first click selects a row and marks it with a short clay bar, because shift-click measures from the anchor and the anchor is the one row the user otherwise has to remember. Shift goes down 300ms before the second click and comes up 400ms after it, since a modifier only reads as held if it is visibly down on both sides of the click it changes. The rows between then fill outward from the anchor, 50ms apart, so the selection is seen to grow from the row it is measured from. The count swaps from "1 selected" to "4 selected" in tabular figures, so the label never shifts, and the old text is gone before the new one arrives so the two never ghost over each other. Esc clears every row on one frame, because it is one command. Every state change is an opacity fade. The only movement is the pointer gliding and the keys dipping 1px. Under reduced motion the pointer jumps between its stops instead of gliding, so each click still lands on its row, and the keys light without dipping. Reach for it in file browsers, inboxes and data tables, anywhere power users will select in bulk and new users need to discover that they can.
The source
A complete HTML document. Paste it into an empty .html file and it plays — no stylesheet, script, font, or image to fetch.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Select — shift-click range</title>
<style>
:root {
/* Neutrals — fixed, never remixed. */
--ivory: #faf9f5;
--paper: #ffffff;
--oat: #e3dacc;
--slate: #141413;
/* Knobs — the remix API. A knob exists iff declared here and used below. */
--hue: 38.8;
--lift: 0;
--chroma: 1;
--round: 1;
--speed: 1;
/* Accents — derived from the knobs with the family's offsets baked in,
so one hue roll moves them together. Defaults reproduce the original hex. */
--clay: oklch(calc(0.6724 + var(--lift)) calc(0.1308 * var(--chroma)) var(--hue));
--clay-d: oklch(calc(0.5797 + var(--lift)) calc(0.127 * var(--chroma)) var(--hue));
--olive: oklch(
calc(0.6118 + var(--lift)) calc(0.0713 * var(--chroma)) calc(var(--hue) + 88.3)
);
--rust: oklch(
calc(0.5408 + var(--lift)) calc(0.1357 * var(--chroma)) calc(var(--hue) - 10.3)
);
/* Clock — 5.2s: click an anchor, hold shift, click the far end, look at
the range, press esc, rest. */
--cycle: 5.2s;
--t: calc(var(--cycle) / var(--speed));
--_row: 30px;
--_head: 34px;
--ease-out: cubic-bezier(0.23, 1, 0.32, 1);
--ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
/* Fast off the mark, long settle: a key is down the moment it is touched. */
--ease-accent: cubic-bezier(0.32, 0.72, 0, 1);
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
min-height: 100vh;
display: grid;
place-items: center;
background: var(--ivory);
font-family:
system-ui,
-apple-system,
'Segoe UI',
Roboto,
sans-serif;
color: var(--slate);
}
.list {
position: relative;
width: min(248px, 86vw);
padding: 0 6px 6px;
border-radius: calc(12px * var(--round));
background: var(--paper);
box-shadow: 0 1px 2px color-mix(in srgb, var(--slate) 10%, transparent);
font-size: clamp(12px, 3.8vw, 13px);
letter-spacing: -0.01em;
}
.head {
display: flex;
align-items: center;
justify-content: space-between;
height: var(--_head);
padding: 0 8px;
color: color-mix(in srgb, var(--slate) 60%, transparent);
}
.count {
display: grid;
font-variant-numeric: tabular-nums;
}
.count span {
grid-area: 1 / 1;
opacity: 0;
}
.count .n0 {
animation: n0 var(--t) infinite;
}
.count .n1 {
animation: n1 var(--t) infinite;
}
.count .n4 {
animation: n4 var(--t) infinite;
}
.keys {
display: flex;
gap: 5px;
}
.key {
position: relative;
display: grid;
place-items: center;
min-width: 26px;
height: 20px;
padding: 0 6px;
border-radius: calc(5px * var(--round));
box-shadow:
inset 0 0 0 1px color-mix(in srgb, var(--slate) 16%, transparent),
0 1px 0 color-mix(in srgb, var(--slate) 16%, transparent);
font-size: 11px;
font-weight: 600;
}
.key .lit {
position: absolute;
inset: 0;
display: grid;
place-items: center;
border-radius: inherit;
background: var(--slate);
color: var(--ivory);
opacity: 0;
}
.shift {
animation: key-shift var(--t) infinite;
}
.shift .lit {
animation: lit-shift var(--t) infinite;
}
.esc {
animation: key-esc var(--t) infinite;
}
.esc .lit {
animation: lit-esc var(--t) infinite;
}
.row {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
height: var(--_row);
padding: 0 10px 0 14px;
}
.row b {
position: relative;
font-weight: 500;
}
.row i {
position: relative;
font-style: normal;
font-variant-numeric: tabular-nums;
color: color-mix(in srgb, var(--slate) 48%, transparent);
}
.hl {
position: absolute;
inset: 1px 0;
border-radius: calc(6px * var(--round));
background: color-mix(in srgb, var(--clay) 18%, transparent);
opacity: 0;
}
/* The anchor gets a mark the range rows do not. Shift-click selects from
the anchor, so it is the one row whose identity the user has to hold
in their head — the bar puts it on the screen instead. */
.anchor {
position: absolute;
left: 4px;
top: 7px;
bottom: 7px;
width: 3px;
border-radius: 999px;
background: var(--clay);
opacity: 0;
animation: r2 var(--t) infinite;
}
.r2 .hl {
animation: r2 var(--t) infinite;
}
.r3 .hl {
animation: r3 var(--t) infinite;
}
.r4 .hl {
animation: r4 var(--t) infinite;
}
.r5 .hl {
animation: r5 var(--t) infinite;
}
.ghost {
position: absolute;
left: 0;
top: 0;
width: 14px;
height: 18px;
animation: travel var(--t) infinite;
}
.arrow {
display: block;
width: 100%;
height: 100%;
fill: var(--slate);
stroke: var(--paper);
stroke-width: 1.4;
stroke-linejoin: round;
}
.tip {
position: absolute;
left: -9px;
top: -9px;
width: 20px;
height: 20px;
border-radius: 50%;
background: var(--clay-d);
opacity: 0;
animation: contact var(--t) infinite;
}
@keyframes travel {
0%,
3.85% {
transform: translate(
calc(min(248px, 86vw) - 10px),
calc(var(--_head) + var(--_row) * 5.25)
);
animation-timing-function: var(--ease-out);
}
7.31%,
17.31% {
transform: translate(
calc(min(248px, 86vw) * 0.62),
calc(var(--_head) + var(--_row) * 1.5)
);
animation-timing-function: var(--ease-in-out);
}
26.54%,
46.15% {
transform: translate(
calc(min(248px, 86vw) * 0.62),
calc(var(--_head) + var(--_row) * 4.5)
);
animation-timing-function: var(--ease-in-out);
}
55.77%,
100% {
transform: translate(
calc(min(248px, 86vw) - 10px),
calc(var(--_head) + var(--_row) * 5.25)
);
}
}
@keyframes contact {
0%,
9.62% {
opacity: 0;
transform: scale(0.5);
animation-timing-function: var(--ease-out);
}
10.77% {
opacity: 0.4;
transform: scale(1);
animation-timing-function: var(--ease-out);
}
14.42%,
28.85% {
opacity: 0;
transform: scale(0.5);
animation-timing-function: var(--ease-out);
}
30% {
opacity: 0.4;
transform: scale(1);
animation-timing-function: var(--ease-out);
}
33.65%,
100% {
opacity: 0;
transform: scale(0.5);
}
}
/* Shift goes down 300ms before the click and comes up 400ms after it —
a modifier is a held state, and the key reads as "held" only if it is
visibly down on both sides of the click it modifies. */
@keyframes key-shift {
0%,
23.08% {
transform: translateY(0);
animation-timing-function: var(--ease-accent);
}
24.23%,
36.54% {
transform: translateY(1px);
animation-timing-function: var(--ease-out);
}
37.69%,
100% {
transform: translateY(0);
}
}
@keyframes lit-shift {
0%,
23.08% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
24.23%,
36.54% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
37.69%,
100% {
opacity: 0;
}
}
@keyframes key-esc {
0%,
69.23% {
transform: translateY(0);
animation-timing-function: var(--ease-accent);
}
70.38%,
72.69% {
transform: translateY(1px);
animation-timing-function: var(--ease-out);
}
73.85%,
100% {
transform: translateY(0);
}
}
@keyframes lit-esc {
0%,
69.23% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
70.38%,
72.69% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
73.85%,
100% {
opacity: 0;
}
}
@keyframes r2 {
0%,
9.62% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
11.92%,
70% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
71.92%,
100% {
opacity: 0;
}
}
/* The range fills outward from the anchor, 50ms a row, so the selection
is seen to grow from the row it is measured from. The clear is one
frame for every row: esc is one command, not three. */
@keyframes r3 {
0%,
28.85% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
31.15%,
70% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
71.92%,
100% {
opacity: 0;
}
}
@keyframes r4 {
0%,
29.81% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
32.12%,
70% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
71.92%,
100% {
opacity: 0;
}
}
@keyframes r5 {
0%,
30.77% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
33.08%,
70% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
71.92%,
100% {
opacity: 0;
}
}
@keyframes n0 {
0%,
9.62% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
10.38%,
71.92% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
73.46%,
100% {
opacity: 1;
}
}
@keyframes n1 {
0%,
10.38% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
11.92%,
30.77% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
31.54%,
100% {
opacity: 0;
}
}
@keyframes n4 {
0%,
31.54% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
33.08%,
70% {
opacity: 1;
animation-timing-function: var(--ease-out);
}
71.92%,
100% {
opacity: 0;
}
}
@media (prefers-reduced-motion: reduce) {
/* Nothing travels: the pointer jumps between its stops instead of
gliding, so the clicks still land on the rows they belong to, and
the keys light without dipping. Every state change was already an
opacity fade, so all of it stays. */
.ghost {
animation: travel-jump var(--t) step-end infinite;
}
@keyframes travel-jump {
0% {
transform: translate(
calc(min(248px, 86vw) - 10px),
calc(var(--_head) + var(--_row) * 5.25)
);
}
7.31% {
transform: translate(
calc(min(248px, 86vw) * 0.62),
calc(var(--_head) + var(--_row) * 1.5)
);
}
26.54% {
transform: translate(
calc(min(248px, 86vw) * 0.62),
calc(var(--_head) + var(--_row) * 4.5)
);
}
55.77%,
100% {
transform: translate(
calc(min(248px, 86vw) - 10px),
calc(var(--_head) + var(--_row) * 5.25)
);
}
}
.shift,
.esc {
animation: none;
}
}
</style>
</head>
<body>
<div
class="list"
role="img"
aria-label="A file list: one row is clicked, shift is held and a lower row is clicked, the rows between fill in from the first, then escape clears them"
>
<div class="head">
<span class="count"
><span class="n0">No selection</span><span class="n1">1 selected</span
><span class="n4">4 selected</span></span
>
<span class="keys">
<span class="key shift">⇧<span class="lit">⇧</span></span>
<span class="key esc">esc<span class="lit">esc</span></span>
</span>
</div>
<div class="row r1"><b>IMG_0412.jpg</b><i>2.4 MB</i></div>
<div class="row r2">
<span class="hl"></span><span class="anchor"></span><b>IMG_0413.jpg</b><i>3.1 MB</i>
</div>
<div class="row r3"><span class="hl"></span><b>IMG_0414.jpg</b><i>2.8 MB</i></div>
<div class="row r4"><span class="hl"></span><b>IMG_0415.jpg</b><i>1.9 MB</i></div>
<div class="row r5"><span class="hl"></span><b>IMG_0416.jpg</b><i>3.4 MB</i></div>
<div class="row r6"><b>IMG_0417.jpg</b><i>2.2 MB</i></div>
<span class="ghost">
<span class="tip"></span>
<svg class="arrow" viewBox="0 0 14 18" xmlns="http://www.w3.org/2000/svg">
<path d="M1 1 L1 14.8 L4.5 11.6 L6.7 16.6 L9.3 15.4 L7.1 10.5 L11.8 10.3 Z" />
</svg>
</span>
</div>
</body>
</html>
The variant family
Same idea, one axis moved. Compare them side by side before you commit.