react-native-wgpu-components

BorderBeam

Animated GPU-rendered border glow.

<BorderBeam> renders an animated halo around its children using a single WGSL fragment shader. The shader composes a stroke, an inner glow, and an outer bloom in one pass; a per-frame head advances the bright sweep around the rect's perimeter.

Loading preview…

Props

PropTypeDefaultNotes
colorsPalettePreset | ColorStop[]'colorful'Named preset or custom stops. See Palettes.
mode'aura' | 'line''aura'aura is a soft diffuse glow; line is a bright stroke tracing the border.
scalenumber1Multiplier on the effect's internal pixel sizes. Sizes auto-scale with the element's smaller half-dimension so the effect looks proportional across sizes; scale amplifies or attenuates.
borderRadiusnumber16px.
innerGlownumberfrom mode0–1.
activebooleantrueFades the effect in/out via Reanimated.
followCursorbooleanfalseWhen hovering, the bright sweep tracks the cursor. Requires react-native-gesture-handler. On touch-only devices it falls back to the time-based auto-orbit.
durationnumber3Seconds per orbit.
strengthnumber10–1 overall opacity multiplier.
brightnessnumber1.3Stroke intensity multiplier.
saturationnumber1.2Color saturation multiplier.
styleStyleProp<ViewStyle>Applied to the children wrapper.
containerStyleStyleProp<ViewStyle>Applied to the outer view.

Modes

aura favors interior haze + outer bloom and reads as a glow. line dominates with the border stroke and reads as a chasing beam.

Loading preview…

Cursor tracking

followCursor swaps the time-based head sweep for a cursor-following one. The handoff is smooth — when you lift the cursor, the sweep resumes from wherever the cursor last was, rather than teleporting to the time-based position. The gradient itself keeps drifting independently so the effect stays alive.

Loading preview…

Animating active

active={false} smoothly fades the effect out over 400ms. Use it as a focus indicator on inputs, a hover state on buttons, etc.

const [focused, setFocused] = useState(false);

<BorderBeam active={focused}>
  <TextInput onFocus={...} onBlur={...} />
</BorderBeam>

What it does not do

  • No backdrop blur on the area inside the rect — the shader only writes pixels in the halo band. If you want a blur, layer your own.
  • No shape other than rounded rect. Use borderRadius={999} for pills.
  • Does not currently animate borderRadius, duration, or colors with a transition — changes are immediate. (Animating active, strength, brightness, saturation IS smooth.)

On this page