<border-wc>

API Reference

Complete documentation for the <border-wc> web component and the data-border-effect attribute binder.

Install

npm install @profpowell/border-wc

Import the element. It self-registers as <border-wc> on import:

import '@profpowell/border-wc';

Or via a CDN:

<script type="module" src="https://unpkg.com/@profpowell/border-wc"></script>

Element — <border-wc>

Wraps an element with an extreme border effect. The component reads design tokens and updates live as attributes change.

<border-wc effect="squiggle" color="var(--ink)" animate> <blockquote>The shape around the thing is the thing.</blockquote> </border-wc>

Attributes

AttributeDescription
effectOne of thirty-two effects — see the Effects catalog below.
colorStroke / particle color (any CSS color; defaults to currentColor).
thicknessStroke width in px (default 2).
speedAnimation duration in ms (default 1000).
radiusCorner radius in px. Falls back to the host's computed border-radius.
animateBoolean. When present, plays the entrance / loop animation.
modeEffect-specific placement mode (e.g. center).
triggerEffect-specific reveal trigger (e.g. time | scroll on draw).
motionauto | reduce | force — overrides prefers-reduced-motion.

CSS custom properties

Every attribute can also be set via a matching --border-wc-* custom property, which takes precedence over the attribute. Use these to theme the effect from the cascade:

.fancy { --border-wc-color: oklch(0.7 0.18 250); --border-wc-thickness: 3px; }

Events

Effects catalog

Nineteen effects ship today, grouped into seven families. Each behaves under prefers-reduced-motion: reduce — motion-heavy effects render a static end-state, one-shot effects skip the reveal animation.

EffectFamilyRendererNotes
auroraModern CSSdiv + conic-gradientRotating multi-stop halo via @property --bwc-angle; blurred sibling glow.
barberModern CSSdiv + repeating-linearScrolling diagonal stripes; mode="warning | candy | racing" presets.
chromaModern CSShost box-shadow8-direction chromatic-aberration shadow stack on the host element.
wingsModern CSSdiv + clip-pathTwo oversized colored triangles morphing behind the card; mix-blend-mode: multiply.
antsModern CSSsvgPhotoshop-style marching-ants selection — animated stroke-dashoffset with white underlay.
lightningEnergysvg + feGaussianBlurJagged glowing bolts at evenly-spaced anchor points; refactored from canvas in 0.2.
neonEnergysvg + feMergeCrisp stroked path with a real feGaussianBlur+feMerge halo (SMIL pulse). mode="synthwave" swaps the stroke for a 3-stop cyan→magenta→orange gradient, widens the bloom, and adds a sweeping horizontal scanline.
glitchEnergysvgRGB-split stroked paths with random offsets.
hudEnergysvg + divCyberpunk FUI: corner brackets + edge tick-marks + sweeping scan line. Host left untouched.
asciiRetro/Craftsvg textMonospace + - | characters at corners and edges (one-shot reveal).
stitchingRetro/CraftsvgDashed stitches sew themselves around the perimeter.
typewriterRetro/Craftsvg textPer-char reveal; use data-text on the host for custom glyphs.
barbed-wirePatternsvgWire path + rotated four-point barbs.
ropePatternsvgTwo offset dashed strands suggesting a twist.
scallopPatternsvgHalf-circle bumps oriented along the outward normal.
scoopPatternsvgInverse of scallop: concave bites cut into each edge (postage-stamp from the back). One-shot dashoffset reveal.
zigzagPatternsvgSawtooth perimeter; optional marching-dashes loop.
wavePatternsvgSmooth sine perimeter via quad beziers; optional marching-dashes loop.
decoPatternsvgArt Deco: double stroked perimeter + radiating sunburst fans at each corner.
memphisPatternsvgMemphis confetti: arc-length sampler scatters mixed shapes with staggered bob animation.
opartPatterndiv + mask-compositeOp-Art moiré ring: crossed repeating-linear-gradient stripes masked into a perimeter band, shifted for shimmer.
psychedelicTrippysvgRainbow gradient stroke + hue-rotate + marching dashes.
plasmaTrippycanvasHSL-cycling glow piecewise along the perimeter.
gooeyTrippysvg + feColorMatrixMetaball ring: feGaussianBlur + alpha-boost ColorMatrix merge blobs orbiting along the perimeter via offset-path.
sparksMarqueesvg + offset-pathComet-tail circles orbiting via offset-path; refactored from canvas in 0.2.
marqueeMarqueesvgChase-light bulbs with staggered keyframes; mode="chase | sparkle | random".
washiDecorationdiv + svg filterTape strips on the host (not a perimeter). mode="corner | corners | top | bottom | left | right | span | scatter". Tunables via --washi-pattern (stripe/solid/dot/check/grid), --washi-torn (fray/soft/straight), --washi-width, --washi-length, --washi-angle, --washi-count, --washi-opacity, --washi-color-2.
filmstripDecorationdivTwo sprocket-hole bars top + bottom (radial-gradient pattern). Body untouched.
ticketDecorationsvgNotched perimeter (semicircle dips at ~70% along top/bottom) with a dashed tear line. Body fill is in the SVG.
buntingDecorationsvgPennant flags hanging from a quadratic swag along the top edge; each pennant sways with a staggered delay.
squiggleOriginalssvg + feTurbulenceHand-drawn turbulence on a stroked path.
drawOriginalssvgOne-shot stroke-on reveal (fires border-wc:draw-complete). trigger="scroll" drives the reveal via animation-timeline: view() as the host enters the viewport; degrades to a fully-drawn border on engines without scroll-driven animations.

Modern CSS notes

A few effects rely on browser features that have arrived since 2024. They degrade gracefully when missing:

Attribute binder — data-border-effect

border-wc shares the data-border-effect attribute with vanilla-breeze's base tier. Base values (spin, pulse, march, hue-cycle, breathe, corner-trace) are owned by vanilla-breeze's CSS — border-wc ignores them. Extreme values — the thirty-two effects in the catalog above — are handled here.

To opt in to extreme effects without writing a <border-wc> wrapper, import the binder once:

import '@profpowell/border-wc/attr';

Then annotate any element:

<article data-border-effect="squiggle">…</article>

Params come from --border-wc-* CSS custom properties (the same set as on the element). The binder auto-scans on import and watches the DOM for added / changed / removed nodes.

Used with vanilla-breeze

border-wc is the extreme-tier sibling of vanilla-breeze's base border tier — together they form the "Decorated Layers" border surface. Pair this package with vanilla-breeze for CSS-only base effects (spin, pulse, …) and reach for <border-wc> / the binder when you need SVG / canvas-driven effects. Both honor data-border-effect, so authors write one attribute.