vael-ui v0.5.7

Data display

Layout

AnimatedText

Text that swaps to the next with a short fade and lift, while its width eases so nothing beside it jumps. Use it for labels and statuses that change in place.

Install

import { AnimatedText } from 'vael-ui'

Playground

Saved
Usage
<script setup lang="ts">
import { AnimatedText } from 'vael-ui'
</script>

<template>
  <AnimatedText value="Saved" />
</template>

Props

NameTypeDefaultDescription
valueRequiredstringThe text to show. Changing it crossfades to the new text.
motionAnimatedTextMotiontrueHow it moves: its appearance ({ initial: { root: { opacity: 0, y: 4 } } }). false swaps the text at once. Unset, it follows the nearest ConfigProvider.
split'words' | 'letters'A new value comes in a word or a letter at a time, each after the one before. Screen readers still read it whole. Animate the pieces yourself with motion: { initial: { piece: … } }.
uiPartial<Record<'root', UiPartValue>>Class and style overrides for each part.

Events

No events.

Slots

No slots.

Exposed

NameTypeDescription
elHTMLElement | nullRoot element.
partsRecord<string, HTMLElement | HTMLElement[] | null>Its elements by part name, for your own animation; a repeated part is an array.

Motion New

AnimatedText: its appearance and the swap's timing.

<AnimatedText
  :motion="{ initial: { root: { opacity: 0, y: 4 } } }"
/>
NameTypeDescription
initialexitrootpieceSets where each part comes in from and leaves to: any CSS property, plus x, y and blur. A plain number is px, or degrees for rotate.
enterleave(parts, context) => animationAnimates the parts with GSAP, motion or element.animate(). Return the animation and the component waits for it, and stops it if interrupted.
springdurationeasing{ damping, response } | number | stringTimes all of it: a spring, or a duration in ms with an easing. Never both.
falsebooleanTurns its motion off, for an animation of your own on its exposed elements.

Accessibility

It has no keyboard interaction of its own.

  • The value is plain text in a <span> with no role and no live region, so changes are not announced.
  • During a swap, the old text stays in the DOM until its leave transition ends, but it is aria-hidden, so screen readers find only the new text.