Buttons & Toggles
Seamless Stroke Button
A hairline button whose border carries one short dash travelling the frame forever; on hover the accent draws the whole frame in and the label brightens, on press it dips and tints. A mono status line reports idle, live and pressed.
csslight complexitysubtle motionhover
Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited
Worth keeping?
Votes steer what gets built next — sign in to cast one, free to read
When to use it
Primary or secondary actions in calm, monochrome interfaces; product UIs where a button should feel alive at rest without a glow or a gradient.
When not to
Dense toolbars with many buttons — the travelling stroke is meant for one or two focal controls, not a row of twenty.
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change the label text inside .sb12-btn, retune the travel speed (2.4s on .sb12-run) and the demo cycle (CYCLE=4800 with the idle/live/pressed thresholds in tick()), and swap the accent by editing --sb12-accent, --sb12-accent-soft and --sb12-accent-line together. Theme: dark tokens live in :root, the light variant in :root[data-theme="light"]; ?theme=light or a {type:'forever:theme'} postMessage switches at runtime.
Safe to edit
- button label (the span inside .sb12-btn)
- travelling dash length and speed (stroke-dasharray .2 .8 and the 2.4s on .sb12-run)
- draw-in duration (.7s on .sb12-draw)
- idle demo timeline (CYCLE=4800; idle < 2200 < live < 3700 < pressed < 3950)
- accent tokens (--sb12-accent / -soft / -line)
- theme tokens (:root dark defaults + [data-theme=light] overrides)
Keep intact
- IIFE wrapper
- fit() — the SVG viewBox is sized to the button's real pixel box so the corner radius stays true
- pathLength=1 on both rects (the loop wraps exactly because a full offset cycle equals one path length)
- prefers-reduced-motion guard (no traveller, accent frame drawn, no demo clock)
- visibilitychange pause (clock + animation-play-state)
- real pointer/focus events take over from the demo; it resumes after 3.6 s quiet
- theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)
Known limitations
- The demo hover/press cycle is for the wall — remove the tick() clock before shipping in a product
- The SVG frame is refit on resize, not on font load in browsers without document.fonts
More Buttons & Toggles components
- Magnetic ButtonDark pill button drifts in an idle orbital float; cursor proximity pulls it magnetically with a label inner-parallax and emerald-to-copper glow on hover.
- Gooey Liquid TogglePill toggle where an SVG goo-filtered blob stretches and merges as it slides from off to on, shifting grey to magenta. Auto-cycles as demo.
- Morphing Action FABGradient FAB whose plus icon rotates 135° to an X on click, fanning six icon buttons outward in a staggered radial spring animation. Auto-cycles in demo mode.
- Material RippleDark rounded button that spawns an expanding ink ripple from the tap point; idles by firing ripples from random positions every 1.5 s.
- Neon Glow PulseAmber pill button on near-black that breathes a bright neon bloom via opacity pulse on a pseudo-element; hover shifts background and text color.
- Jelly PressAurora-gradient button squashes and stretches with a spring keyframe animation on click; auto-cycles idle squish every 2.1s to stay alive at rest.