1- import { Canvas , Story , Subtitle , Controls , Meta } from ' @storybook/addon-docs/blocks' ;
2-
3- import * as MotionTextStories from ' ./motion_text.stories' ;
4-
5- <Meta of = { MotionTextStories } />
6-
7- # Motion Text
8-
9- <Subtitle >
10- A versatile, accessible text animation component with multiple animation modes,
11- full accessibility support, and comprehensive customization options.
12- </Subtitle >
1+ ---
2+ title : Motion Text
3+ description : A versatile, accessible text animation component with multiple animation modes, full accessibility support, and comprehensive customization options.
4+ status : ready
5+ thumb : true
6+ storybook : https://dialtone.dialpad.com/vue/?path=/story/components-motion-text--default
7+ ---
8+
9+ <code-well-header class =" d-d-block " >
10+ <dt-stack direction =" row " align =" center " class =" d-hmn128 d-p24 " >
11+ <dt-motion-text
12+ ref="example-motion-text"
13+ text="Welcome to Dialtone Motion Text"
14+ animation-mode="gradient-in"
15+ speed="md"
16+ :auto-start="true"
17+ class="d-headline--lg"
18+ />
19+ </dt-stack >
20+ </code-well-header >
1321
14- ## Default
22+ <code-example-tabs
23+ vueCode='
24+ <dt-motion-text
25+ text="Welcome to Dialtone Motion Text"
26+ animation-mode="gradient-in"
27+ speed="md"
28+ class="d-headline--lg"
29+ />
30+ '
31+ />
1532
16- The Motion Text component provides beautiful text animations with zero configuration required.
33+ ## Usage
1734
18- < Canvas of = { MotionTextStories . Default } />
35+ The Motion Text component provides beautiful text animations with zero configuration required. Simply pass text and let it animate automatically.
1936
20- ## Animation Modes
37+ ### Animation Modes
2138
22- The component supports six different animation modes, each with its own unique visual style :
39+ The component supports six different animation modes:
2340
2441- ** gradient-in** : Characters appear with a colorful gradient highlight reveal
2542- ** fade-in** : Smooth opacity-based character reveal
@@ -28,64 +45,66 @@ The component supports six different animation modes, each with its own unique v
2845- ** shimmer** : Static text with an animated shimmer effect (loops automatically)
2946- ** none** : Instant text display without animation
3047
31- <Canvas of = { MotionTextStories .Modes } />
48+ <code-well-header class =" d-d-block " >
49+ <dt-stack gap =" 400 " class =" d-p24 " >
50+ <dt-motion-text
51+ text="Gradient In Animation"
52+ animation-mode="gradient-in"
53+ speed="md"
54+ :auto-start="true"
55+ class="d-headline--md"
56+ />
57+ </dt-stack >
58+ </code-well-header >
3259
33- ## Variants
60+ <code-example-tabs
61+ vueCode='
62+ <dt-motion-text
63+ text="Gradient In Animation"
64+ animation-mode="gradient-in"
65+ speed="md"
66+ />
67+ '
68+ />
3469
3570### Speed Control
3671
3772Use t-shirt sizing (sm, md, lg) to control animation speed:
3873
39- ### Text Sizes
40-
41- Works seamlessly with any Dialtone text class:
42-
43- ### Looping & Manual Controls
44-
45- Full programmatic control over animation playback:
46-
47- <Canvas of = { MotionTextStories .Variants } />
48-
49- ## Slots, Props & Events
50-
51- <Controls />
52-
53- ## Usage
54-
55- ### Import
56-
57- ``` jsx
58- import { DtRecipeMotionText } from ' @dialpad/dialtone-vue' ;
59- ```
60-
61- ### Basic Usage
74+ - ** sm** : Fast animation
75+ - ** md** : Medium animation (default)
76+ - ** lg** : Slow animation
6277
63- The simplest form - just pass text and let it animate automatically:
64-
65- ``` html
66- < dt-recipe-motion-text text =" Hello world! " />
67- ```
68-
69- ### With Animation Mode
78+ <code-example-tabs
79+ vueCode='
80+ <dt-motion-text
81+ text="Fast animation"
82+ animation-mode="fade-in"
83+ speed="sm"
84+ />
7085
71- Choose from multiple animation styles:
86+ <dt-motion-text
87+ text="Medium animation"
88+ animation-mode="fade-in"
89+ speed="md"
90+ />
7291
73- ``` html
74- <dt-recipe-motion-text
75- text =" Animated text"
76- animation-mode =" gradient-in"
92+ <dt-motion-text
93+ text="Slow animation"
94+ animation-mode="fade-in"
7795 speed="lg"
7896/>
79- ```
97+ '
98+ />
8099
81100### Manual Control
82101
83102Take full control of the animation lifecycle:
84103
85- ``` html
104+ ``` vue
86105<template>
87106 <div>
88- <dt-recipe- motion-text
107+ <dt-motion-text
89108 ref="textRef"
90109 text="Click to animate"
91110 :auto-start="false"
@@ -94,7 +113,9 @@ Take full control of the animation lifecycle:
94113
95114 <dt-button @click="$refs.textRef.start()">Start</dt-button>
96115 <dt-button @click="$refs.textRef.pause()">Pause</dt-button>
116+ <dt-button @click="$refs.textRef.resume()">Resume</dt-button>
97117 <dt-button @click="$refs.textRef.reset()">Reset</dt-button>
118+ <dt-button @click="$refs.textRef.skipToEnd()">Skip to End</dt-button>
98119 </div>
99120</template>
100121
@@ -113,35 +134,44 @@ export default {
113134
114135Perfect for attention-grabbing headers or hero sections:
115136
116- ``` html
117- <dt-recipe-motion-text
137+ <code-example-tabs
138+ vueCode='
139+ <dt-motion-text
118140 text="Continuous animation"
141+ animation-mode="slide-in"
119142 : loop ="true"
120143 speed="sm"
121144/>
122- ```
145+ '
146+ />
123147
124148### Using Slots
125149
126150You can also use the default slot instead of the text prop:
127151
128- ``` html
129- <dt-recipe-motion-text animation-mode =" fade-in" >
152+ <code-example-tabs
153+ vueCode='
154+ <dt-motion-text animation-mode =" fade-in " >
130155 <span >Animated </span >
131156 <strong >text</strong >
132- </dt-recipe-motion-text >
133- ```
157+ </dt-motion-text >
158+ '
159+ />
160+
161+ ## Vue API
162+
163+ <component-vue-api component-name =" motiontext " />
134164
135165## Accessibility
136166
137- The Motion Text component is built with accessibility as a core principle:
167+ The Motion Text component is built with accessibility as a core principle.
138168
139169### Reduced Motion Support
140170
141171Automatically respects the user's ` prefers-reduced-motion ` system setting. When enabled, animations are skipped and text appears instantly.
142172
143- ``` html
144- <dt-recipe- motion-text
173+ ``` vue
174+ <dt-motion-text
145175 text="Respects user preferences"
146176 :respects-reduced-motion="true"
147177/>
@@ -151,8 +181,8 @@ Automatically respects the user's `prefers-reduced-motion` system setting. When
151181
152182Provide alternative text for screen readers:
153183
154- ``` html
155- <dt-recipe- motion-text
184+ ``` vue
185+ <dt-motion-text
156186 text="🎉 Congratulations!"
157187 screen-reader-text="Congratulations"
158188/>
@@ -166,31 +196,7 @@ The component automatically includes proper ARIA attributes:
166196- ` aria-label ` when screen reader text is provided
167197- ` aria-hidden ` for animated content while animating
168198
169- ## Animation Modes Explained
170-
171- ### Character-by-Character Modes
172-
173- These modes reveal text character by character:
174-
175- - ** gradient-in** : Best for hero sections and important messages. Creates a premium feel with the brand gradient.
176- - ** fade-in** : Subtle and professional. Great for body text and descriptions.
177- - ** slide-in** : Dynamic and engaging. Perfect for announcements and CTAs.
178-
179- ### Static Animation Modes
180-
181- These modes keep text visible but add motion effects:
182-
183- - ** gradient-sweep** : Continuous animated gradient. Ideal for loading states or "magic" moments.
184- - ** shimmer** : Subtle pulsing effect. Works well for skeleton loaders or placeholders.
185-
186- ## Performance Notes
187-
188- - The component uses CSS animations and transitions for optimal performance
189- - Text is split into words and characters only when necessary (not for static modes)
190- - Animations are automatically cleaned up on component unmount
191- - Reduced motion support ensures accessibility without performance cost
192-
193- ## Tips & Best Practices
199+ ## Best Practices
194200
1952011 . ** Choose the right speed** : Use ` sm ` for short text, ` lg ` for longer passages
1962022 . ** Don't overuse** : Too many animated elements can be distracting
0 commit comments