sdxc

Type to search, or start from one of these:

[ @sdxc/ui/animations ]

shimmer

Sweeping highlight band for an indeterminate progress fill, resolved entirely to @keyframes so it runs from server-rendered markup and settles once the gate clears.

import { shimmer } from "@sdxc/ui/animations";

Signature

shimmer<Node extends Element = Element>(options?: Shimmer.Options): Mixin<Node>

Returns a @sdxc/u mixin ready for a progress indicator's fill element.

Parameters

ParameterTypeDescription
options?Shimmer.OptionsTiming, band width, and gating for the loop.

Examples

<ProgressBar.Indicator mix={[shimmer()]} />

The events, constants and types its module publishes, each imported from @sdxc/ui/animations too.

Interface

Shimmer.Options

Tuning for a shimmer loop: timing, highlight width, and the platform state it runs under.

MemberTypeDescription
duration?stringLength of one sweep across the band, as a CSS time. Defaults to DEFAULT_SHIMMER_DURATION.
easing?stringCSS easing function driving the sweep. Defaults to DEFAULT_SHIMMER_EASING.
bandSize?stringWidth of the moving highlight band, as a CSS length or percentage. Defaults to DEFAULT_SHIMMER_BAND_SIZE.
outsideGate?"hidden" | "visible"What the host looks like outside the gate. "hidden" suits an element that exists only as a loading cue; "visible" keeps an element that carries its own content legible once the loop settles. Defaults to "hidden".
when?stringSelector fragment, relative to the host, that gates the loop. Defaults to DEFAULT_SHIMMER_WHEN; pass a custom fragment (e.g. [data-indeterminate="true"]) for a hand-built progress indicator.

Written by Sergio Xalambrí. Follow @sergiodxa for new packages, or sponsor the work.