效能
需注意幀率: 平均 60 fps,p5 59.5 · 長任務: 0 個,共 0 毫秒,最長 0 毫秒 · 原始碼 gzip 5.3 KB · 執行時 153 KB
Wake sliderMIT輸入框Bencho
由 Lorenzo Cabra 製作的輸入框 React 元件。依據 MIT 授權從 Bencho 原樣收錄,此處為即時預覽。
品質報告
等級和分數來自建置或測試時跑過的自動檢查。沒跑過的項目會標成「未檢測」,不會填假資料。
幀率: 平均 60 fps,p5 59.5 · 長任務: 0 個,共 0 毫秒,最長 0 毫秒 · 原始碼 gzip 5.3 KB · 執行時 153 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;
}
}
/* 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>
);
}控制項 · HTML · CSS · JS
直接改程式碼,再用控制項微調,預覽會隨輸入即時更新。

線上編輯每個元件,用控制項微調,下載完整原始碼,複製進階提示詞。
一次性 $49暫定價格
測試模式:不會真的扣款。
免費:預覽、複製按鈕和課程說明。
可見的標籤、安靜的邊框和清楚的焦點狀態引導輸入。
搜尋、登入和短文字欄位。
調高度、邊框顏色和焦點光暈。
把 Bencho (github.com/cabralorenzo/bencho)(MIT)中的「尾跡滑桿」元件加入我的 React + Tailwind CSS 應用程式。原始檔:https://github.com/cabralorenzo/bencho/blob/c65992417427bb09e661674ffa800bef29adef49/blocks/wake-slider/WakeSlider.tsx。可見的標籤、安靜的邊框和清楚的焦點狀態引導輸入。 適用情境:搜尋、登入和短文字欄位。 可調參數:調高度、邊框顏色和焦點光暈。 支援淺色與深色主題,遵循 prefers-reduced-motion。保留 MIT 授權聲明。
更完整的提示詞,包含調參、無障礙和接入步驟。