Hiệu năng
Cần chú ýTốc độ khung hình: trung bình 60 fps, p5 59.5 · Tác vụ dài: 0 tác vụ, tổng 0 ms, dài nhất 0 ms · Mã nguồn gzip 5.3 KB · Khi chạy 153 KB
Wake sliderMITÔ nhậpBencho
Component React Ô nhập của Lorenzo Cabra. Được thu thập nguyên vẹn từ Bencho theo giấy phép MIT và hiển thị trực tiếp tại đây.
Báo cáo chất lượng
Xếp loại và điểm số đến từ các kiểm tra tự động lúc dựng hoặc kiểm thử. Nếu một mục chưa chạy, nó được đánh dấu Chưa kiểm tra — không bao giờ bịa số liệu.
Tốc độ khung hình: trung bình 60 fps, p5 59.5 · Tác vụ dài: 0 tác vụ, tổng 0 ms, dài nhất 0 ms · Mã nguồn gzip 5.3 KB · Khi chạy 153 KB
Vấn đề 0 · Trình đọc màn hình: Đạt
Không có chuyển động liên tục
Không tràn
Số liệu tốc độ khung hình và tác vụ dài được đo trong Chromium không giao diện với WebGL phần mềm. Chúng chỉ nên được so sánh giữa các thành phần trên trang này, và không đại diện cho thiết bị thật.
Không áp dụng: không có hoạt ảnh nào thấy được khi đứng yên. Hoạt ảnh kích hoạt khi di chuột chưa được kiểm tra.
Không có vi phạm axe-core.

