Overview
Import ZuiElectricBorder from the electric-border entry and wrap your own content. The root is a ref-forwarding div with no extra focus stop or button semantics. Provide your own padding, background, accessible labels, and visible child focus styles. The border does not clip content.
Defaults: appearance=default, active=true, interactive=true, speed=1, intensity=1, thickness=1.5px, radius=24px, glow=true, sparks=true, intro=true, and reducedMotion=false. Speed is clamped to 0–3, intensity to 0–2, thickness to 0.5–4, and radius to 0–9999. Nonfinite values use defaults. Intensity zero keeps a smooth outline and suppresses sparks.
The introduction takes about 600ms and a click pulse about 400ms at speed=1. Speed scales animation time. Toggling active back on replays the introduction; changing configuration preserves the running phase. These are Zentauri timings, not claimed reference constants.
Consumers using Tailwind v4 must include the package in their @source scan. The component server-renders its content and static rim; browser work starts after mounting. A missing matchMedia API keeps the static fallback.
Up to three strands, 320 perimeter samples, and two short-lived arcs are rendered at a maximum of 30 updates per second. Hidden tabs and offscreen instances suspend animation. On older browsers without ResizeObserver, mount, window resize, and child load events remeasure the frame.
The glow and arcs extend up to roughly 50px outside the frame at maximum intensity. Reserve surrounding space and avoid overflow:hidden on ancestors when you want the full effect. Use this on a few highlights rather than every item in a large list. Custom asymmetric or percentage corner radii are outside the uniform-radius API.
Common use cases
- Feature cards, pricing highlights, and product announcements.
- Composers and panels with native interactive content.
- Status surfaces where text and semantics carry the meaning.
FAQ
Does this require Framer Motion, canvas, or WebGL?
No. Electric Border uses independently written SVG geometry and a bounded animation loop. It adds no dependency beyond the standard Zentauri React/CVA/class utility peers.
What happens with reduced motion or touch input?
System reduced-motion preferences, reducedMotion=true, active=false, and speed=0 produce a static rim. Touch and coarse pointers keep ambient animation without cursor tracking. Native child buttons and links remain usable; their activation can trigger a pulse when interactive=true.
How can I change colors and size?
Choose an appearance or override its paired --zui-electric-border-* CSS tokens. Use className and style for width, height, and content styling. Radius is a uniform corner radius in CSS pixels; it is fitted to the element dimensions.
Is this the React Bits implementation?
No. The interaction principles were studied in the React Bits demo. Zentauri uses an original SVG renderer, a smaller API, theme-aware colors, and a static fallback. It does not redistribute React Bits code or assets.