forever components

Buttons & Toggles

Stroke-Draw Outline

Ghost button whose rounded-rect SVG border self-draws via stroke-dashoffset on hover; an idle loop auto-cycles draw/erase every ~2s.

svglight complexitysubtle motionhover

Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited

Live demo — the real component, running in a sandbox. One self-contained HTML file, zero dependencies. Open it on the canvas →
Worth keeping? Votes steer what gets built next — sign in to cast one, free to read

When to use it

CTAs on dark backgrounds, hero section buttons, any ghost-style button needing tactile hover feedback without heavy motion.

When not to

Light backgrounds (bg hardcoded dark). Forms requiring instant-visible borders — the outline starts hidden by default.

Working with an AI agent

Every component ships agent-ready metadata. An example instruction for this one:

Change accent to teal (#00d4aa), slow the draw to 1.4s (transition-duration on .c07-draw__rect), and update idle hold time from 2200 to 3500ms. 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

  • accent color (--accent-iris: #A9D22D)
  • stroke draw duration (0.9s on .c07-draw__rect)
  • idle hold time (lit?2200 timeout)
  • idle erase pause (1300 timeout)
  • stroke-dasharray total length (480)
  • theme tokens (:root dark defaults + [data-theme=light] overrides)

Keep intact

  • stroke-dasharray/stroke-dashoffset pattern (critical for draw effect)
  • IIFE wrapper
  • prefers-reduced-motion guard
  • visibilitychange pause
  • theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)

Known limitations

  • stroke-dasharray=480 is hardcoded — must recalculate if button size changes significantly
  • Auto-cycles by default; remove setTimeout loop before shipping in production
  • Light re-theme via the [data-theme=light] token block; catalog bg/accent describe the dark default

buttonstrokesvgoutlineghost-buttondrawloop

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.