Skip to content

Animate

Motion primitives: animated borders, scroll progress and entrance transitions.

Installation

bun add @xerobi/ui
import { AnimateBorder, AnimateCountUp, AnimateLogoRotate, AnimateLogoZoom, AnimateText, MotionContainer, MotionLazy, MotionViewport, ScrollProgress } from "@xerobi/ui/animate"

This component is client-side. In Astro, hydrate it with a client directive.

API reference

AnimateBorder

PropTypeDescription
durationnumberSeconds for one lap.
slotProps{ primaryBorder?: BorderStyleProps | undefined; secondaryBorder?: BorderStyleProps | undefined; outlineColor?: string | undefined; svgSettings?: { rx?: strin...

AnimateCountUp

PropTypeDescription
to*number
fromnumber
toFixednumber
durationnumber
unit"b" | "k" | "m" | (string & {})
onceboolean
amountnumber | "some" | "all"
render"symbol" | "object" | "style" | "div" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquot...

AnimateLogoRotate

PropTypeDescription
logostring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
slotProps{ logo?: LogoProps | undefined; }

AnimateLogoZoom

PropTypeDescription
logostring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
slotProps{ logo?: LogoProps | undefined; }

AnimateText

PropTypeDescription
variantsVariants
repeatDelayMsnumber
textContent*string | string[]
onceboolean
amountnumber | "some" | "all"
render"symbol" | "object" | "style" | "div" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquot...

MotionContainer

PropTypeDescription
ref((instance: HTMLDivElement | null) => void | (() => VoidOrUndefinedOnly)) | RefObject<HTMLDivElement | null>
animate(boolean | TargetAndTransition | VariantLabels | LegacyAnimationControls) & booleanValues to animate to, variant label(s), or `LegacyAnimationControls`. ```jsx // As values <motion.div animate={{ opacity: 1 }} /> // As variant <motion.div animate="visible" variants={variants} /> // Multiple variants <motion.div animate={["visible", "active"]} variants={variants} /> // LegacyAnimationControls <motion.div animate={animation} /> ```
actionboolean

MotionLazy

PropTypeDescription
children*string | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>

MotionViewport

PropTypeDescription
ref((instance: HTMLDivElement | null) => void | (() => VoidOrUndefinedOnly)) | RefObject<HTMLDivElement | null>
disableAnimateboolean

ScrollProgress

PropTypeDescription
progress*MotionValue<number>From `useScrollProgress()`.
variant*"linear" | "circular"
sizenumber
thicknessnumber
portalboolean
whenScroll"x" | "y"Axis being tracked; matters for right-to-left layouts.
color"info" | "success" | "warning" | "secondary" | "inherit" | "primary" | "error"
classNamestring
wrapperClassNamestring

Hooks

  • useScrollProgress: Scroll progress of the page, or of the element you attach `elementRef` to.

Search documentation

Search pages, components and blocks.