Socket
Socket
Sign inDemoInstall

svelte-typewriter

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-typewriter

A simple and reusable typewriter effect for your Svelte applications


Version published
Weekly downloads
4.7K
increased by10.47%
Maintainers
1
Weekly downloads
 
Created
Source

svelte-typewriter

A simple and reusable typewriter effect for your Svelte applications

PRs Welcome

DEMO

Installation

# yarn
yarn add -D svelte-typewriter

# npm
npm install -D svelte-typewriter

Usage

<script>
	import Typewriter from 'svelte-typewriter'
</script>

<Typewriter>
	<h1>Testing the typewriter effect</h1>
	<h2>The typewriter effect cascades by default</h2>
	<p>Lorem ipsum dolor sit amet consectetur</p>
</Typewriter>

Options

You can control the behavior of the typewriter effect by passing specific props to the Typewriter component

interval

The interval in milliseconds between each letter

default: 30

DEMO

Example:
<Typewriter interval={50}>
	<p>Each letter of this paragraph will be displayed with a interval of 50 milliseconds</p>
</Typewriter>

You can also pass a custom array of distinct intervals to mimic human typing

<Typewriter interval={[50, 60, 80]}>
	<p>Each letter of this paragraph will be randomly displayed with an interval of 50 or 60 or 80 milliseconds</p>
</Typewriter>

cascade

Enables the cascading mode, where each element is animated sequentially instead of simultaneously

default: false

DEMO

Example:
<Typewriter cascade>
	<h1>First</h1>
	<h2>Second</h2>
	<h3>Third</h3>
</Typewriter>

loop

Cycles the typewriter animation between the children elements of the <Typewriter> component

Warning: won't work if cascade is enabled

When using the loop prop, the tag name will be determined by the first child of the <Typewriter> component

default: false

Example:
<Typewriter loop>
	<p>This is a draft about the loop typewriter effect</p>
	<p>This is a draft about svelte-typewriter</p>
	<p>This text has nothing to do with the two previous phrases</p>
</Typewriter>

You can also pass a custom time interval between loops in milliseconds (the default interval is 1500 milliseconds)

<Typewriter loop={500}>
	<p>This is a draft about the loop typewriter effect</p>
	<p>This is a draft about svelte-typewriter</p>
	<p>This text has nothing to do with the two previous phrases</p>
</Typewriter>

Keywords

FAQs

Package last updated on 21 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc