0.0.1 • Published 1 year ago

vue3-typed-js v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

vue3-typed-js

A Vue3 wrapper for Typed.js library.

Installation

npm install vue3-typed-js

Usage

import { createApp } from 'vue';
import App from './App.vue';
import VueTyped from 'vue3-typed-js';

const app = createApp(App);
app.use(VueTyped);
app.mount('#app');

Example usage inside your Vue component:

<template>
<VueTyped
:strings="typedStrings"
:typeSpeed="50"
:backSpeed="30"
:loop="true"
@onComplete="handleComplete"
></VueTyped>
</template>

<script>
export default {
  data() {
    return {
      typedStrings: ['Hello, ^1000 I am Typed.js', 'And I work with Vue 3!'],
    };
  },
  methods: {
    handleComplete() {
      console.log('Typing is complete');
    },
  },
};
</script>

Props

PropTypeDescription
stringsArrayAn array of strings to type
typeSpeedNumberTyping speed in milliseconds
startDelayNumberTime before typing starts (in milliseconds)
backSpeedNumberBackspacing speed in milliseconds
smartBackspaceBooleanEnable/disable smart backspace
shuffleBooleanEnable/disable shuffling of strings
backDelayNumberTime before backspacing (in milliseconds)
fadeOutBooleanEnable/disable fade out animation
fadeOutClassStringCSS class for fade animation
fadeOutDelayNumberFade out delay in milliseconds
loopBooleanEnable/disable loop
loopCountNumberNumber of loops or Infinity
showCursorBooleanShow/hide the cursor
autoInsertCssBooleanInsert CSS for cursor and fadeOut into HTML
attrStringAttribute for typing
bindInputFocusEventsBooleanBind to focus and blur if el is text input or textarea
contentTypeString'html' or 'null' for plaintext
onCompleteFunctionCallback when typing is complete
preStringTypedFunctionCallback before a string is typed
onStringTypedFunctionCallback when a string is typed
onLastStringBackspacedFunctionCallback when the last string is typed and backspaced
onTypingPausedFunctionCallback when typing is paused
onTypingResumedFunctionCallback when typing is resumed
onResetFunctionCallback when the typed instance is reset
onStopFunctionCallback when the typed instance is stopped
onStartFunctionCallback when the typed instance starts
onDestroyFunctionCallback when the typed instance is destroyed

License

MIT

0.0.1

1 year ago