"It is literally the easiest JS plugin I've ever used." - Brian
- ~5kb gzipped
- zero dependencies
- highly-flexible API
- SEO-friendly
Choose a License
To use TypeIt for a single or multiple commercial projects, purchase a license right here. You'll receive an email with all the information you need, and in just minutes, you'll be all set to start using it in your project. Using it for a personal or open source project is 100% free.
$19
Commercial License
Use TypeIt for a single commercial project. Includes lifetime updates.
Buy a Limited License$49
Unlimited Commercial License
Use TypeIt for an unlimited number of commercial projects. Includes lifetime updates.
Buy an Unlimited LicenseEasy Installation Steps
Once you have a your license, you're ready to install TypeIt in your website or application!
#1 Load TypeIt on Your Page
Available from Github, npm, or CDN.
<!-- Load the script on the page. -->
<script src="https://cdn.jsdelivr.net/npm/typeit@VERSION_NUMBER/dist/typeit.min.js" />
//-- Or, import as JS module.
import TypeIt from 'typeit';
#2 Initialize TypeIt
Pass an element(s) and options into a new TypeIt instance.
const instance = new TypeIt('#element', {
strings: ['This is my string!'],
//-- Other options...
}).go();
Simple Usage
Just pass an element(s) and options into a new TypeIt instance, and you're ready to create typewriter effects like this.
Type a simple, single string.
Rerun<p id="simpleUsage"></p>
new TypeIt('#simpleUsage', {
strings: 'This is a simple string.',
speed: 50,
waitUntilVisible: true
}).go();
Type multiple strings that replace each other.
Rerun<p id="replaceStrings"></p>
new TypeIt('#replaceStrings', {
strings: ["This is a great string.", "But here is a better one."],
speed: 50,
breakLines: false,
waitUntilVisible: true
}).go();
Type multiple strings that break to new lines.
Rerun<p id="breakLines"></p>
new TypeIt('#breakLines', {
strings: ["This is a great string.", "And here we have another great string.."],
speed: 50,
waitUntilVisible: true
}).go();
Type into form inputs and textareas.
Rerun<fieldset>
<label for="formElement">Full Name</label>
<input type="text" id="formElement">
</fieldset>
new TypeIt('#formElement', {
strings: "Alex MacArthur",
waitUntilVisible: true
}).go();
Advanced Usage
If you want to control every character of your strings, a series of companion functions are built right into TypeIt. You'll be able to do things like partially delete strings, change speed on the fly, break lines whenever you like, and more.
Don't just type a few strings. Create an entire, dynamic narrative.
Rerun<p id="companionMethods"></p>
new TypeIt('#companionMethods', {
speed: 50,
waitUntilVisible: true
})
.type('Wll')
.pause(500)
.delete(2)
.type('ell, ')
.pause(1000)
.type('I guess I\'m typing..')
.break()
.pause(750)
.type(' but I don\'t really know what to say')
.options({speed: 700})
.type('...')
.pause(750)
.options({speed: 50})
.delete()
.type('IS THAT SO <strong>WRONG??</strong>')
.go();
Pause and resume an instance after it's been created.
Rerun<p id="pauseResume"></p>
const instance = new TypeIt('#pauseResume', {
strings: ["After two seconds, this string will be paused for three seconds, and then resume."],
waitUntilVisible: true
}).go();
setTimeout(() => {
instance.freeze();
setTimeout(() => {
instance.unfreeze();
}, 3000);
}, 2000);
Fire a callback function before/after each character, string, or after the entire instance completes.
Rerun<p id="callback"></p>
const element = document.getElementById('callback');
const instance = new TypeIt(element, {
strings: ["Look, it's rainbow text!"],
afterStep: function (step, queue, instance) {
element.style.color = getRandomColor();
}
}).go();
Insert asyncronous code anywhere inside your queue.
Rerun<p id="asyncExec"></p>
new TypeIt('#asyncExec', {
waitUntilVisible: true
})
.type('Hold up!')
.exec(async () => {
//-- Return a promise that resolves after something happens.
await new Promise((resolve, reject) => {
setTimeout(() => {
return resolve();
}, 2000)
});
})
.type(' OK, now go.')
.go();
Like it? Star the project on Github! Hate it with a burning, insatiable passion? Let me know!