Kiểm tra ngày 15 thg 11, 2026 · Số liệu đến từ tập lệnh tự động, không phải mẫu viết tay.
Hiển thị đúng kích thước thật.
Bản sao bắt đầu bằng thông báo giấy phép. Hãy giữ lại khi dùng mã.
<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;
}
}
/* WakeSlider.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.
*/
/* ══ Wake slider ══════════════════════════════════════════
lab/WakeSlider.tsx. Thin bars, the reading beside them. The bars
are data marks, so they take the ink strengths: ink when lit,
faint after the value. Heights are written by the component */
.wks {
display: flex;
align-items: center;
gap: 16px;
padding: 16px;
color: var(--fill-on, #17181a);}
.wks-track {
display: flex;
align-items: center;
gap: 4px;
cursor: ew-resize;
touch-action: none;
user-select: none;
-webkit-user-select: none;
-webkit-tap-highlight-color: transparent;
border-radius: 6px;}
.wks-track:focus-visible { outline: 2px solid #2231dd; outline-offset: 6px; }
.wks-bar {
flex: none;
width: 3px;
border-radius: 3px;
background: color-mix(in srgb, var(--fill-on, #17181a) 32%, var(--fill-slab, #fff));
transform-origin: 50% 50%;
transition: background-color 160ms ease;}
.wks-bar[data-on] { background: var(--fill-on, #17181a); }
.wks-value {
min-width: 3ch;
font-size: 14px;
font-weight: 500;
letter-spacing: -0.01em;
font-variant-numeric: tabular-nums;
color: color-mix(in srgb, var(--fill-on, #17181a) 72%, var(--fill-slab, #fff));}
// bencho source (MIT). npm i motion react · Tailwind CSS v4
// ── blocks/wake-slider/WakeSlider.tsx (https://github.com/cabralorenzo/bencho/blob/c65992417427bb09e661674ffa800bef29adef49/blocks/wake-slider/WakeSlider.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";
/* ══ Wake slider ══════════════════════════════════════════
A range with no thumb: a row of thin bars, solid up to the
value and faint after it, with the reading beside them. Drag
anywhere along it. Drag slowly and the bars simply fill; drag
fast and every bar the value sweeps past springs up, taller the
faster you went, and settles back — a wake left behind the hand.
── EACH BAR HOLDS A LITTLE ENERGY ──────────────────────
When the value crosses a bar, that bar takes energy from the
speed of the drag. Every frame all of it decays at the same
rate, so the bars crossed longest ago have fallen furthest: the
tallest ones are always at the hand and the run tails off
behind it. That falloff IS the wake; nothing draws it.
── WRITTEN, NOT RENDERED ───────────────────────────────
The heights change every frame, so they go straight onto each
bar's transform from a ref. React renders when the value
changes, which is what the reading and the colours need, and
the loop runs only while some bar still has energy. */
const H = 20; // a bar at rest, px
const GAP = 4; // bar pitch minus its width
const BAR = 3;
const clamp = (v: number, a: number, b: number) => Math.min(b, Math.max(a, v));
export function WakeSlider({
/* how many bars make the track */
bars = 36,
/* how high the wake rises, 0..100 */
wake = 60,
}: {
bars?: number;
wake?: number;
} = {}) {
const n = Math.round(clamp(bars, 12, 64));
const [value, setValue] = useState(50);
const track = useRef<HTMLDivElement | null>(null);
const els = useRef<(HTMLSpanElement | null)[]>([]);
const st = useRef({
energy: new Float32Array(n),
down: false,
lastX: 0,
lastT: 0,
speed: 0,
raf: 0,
at: 0.5, // the value as a fraction, without React in the way
lastBar: -1,
});
const knob = useRef(wake);
knob.current = wake;
/* a new bar count is a new row */
useEffect(() => {
st.current.energy = new Float32Array(n);
}, [n]);
const loop = () => {
const s = st.current;
if (s.raf) return;
let prev = performance.now();
const run = (now: number) => {
const dt = Math.min(0.05, (now - prev) / 1000);
prev = now;
let live = false;
const fall = Math.exp(-dt * 6.5);
for (let i = 0; i < s.energy.length; i++) {
s.energy[i] *= fall;
if (s.energy[i] < 0.002) s.energy[i] = 0;
else live = true;
const b = els.current[i];
/* up to 2.6 times as tall at the very top of the knob */
if (b) b.style.transform = `scaleY(${(1 + s.energy[i] * 1.6).toFixed(3)})`;
}
s.raf = live || s.down ? requestAnimationFrame(run) : 0;
};
s.raf = requestAnimationFrame(run);
};
useEffect(() => () => cancelAnimationFrame(st.current.raf), []);
/* move the value to a fraction, waking every bar it passes */
const to = (f: number, speed: number) => {
const s = st.current;
f = clamp(f, 0, 1);
const from = s.at;
s.at = f;
const a = Math.round(from * (n - 1)), b = Math.round(f * (n - 1));
/* how hard: the drag's speed in bars per second, through a
curve that saturates, scaled by the knob */
const push = (1 - Math.exp(-speed / 900)) * (knob.current / 60);
const lo = Math.min(a, b), hi = Math.max(a, b);
for (let i = lo; i <= hi; i++) s.energy[i] = Math.max(s.energy[i], push);
if (b !== s.lastBar) {
s.lastBar = b;
}
setValue(Math.round(f * 100));
loop();
};
const frac = (clientX: number) => {
const r = track.current!.getBoundingClientRect();
return (clientX - r.left) / r.width;
};
const lit = Math.round((value / 100) * (n - 1));
return (
<div className="wks">
<div
ref={track}
className="wks-track"
role="slider"
tabIndex={0}
aria-label="Value"
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={value}
style={{ width: n * (BAR + GAP) - GAP, height: H * 2.6 }}
onPointerDown={(e) => {
const s = st.current;
try { e.currentTarget.setPointerCapture(e.pointerId); } catch { /* a scripted pointer */ }
s.down = true;
s.lastX = e.clientX;
s.lastT = performance.now();
s.speed = 0;
to(frac(e.clientX), 0);
}}
onPointerMove={(e) => {
const s = st.current;
if (!s.down) return;
const now = performance.now();
const dt = Math.max(0.008, (now - s.lastT) / 1000);
/* speed in px per second, smoothed so one jittery frame
cannot fake a fling */
const v = Math.abs(e.clientX - s.lastX) / dt;
s.speed = s.speed * 0.5 + v * 0.5;
s.lastX = e.clientX;
s.lastT = now;
to(frac(e.clientX), s.speed);
}}
onPointerUp={(e) => {
st.current.down = false;
try { e.currentTarget.releasePointerCapture(e.pointerId); } catch { /* never captured */ }
}}
onPointerCancel={() => { st.current.down = false; }}
onKeyDown={(e) => {
const step = e.shiftKey ? 10 : 1;
let next: number | null = null;
if (e.key === "ArrowRight" || e.key === "ArrowUp") next = value + step;
if (e.key === "ArrowLeft" || e.key === "ArrowDown") next = value - step;
if (e.key === "Home") next = 0;
if (e.key === "End") next = 100;
if (next === null) return;
e.preventDefault();
/* a key press is a small, quick step: a little wake */
to(clamp(next, 0, 100) / 100, 600);
}}
>
{Array.from({ length: n }, (_, i) => (
<span
key={i}
ref={(b) => { els.current[i] = b; }}
className="wks-bar"
data-on={(value > 0 && i <= lit) || undefined}
style={{ height: H }}
/>
))}
</div>
<span className="wks-value">{value}</span>
</div>
);
}Điều khiển · HTML · CSS · JS
Sửa mã và tinh chỉnh bằng các nút điều khiển. Bản xem trước cập nhật khi bạn gõ.

Thành phần này chạy từ bản đóng gói nên mã script chỉ xem được ở đây. Hãy sửa HTML và CSS; mã nguồn đầy đủ nằm trong thẻ Mã.
Sửa trực tiếp mọi thành phần, tinh chỉnh bằng nút điều khiển, tải mã nguồn đầy đủ và sao chép prompt nâng cao.
$49 một lầnGiá tạm thời
Chế độ thử: không thu tiền thật.
Miễn phí: xem trước, nút sao chép và ghi chú bài học.
Nhãn hiển thị, viền dịu và trạng thái tiêu điểm rõ dẫn đường khi gõ.
Tìm kiếm, đăng nhập và ô văn bản ngắn.
Chỉnh chiều cao, màu viền và ánh sáng khi tiêu điểm.
Thêm component "Wake slider" từ Bencho (github.com/cabralorenzo/bencho) (MIT) vào ứng dụng React + Tailwind CSS của tôi. Tệp nguồn: https://github.com/cabralorenzo/bencho/blob/c65992417427bb09e661674ffa800bef29adef49/blocks/wake-slider/WakeSlider.tsx. Nhãn hiển thị, viền dịu và trạng thái tiêu điểm rõ dẫn đường khi gõ. Dùng cho: Tìm kiếm, đăng nhập và ô văn bản ngắn. Các thiết lập cần chỉnh: Chỉnh chiều cao, màu viền và ánh sáng khi tiêu điểm. Hỗ trợ giao diện sáng và tối, tôn trọng prefers-reduced-motion. Giữ thông báo giấy phép MIT.
Prompt dài hơn, có các bước tinh chỉnh, trợ năng và tích hợp.