Skip to content

Commit 486fc88

Browse files
committed
[DOC]: Cover specified properties
1 parent 853e4ef commit 486fc88

File tree

1 file changed

+46
-22
lines changed

1 file changed

+46
-22
lines changed

README.md

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
[![npm](https://img.shields.io/npm/v/vue-typed-js.svg) ![npm](https://img.shields.io/npm/dm/vue-typed-js.svg)](https://www.npmjs.com/package/vue-typed-js)
44
[![vue2](https://img.shields.io/badge/vue-2.x-brightgreen.svg)](https://vuejs.org/)
55

6-
A Vue.js Plugin
6+
A Vue.js integration for Typed.js.
7+
8+
Typed.js is a library that types. Enter in any string, and watch it type at the speed you've set, backspace what it's typed, and begin a new sentence for however many strings you've set.
9+
10+
Checkout the offical project [here](https://github.com/mattboldt/typed.js/).
711

812
## Table of contents
913

@@ -39,18 +43,7 @@ Vue.component('vue-typed-js', VueTypedJs)
3943

4044
**⚠️ A css file is included when importing the package. You may have to setup your bundler to embed the css in your page.**
4145

42-
## Distribution import
43-
44-
Install all the components:
45-
46-
```javascript
47-
import 'vue-typed-js/dist/vue-typed-js.css'
48-
import VueTypedJs from 'vue-typed-js/dist/vue-typed-js.common'
49-
50-
Vue.use(VueTypedJs)
51-
```
52-
53-
## Browser
46+
## Browser import
5447

5548
```html
5649
<link rel="stylesheet" href="vue-typed-js/dist/vue-typed-js.css"/>
@@ -67,20 +60,51 @@ Install all the components:
6760
Vue.use(VueTypedJs)
6861
```
6962

70-
## Source import
71-
72-
Install all the components:
63+
# Usage
64+
To get started simply add the `vue-typed-js` custom element to your `template` and pass the text, which should be typed to the `strings` property. In addition you need to pass an element with the class `typing` to the slot, which will be used as a `wrapper`.
7365

74-
```javascript
75-
import Vue from 'vue'
76-
import VueTypedJs from 'vue-typed-js/src'
66+
Minimal setup:
7767

78-
Vue.use(VueTypedJs)
68+
```html
69+
<vue-typed-js :strings="['First text', 'Second Text']">
70+
<h1 class="typing"></h1>
71+
</vue-typed-js>
7972
```
8073

81-
# Usage
74+
The `typing` class allows you to just animate certain parts of a string:
75+
```html
76+
<vue-typed-js :strings="['John', 'James']">
77+
<h1>Hey <span class="typing"></span></h1>
78+
</vue-typed-js>
79+
```
8280

83-
> TODO
81+
## Properties
82+
You can make use of the following properties in order to customize your typing expirience:
83+
84+
| Property | Type | Description | Usage |
85+
|----------------------|---------|----------------------------------------------------------------------|-----------------------------------------------------------------|
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+
106+
107+
## Events
84108

85109
# Example
86110

0 commit comments

Comments
 (0)