Pulsing Border
Wrap an element in an animated glow ring that signals activity, such as an AI model generating a reply.
Overview
Pulsing Border draws a soft ring of light around any rounded element. Colored spots drift around the outline at their own pace, the glow breathes, and optional smoke breaks the bloom into wisps. Use it to show that something is working on the user's behalf: a prompt field while a model generates a reply, a card while an agent runs, or a call to action that needs attention.
The ring is drawn on a canvas that sits over the element and extends past its edges by the bloom distance. That canvas ignores pointer events and is positioned absolutely, so the wrapped element keeps its own layout, focus ring, and click targets. Toggle active to fade the glow in and out; the render loop stops while the glow is hidden.
Installation
Usage
import { PulsingBorder } from "honestui/shaders"
<PulsingBorder active={isGenerating} radius={14}>
<form className="rounded-[14px] border bg-background p-2">
<textarea aria-label="Prompt" />
</form>
</PulsingBorder>Set radius to the wrapped element's border radius so the ring hugs its corners. Ancestors with overflow: hidden clip the bloom, so leave room around the element or reduce bloom.
Examples
AI prompt field
The glow stays off while the field waits for input and fades in only while a reply is being generated, so it carries state. The status text below the field announces the same state to screen readers.
Accessibility
The glow is decorative and hidden from assistive technology. When it signals a state such as "generating", announce that state in text as well, for example with a live region or the button's accessible name, and never rely on the glow alone.
When the user prefers reduced motion, the ring renders one still frame and fades instead of animating. Browsers without WebGL2 get a still CSS ring in the same colors. Keep intensity moderate so the ring never reduces the contrast of the element's own border or focus indicator.