A versatile, accessible text animation component with multiple animation modes, full accessibility support, and comprehensive customization options.
Preview
Usage
The Motion Text component provides beautiful text animations with zero configuration required. Simply pass text and let it animate automatically.
Animation Modes
The component supports six different animation modes:
- gradient-in: Characters appear with a colorful gradient highlight reveal
- fade-in: Smooth opacity-based character reveal
- slide-in: Words slide up from below
- gradient-sweep: Static text with an animated gradient sweep (loops automatically)
- shimmer: Static text with an animated shimmer effect (loops automatically)
- none: Instant text display without animation
Speed Control
Use t-shirt sizing (sm, md, lg) to control animation speed:
- sm: Fast animation
- md: Medium animation (default)
- lg: Slow animation
Manual Control
Take full control of the animation lifecycle:
<template>
<div>
<dt-motion-text
ref="textRef"
text="Click to animate"
:auto-start="false"
@complete="onComplete"
/>
<dt-button @click="$refs.textRef.start()">Start</dt-button>
<dt-button @click="$refs.textRef.pause()">Pause</dt-button>
<dt-button @click="$refs.textRef.resume()">Resume</dt-button>
<dt-button @click="$refs.textRef.reset()">Reset</dt-button>
<dt-button @click="$refs.textRef.skipToEnd()">Skip to End</dt-button>
</div>
</template>
<script>
export default {
methods: {
onComplete() {
console.log('Animation completed!');
}
}
}
</script>
Looping Animation
Perfect for attention-grabbing headers or hero sections:
Using Slots
You can also use the default slot instead of the text prop:
Vue API
Slots
Props
Events
Accessibility
The Motion Text component is built with accessibility as a core principle.
Reduced Motion Support
Automatically respects the user's prefers-reduced-motion system setting. When enabled, animations are skipped and text appears instantly.
<dt-motion-text
text="Respects user preferences"
:respects-reduced-motion="true"
/>
Screen Reader Support
Provide alternative text for screen readers:
<dt-motion-text
text="🎉 Congratulations!"
screen-reader-text="Congratulations"
/>
ARIA Attributes
The component automatically includes proper ARIA attributes:
aria-live="polite"during animationaria-labelwhen screen reader text is providedaria-hiddenfor animated content while animating
Best Practices
- Choose the right speed: Use
smfor short text,lgfor longer passages - Don't overuse: Too many animated elements can be distracting
- Consider context: Hero sections work well with
gradient-in, while body text might be better withfade-in - Test with reduced motion: Always ensure your UI works with animations disabled
- Provide screen reader text: If using emojis or special characters, always include alternative text