sdxc

Type to search, or start from one of these:

[ @sdxc/ui/animations ]

scrollProgress

Grows a fill element in lockstep with its scrollable ancestor's scroll position, from the inline-start edge so it reads correctly in both writing directions.

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

Usage

Grows a fill element in lockstep with its scrollable ancestor's scroll position, from the inline-start edge so it reads correctly in both writing directions. Nest it in a fixed-size track; reduced motion ramps opacity.

Signature

scrollProgress(options?: ScrollProgress.Options): CSSMixinDescriptor

Returns a style mixin, applicable through a host element's mix prop.

Parameters

ParameterTypeDescription
options?ScrollProgress.OptionsSelects the scroll axis the indicator tracks.

Examples

mix={scrollProgress({ axis: "inline" })}

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

Interface

ScrollProgress.Options

Options selecting which scroll axis a progress indicator tracks.

MemberTypeDescription
axis?"block" | "inline"Scroll axis the indicator's timeline attaches to: "block" tracks vertical scroll (a reading-progress bar), "inline" horizontal scroll (a Carousel viewport). Defaults to "block".

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