Skip to content

Commit 2f1a8cb

Browse files
committed
[DOC]: Cover custom Events
1 parent 486fc88 commit 2f1a8cb

File tree

1 file changed

+54
-23
lines changed

1 file changed

+54
-23
lines changed

README.md

Lines changed: 54 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Minimal setup:
7171
</vue-typed-js>
7272
```
7373

74-
The `typing` class allows you to just animate certain parts of a string:
74+
The `typing` class also allows you to just animate certain parts of a string:
7575
```html
7676
<vue-typed-js :strings="['John', 'James']">
7777
<h1>Hey <span class="typing"></span></h1>
@@ -83,32 +83,63 @@ You can make use of the following properties in order to customize your typing e
8383

8484
| Property | Type | Description | Usage |
8585
|----------------------|---------|----------------------------------------------------------------------|-----------------------------------------------------------------|
86-
| strings | Array | strings to be typed | `<vue-typed-js :strings="['Text 1', 'Text 2']"></vue-typed-js>` |
87-
| stringsElement | String | ID of element containing string children | `<vue-typed-js :stringsElement="'myId'"></vue-typed-js>` |
88-
| typeSpeed | Number | type speed in milliseconds | `<vue-typed-js :typeSpeed="50"></vue-typed-js>` |
89-
| startDelay | Number | time before typing starts in milliseconds | `<vue-typed-js :startDelay="1000"></vue-typed-js>` |
90-
| backSpeed | Number | backspacing speed in milliseconds | `<vue-typed-js :backSpeed="10"></vue-typed-js>` |
91-
| smartBackspace | Boolean | only backspace what doesn't match the previous string | `<vue-typed-js :smartBackspace="true"></vue-typed-js>` |
92-
| shuffle | Boolean | shuffle the strings | `<vue-typed-js :shuffle="true"></vue-typed-js>` |
93-
| backDelay | Number | time before backspacing in milliseconds | `<vue-typed-js :backDelay="100"></vue-typed-js>` |
94-
| fadeOut | Boolean | Fade out instead of backspace | `<vue-typed-js :fadeOut="true"></vue-typed-js>` |
95-
| fadeOutClass | String | css class for fade animation | `<vue-typed-js :fadeOutClass="'fadeOutClass'"></vue-typed-js>` |
96-
| fadeOutDelay | Boolean | fade out delay in milliseconds | `<vue-typed-js :fadeOutDelay="true"></vue-typed-js>` |
97-
| loop | Boolean | loop strings | `<vue-typed-js :loop="true"></vue-typed-js>` |
98-
| loopCount | Number | amount of loops | `<vue-typed-js :loopCount="3"></vue-typed-js>` |
99-
| showCursor | Boolean | show cursor | `<vue-typed-js :showCursor="true"></vue-typed-js>` |
100-
| cursorChar | String | character for cursor | `<vue-typed-js :cursorChar="'_'"></vue-typed-js>` |
101-
| autoInsertCss | Boolean | insert CSS for cursor and fadeOut into HTML | `<vue-typed-js :autoInsertCss="true"></vue-typed-js>` |
102-
| attr | String | attribute for typing Ex: input placeholder, value, or just HTML text | `<vue-typed-js :attr="'placeholder'"></vue-typed-js>` |
103-
| bindInputFocusEvents | Boolean | bind to focus and blur if el is text input | `<vue-typed-js :bindInputFocusEvents="true"></vue-typed-js>` |
104-
| contentType | String | 'html' or 'null' for plaintext | `<vue-typed-js :contentType="'html'"></vue-typed-js>` |
105-
86+
| strings | Array | strings to be typed | `:strings="['Text 1', 'Text 2']"` |
87+
| stringsElement | String | ID of element containing string children | `:stringsElement="'myId'"` |
88+
| typeSpeed | Number | type speed in milliseconds | `:typeSpeed="50"` |
89+
| startDelay | Number | time before typing starts in milliseconds | `:startDelay="1000"` |
90+
| backSpeed | Number | backspacing speed in milliseconds | `:backSpeed="10"` |
91+
| smartBackspace | Boolean | only backspace what doesn't match the previous string | `:smartBackspace="true"` |
92+
| shuffle | Boolean | shuffle the strings | `:shuffle="true"` |
93+
| backDelay | Number | time before backspacing in milliseconds | `:backDelay="100"` |
94+
| fadeOut | Boolean | Fade out instead of backspace | `:fadeOut="true"` |
95+
| fadeOutClass | String | css class for fade animation | `:fadeOutClass="'fadeOutClass'"` |
96+
| fadeOutDelay | Boolean | fade out delay in milliseconds | `:fadeOutDelay="true"` |
97+
| loop | Boolean | loop strings | `:loop="true"` |
98+
| loopCount | Number | amount of loops | `:loopCount="3"` |
99+
| showCursor | Boolean | show cursor | `:showCursor="true"` |
100+
| cursorChar | String | character for cursor | `:cursorChar="'_'"` |
101+
| autoInsertCss | Boolean | insert CSS for cursor and fadeOut into HTML | `:autoInsertCss="true"` |
102+
| attr | String | attribute for typing Ex: input placeholder, value, or just HTML text | `:attr="'placeholder'"` |
103+
| bindInputFocusEvents | Boolean | bind to focus and blur if el is text input | `:bindInputFocusEvents="true"` |
104+
| contentType | String | 'html' or 'null' for plaintext | `:contentType="'html'"` |
106105

107106
## Events
107+
You can listen to the following events:
108+
109+
| Event | Description | Usage |
110+
|------------------------|----------------------------------------------------------------------|-----------------------------------------------------------------|
111+
| onComplete | All typing is complete | `@onComplete="doSmth()"` |
112+
| preStringTyped | Before each string is typed | `@preStringTyped="doSmth()"` |
113+
| onStringTyped | After each string is typed | `@onStringTyped="doSmth()"` |
114+
| onLastStringBackspaced | During looping, after last string is typed | `@onLastStringBackspaced="doSmth()"` |
115+
| onTypingPaused | Typing has been stopped | `@onTypingPaused="doSmth()"` |
116+
| onTypingResumed | Typing has been started after being stopped | `@onTypingResumed="doSmth()"` |
117+
| onReset | After reset | `@onReset="doSmth()"` |
118+
| onStop | After stop | `@onStop="doSmth()"` |
119+
| onStart | After start | `@onStart="doSmth()"` |
120+
| onDestroy | After destroy | `@onDestroy="doSmth()"` |
121+
## Features
122+
Checkout features like `type pausing`, `smart backspacing` etc. on the libraries [page](https://github.com/mattboldt/typed.js/).
123+
124+
# Examples
125+
Here are several examples:
108126

109-
# Example
127+
```html
128+
<!-- infinite loop -->
129+
<vue-typed-js :strings="['awesome', 'brilliant']" :loop="true" @onComplete="doSmth()">
130+
<h2>We are a <span class="typing"></span> company!</h2>
131+
</vue-typed-js>
110132

111-
> TODO
133+
<!-- type pausing -->
134+
<vue-typed-js :strings="['This is text ^1000 which gets paused for 1 second', 'wow, interesting']">
135+
<h2 class="typing"></h2>
136+
</vue-typed-js>
137+
138+
<!-- output html -->
139+
<vue-typed-js :strings="['<p>Paragraph</p>', '<span>Span</span>']" :contentType="'html'">
140+
<h2 class="typing"></h2>
141+
</vue-typed-js>
142+
```
112143

113144
---
114145

0 commit comments

Comments
 (0)