1.0.3 • Published 4 years ago

svelte-typed-js v1.0.3

Weekly downloads
23
License
MIT
Repository
github
Last release
4 years ago

npm version License: MIT Language grade: JavaScript

svelte-typed-js

A Svelte.js integration for Typed.js.

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.

Checkout the offical project here.

Demo: https://svelte.dev/repl/823ca24caab143a6896f22fb853a83d0?version=3

Table of contents

Installation

npm install --save svelte-typed-js

Usage

Minimal setup:

import SvelteTypedJs from 'svelte-typed-js'
<SvelteTypedJs strings={['First text', 'Second Text']} loop=true>
	<h2 class="typing"></h2>
</SvelteTypedJs>

The typing class also allows you to just animate certain parts of a string:

<SvelteTypedJs :strings="['Melih', 'Altintas']">
  <h1>Hey <span class="typing"></span></h1>
</SvelteTypedJs>

Properties

You can make use of the following properties in order to customize your typing expirience:

PropertyTypeDescription
stringsArraystrings to be typed
stringsElementStringID of element containing string children
typeSpeedNumbertype speed in milliseconds
startDelayNumbertime before typing starts in milliseconds
backSpeedNumberbackspacing speed in milliseconds
smartBackspaceBooleanonly backspace what doesn't match the previous string
shuffleBooleanshuffle the strings
backDelayNumbertime before backspacing in milliseconds
fadeOutBooleanFade out instead of backspace
fadeOutClassStringcss class for fade animation
fadeOutDelayNumberfade out delay in milliseconds
loopBooleanloop strings
loopCountNumberamount of loops
showCursorBooleanshow cursor
cursorCharStringcharacter for cursor
autoInsertCssBooleaninsert CSS for cursor and fadeOut into HTML
attrStringattribute for typing Ex: input placeholder, value, or just HTML text
bindInputFocusEventsBooleanbind to focus and blur if el is text input
contentTypeString'html' or 'null' for plaintext

License

MIT

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago