效能
需注意幀率: 平均 60 fps,p5 59.5 · 長任務: 0 個,共 0 毫秒,最長 0 毫秒 · 原始碼 gzip 7.6 KB · 執行時 158 KB
Signature padMIT輸入框Bencho
由 Lorenzo Cabra 製作的輸入框 React 元件。依據 MIT 授權從 Bencho 原樣收錄,此處為即時預覽。
品質報告
等級和分數來自建置或測試時跑過的自動檢查。沒跑過的項目會標成「未檢測」,不會填假資料。
幀率: 平均 60 fps,p5 59.5 · 長任務: 0 個,共 0 毫秒,最長 0 毫秒 · 原始碼 gzip 7.6 KB · 執行時 158 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;
}
}
/* Signature.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.
*/
/* ══ Signature pad ════════════════════════════════════════ */
.sig-frame { display: grid; place-items: center; }
.sig {
position: relative;
flex: none;
/* folding into the pill, and opening back out: one long
quint-out glide, no overshoot — a card this size bouncing
read as a jolt, not a landing */
transition:
width 600ms cubic-bezier(0.22, 1, 0.36, 1),
height 600ms cubic-bezier(0.22, 1, 0.36, 1),
border-radius 600ms cubic-bezier(0.22, 1, 0.36, 1);
border-radius: var(--r);
overflow: hidden;
background: var(--fill-slab, var(--card));
color: var(--fill-on, var(--ink));
font-family: var(--font-ui);
touch-action: none;
user-select: none;
-webkit-user-select: none;
cursor: crosshair;}
[data-stroke="on"] .sig { box-shadow: inset 0 0 0 1px var(--pane-edge); }
.sig-ink {
position: absolute; inset: 0; pointer-events: none; overflow: visible;
--sig-c: var(--fill-on, var(--ink));
color: var(--sig-c);
transition: color 260ms ease;}
.sig[data-ink="Blue"] .sig-ink { --sig-c: #2446d8; }
[data-fill="dark"] .sig[data-ink="Blue"] .sig-ink { --sig-c: #7d95ff; }
/* signed, and held: the ink settles to a soft tint of itself before
the pad folds it away */
.sig[data-settled] .sig-ink { color: color-mix(in srgb, var(--sig-c) 30%, var(--fill-slab, var(--card))); }
.sig-line {
position: absolute;
height: 1px;
background: currentColor;
opacity: 0.16;
pointer-events: none;}
.sig-hint {
position: absolute;
top: 140px;
font-size: 12px;
font-weight: 400;
pointer-events: none;
letter-spacing: 0em;}
.sig-hint {
left: 0;
right: 0;
text-align: center;
opacity: 0.38;
transition: opacity 220ms ease;}
.sig[data-inked] .sig-hint { opacity: 0; }
/* signed: the signature shrinks WITH the card, on the same
curve, into the middle of the pill — and fades as it goes, so
by the time it would be too small to read it is gone */
.sig[data-signed] { cursor: default; }
.sig-face {
position: absolute;
left: 50%;
top: 50%;
width: 300px;
height: 180px;
translate: -50% -50%;
transition: scale 600ms cubic-bezier(0.22, 1, 0.36, 1), opacity 420ms ease 220ms;}
.sig[data-signed] .sig-face {
scale: 0.35;
opacity: 0;
transition: scale 600ms cubic-bezier(0.22, 1, 0.36, 1), opacity 420ms ease 160ms;}
.sig[data-settled] :is(.sig-clear, .sig-hint) { opacity: 0; transition: opacity 160ms ease; }
.sig[data-settled] .sig-line { opacity: 0.08; transition: opacity 420ms ease; }
.sig-said {
position: absolute;
inset: 0;
display: grid;
place-items: center;
pointer-events: none;}
.sig-pill {
display: flex;
align-items: center;
gap: 8px;
height: 100%;
width: 100%;
justify-content: center;
padding: 0;
border: 0;
background: none;
color: inherit;
font: inherit;
font-size: 13px;
font-weight: 500;
white-space: nowrap;
cursor: pointer;
pointer-events: auto;
-webkit-tap-highlight-color: transparent;
/* in once the pill has nearly arrived */
animation: sig-said 320ms ease 420ms both;
letter-spacing: 0em;}
.sig-pill:focus-visible { outline: 2px solid var(--signal, #2231dd); outline-offset: 2px; border-radius: 999px; }
.sig-check {
color: #1f9d55;
animation: sig-check 420ms cubic-bezier(0.3, 1.6, 0.4, 1) 460ms both;}
.sig-clear {
position: absolute;
top: 10px;
right: 10px;
height: 28px;
padding: 0 12px;
border: 0;
border-radius: var(--inner);
background: color-mix(in srgb, currentColor 7%, transparent);
color: inherit;
font: inherit;
font-size: 12px;
font-weight: 500;
cursor: pointer;
opacity: 0;
scale: 0.9;
pointer-events: none;
-webkit-tap-highlight-color: transparent;
transition: opacity 160ms ease, scale 220ms cubic-bezier(0.24, 1.34, 0.38, 1), background 160ms ease;
letter-spacing: 0em;}
.sig[data-inked] .sig-clear { opacity: 1; scale: 1; pointer-events: auto; }
.sig-clear:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.sig-clear:active { scale: 0.96; }
.sig-clear:focus-visible { outline: 2px solid var(--signal, #2231dd); outline-offset: 2px; }
@keyframes sig-said { from { opacity: 0; } }
@keyframes sig-check { from { opacity: 0; scale: 0.3; rotate: -20deg; } }
// bencho source (MIT). npm i @tabler/icons-react motion react · Tailwind CSS v4
// ── blocks/signature/Signature.tsx (https://github.com/cabralorenzo/bencho/blob/c65992417427bb09e661674ffa800bef29adef49/blocks/signature/Signature.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";
import { IconCheck as Check } from "@tabler/icons-react";
/* ══ Signature pad ════════════════════════════════════════
Sign on the line. The ink thins as the pen moves faster and
pools as it slows, the way a real nib does — which is most
of what makes a scribble read as a signature rather than a
trace of the mouse.
── AND THEN IT GETS OUT OF THE WAY ─────────────────────
Pause after the last stroke and the pad folds itself into a
small pill that says Signed — the whole card shrinking into
the confirmation, rather than a line of small print under
the signature. Press the pill to sign again.
── CLEAR REWINDS ───────────────────────────────────────
Clear does not wipe. The ink un-draws, last point first, all
the way back to the first touch — the signature taken back
in the order it was given.
── SVG, NOT A CANVAS ───────────────────────────────────
Every segment is its own short curve with its own width. A
canvas would need its pixel ratio guessed for a block the
wall draws at 0.8 and the overlay at 1.4, and would not
follow the Fill control without being told to repaint; an
SVG is crisp at any scale and its ink is currentColor. */
/* the pen lifts: the ink softens this soon after, and the pad folds
away at FOLD_MS if the pen has not come back. A new stroke in
between brings the ink straight back to full strength */
const SOFT_MS = 220;
const FOLD_MS = 1500;
const W = 300;
const H = 180;
/* where the line is, in the block's own pixels */
const LINE_Y = 128;
const INSET = 28;
/* what the pad folds into */
const PILL_W = 112;
const PILL_H = 40;
type Pt = { x: number; y: number; w: number };
const clamp = (v: number, a: number, b: number) => Math.min(b, Math.max(a, v));
const ease = (k: number) => (k < 0.5 ? 2 * k * k : 1 - Math.pow(-2 * k + 2, 2) / 2);
/* one stroke as short quadratic pieces through the midpoints,
each as wide as the pen was there */
function pieces(s: Pt[], upto: number, key: string) {
const out: React.ReactNode[] = [];
const n = Math.min(s.length, upto);
if (n <= 0) return out;
if (n === 1 || s.length === 1) {
out.push(<circle key={key} cx={s[0].x} cy={s[0].y} r={s[0].w / 2} fill="currentColor" />);
return out;
}
for (let i = 1; i < n; i++) {
const a = s[i - 1];
const b = s[i];
const start = i === 1 ? a : { x: (s[i - 2].x + a.x) / 2, y: (s[i - 2].y + a.y) / 2 };
const end = i === s.length - 1 ? b : { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 };
out.push(
<path
key={`${key}-${i}`}
d={`M${start.x.toFixed(1)} ${start.y.toFixed(1)}Q${a.x.toFixed(1)} ${a.y.toFixed(1)} ${end.x.toFixed(1)} ${end.y.toFixed(1)}`}
strokeWidth={((a.w + b.w) / 2).toFixed(2)}
/>,
);
}
return out;
}
export function Signature({
/* how heavy the pen is, 0..100 */
pen = 50,
/* how much the hand's wobble is taken out, 0..100 */
smooth = 50,
ink = "Black",
/* how fast Clear un-draws, 0..100 */
rewind = 50,
corner = 20,
}: {
pen?: number;
smooth?: number;
ink?: string;
rewind?: number;
corner?: number;
} = {}) {
const pad = useRef<HTMLDivElement>(null);
const strokes = useRef<Pt[][]>([]);
const [, setV] = useState(0);
const redraw = () => setV((v) => v + 1);
const [cut, setCut] = useState<number | null>(null);
const [signed, setSigned] = useState(false);
/* the beat between: the pause has said it is done, the ink has
softened to a tint, and the pad has not yet folded away */
const [settled, setSettled] = useState(false);
const down = useRef(false);
const last = useRef({ x: 0, y: 0, t: 0, w: 0 });
const later = useRef(0);
const raf = useRef(0);
const knobs = useRef({ pen, smooth, rewind });
knobs.current = { pen, smooth, rewind };
const fold = useRef(0);
useEffect(() => () => {
clearTimeout(fold.current);
clearTimeout(later.current);
cancelAnimationFrame(raf.current);
}, []);
/* the pen's two widths, both of which move with the knob so
neither end of it is a pen that cannot vary */
const widths = () => {
const p = clamp(knobs.current.pen, 0, 100) / 100;
return { thin: 0.8 + p * 2, thick: 2.2 + p * 5 };
};
/* the pointer, in the block's own pixels — the block is drawn
scaled on the wall and in the overlay */
const local = (e: React.PointerEvent) => {
const r = pad.current!.getBoundingClientRect();
return { x: ((e.clientX - r.left) * W) / r.width, y: ((e.clientY - r.top) * H) / r.height };
};
const rewinding = cut !== null;
const total = strokes.current.reduce((n, s) => n + s.length, 0);
const inked = total > 0;
const onDown = (e: React.PointerEvent<HTMLDivElement>) => {
if (rewinding || signed) return;
try { e.currentTarget.setPointerCapture(e.pointerId); } catch { /* a scripted pointer */ }
down.current = true;
clearTimeout(later.current);
clearTimeout(fold.current);
setSigned(false);
/* pen back on the pad before it folded: the ink comes back too */
setSettled(false);
const p = local(e);
const { thin, thick } = widths();
const w = (thin + thick) / 2;
last.current = { ...p, t: performance.now(), w };
strokes.current.push([{ ...p, w }]);
redraw();
};
const onMove = (e: React.PointerEvent<HTMLDivElement>) => {
if (!down.current) return;
const raw = local(e);
const l = last.current;
/* smoothing: the pen follows the hand on a lag */
const k = 1 - (clamp(knobs.current.smooth, 0, 100) / 100) * 0.75;
const x = l.x + (raw.x - l.x) * k;
const y = l.y + (raw.y - l.y) * k;
const d = Math.hypot(x - l.x, y - l.y);
if (d < 0.8) return;
const t = performance.now();
const v = d / Math.max(1, t - l.t);
const { thin, thick } = widths();
/* fast is thin, slow pools; and the width itself eases, so
a single quick frame cannot make a notch in the line */
const target = thick - (thick - thin) * clamp(v / 1.6, 0, 1);
const w = l.w + (target - l.w) * 0.35;
last.current = { x, y, t, w };
strokes.current[strokes.current.length - 1].push({ x, y, w });
redraw();
};
const onUp = (e: React.PointerEvent<HTMLDivElement>) => {
try { e.currentTarget.releasePointerCapture(e.pointerId); } catch { /* never captured */ }
if (!down.current) return;
down.current = false;
clearTimeout(later.current);
clearTimeout(fold.current);
fold.current = window.setTimeout(() => {
if (!down.current && strokes.current.length) setSettled(true);
}, SOFT_MS);
later.current = window.setTimeout(() => {
if (!down.current && strokes.current.length) {
/* a pause after the last stroke is what signing IS: the
softened ink shrinks away as the pad folds into the pill */
setSigned(true);
}
}, FOLD_MS);
};
const clear = () => {
if (!inked || rewinding) return;
clearTimeout(later.current);
clearTimeout(fold.current);
setSigned(false);
setSettled(false);
const n = total;
const per = 2 + ((100 - clamp(knobs.current.rewind, 0, 100)) / 100) * 8;
const dur = clamp(n * per, 350, 2400);
const t0 = performance.now();
const step = (t: number) => {
const k = Math.min(1, (t - t0) / dur);
setCut(Math.round(n * (1 - ease(k))));
if (k < 1) {
raf.current = requestAnimationFrame(step);
return;
}
strokes.current = [];
setCut(null);
};
raf.current = requestAnimationFrame(step);
};
/* the pill, pressed: the ink goes while nobody can see it,
and the pad opens back out empty */
const again = () => {
strokes.current = [];
setSigned(false);
setSettled(false);
};
/* draw up to the cut, stroke by stroke */
const ink$: React.ReactNode[] = [];
let left = cut ?? Infinity;
strokes.current.forEach((s, i) => {
if (left <= 0) return;
ink$.push(...pieces(s, left, String(i)));
left -= s.length;
});
const r = clamp(corner, 0, 28);
/* the Clear pill sits 10 in: concentric once there is a curve */
const inner = Math.max(0, r - 10 * Math.min(1, r / 20));
return (
/* a fixed frame, so folding into the pill never rescales
the block on the wall */
<div className="sig-frame" style={{ width: W, height: H }}>
<div
ref={pad}
className="sig"
data-ink={ink}
data-inked={(inked && !rewinding && !signed && !settled) || undefined}
data-settled={(settled || signed) || undefined}
data-signed={signed || undefined}
style={{
/* width and height, never a scale: the corner has to stay
a corner all the way down to the pill */
width: signed ? PILL_W : W,
height: signed ? PILL_H : H,
"--r": signed ? `${PILL_H / 2}px` : `${r}px`,
"--inner": `${Math.min(14, inner)}px`,
} as React.CSSProperties}
onPointerDown={onDown}
onPointerMove={onMove}
onPointerUp={onUp}
onPointerCancel={onUp}
onContextMenu={(e) => e.preventDefault()}
>
{/* everything drawn on the pad, on one layer centred in the
card: signing, it shrinks with the card into the pill's
middle instead of being cut off by its edges */}
<div className="sig-face">
<span className="sig-line" style={{ top: LINE_Y, left: INSET, right: INSET }} aria-hidden="true" />
<span className="sig-hint" aria-hidden="true">Sign here</span>
<svg
className="sig-ink"
viewBox={`0 0 ${W} ${H}`}
width={W}
height={H}
fill="none"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
role="img"
aria-label={inked ? "Signature" : "Empty signature pad"}
>
{ink$}
</svg>
</div>
<button
type="button"
className="sig-clear"
tabIndex={inked && !rewinding && !signed && !settled ? 0 : -1}
onPointerDown={(e) => e.stopPropagation()}
onClick={clear}
>
Clear
</button>
<span className="sig-said" aria-live="polite">
{signed && (
<button
type="button"
className="sig-pill"
aria-label="Signed. Sign again"
onPointerDown={(e) => e.stopPropagation()}
onClick={again}
>
<Check size={14} strokeWidth={2} className="sig-check" />
Signed
</button>
)}
</span>
</div>
</div>
);
}控制項 · HTML · CSS · JS
直接改程式碼,再用控制項微調,預覽會隨輸入即時更新。

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