Skip to content

AnimateLighting

A light travelling around the outside of something. The glow is behind the content rather than on it, so it marks whatever it wraps without altering a single thing about how that is drawn.

tsx
import { AnimateLighting } from 'neba';

<AnimateLighting size="md">
  <Card title="Analysing 4,281 rows">This usually takes about a minute.</Card>
</AnimateLighting>;

Props

PropTypeDefaultDescription
glowstringA CSS colour, when a semantic family is not what is wanted. Overrides color
spreadnumber3How far past the content the light reaches, in pixels
arcnumber50How much of the outline is lit at once, in degrees. Small is a travelling spark; large is a sweep
blurnumber4How soft the light is, in pixels. At 0 it reads as a graphic rather than as light
reversebooleanfalseRuns the light the other way round
sizeshared'xs' | 'sm' | 'md' | 'lg' | 'xl''md'The radius the light follows. It has to match what is inside
colorshared'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info''primary'Which family the light is drawn in
durationsharednumber3000How long one run takes, in milliseconds
delaysharednumber0How long before it starts, in milliseconds
easingstringThe easing curve, as CSS writes it. Defaults to the house curve
repeatsharednumber | 'infinite''infinite'How many times it runs
alternatesharedbooleanfalseRuns every other pass backwards, so a repeat returns instead of jumping
triggershared'mount' | 'visible' | 'hover' | 'manual''mount'What starts it. visible is on scrolling into view, hover is under the pointer (focus counts), manual is whatever play says
playbooleanRuns it when trigger is manual. Each false → true starts it over
oncesharedbooleantrueWith trigger="visible", whether it runs only the first time. Off, it runs again on every return
thresholdsharednumber0.2With trigger="visible", how much of the element has to be on screen, from 0 to 1
pausedsharedbooleanfalseHolds the animation where it is
renderuseRender.RenderPropRenders something other than a div (render={<section />}). Base UI's own escape hatch
childrenReactNodeWhat the light travels around

Every other <div> attribute passes through to the root. The settings shared by every Animate* are defined in prop conventions.

size has to agree with the radius of what is inside. The glow follows the wrapper's own corners, so a lg card in an xs Lighting will show light poking out of four corners the card has already rounded away.

Examples

color and glow

color is one of the six semantic families. glow takes a CSS colour instead, for a light that is decoration rather than a status.

arc, spread and blur

arc is how much of the outline is lit at once, in degrees: small is a travelling spark, large is a sweep. spread is how far past the content the light reaches and blur is how soft it is: at 0 it reads as a graphic rather than as light.

trigger="hover"

An infinite effect on hover runs while the pointer is on it and stops when it leaves. Keyboard focus counts as a pointer, so the effect is reachable without a mouse.

Accessibility

  • Under a reduced-motion preference the arc stops travelling and becomes an even glow. The decoration survives; the motion does not.
  • Because of that, the light is never the only thing saying what is happening. Use it alongside a word ("Analysing", "Live"), rather than instead of one.
  • The wrapper adds no role and no name.

Released under the MIT License