Typewriter
Types out its text one character at a time, with a blinking cursor.
<arc-typewriter>Overview
Typewriter reveals its text one character at a time. A setTimeout chain drives it.
speed is milliseconds per character (50 by default, about 20 characters a second), and delay holds the start so several typewriters can run in sequence. With loop, the text clears after pause-end (2 seconds by default) and types again, for rotating taglines.
replay() restarts the animation from the beginning. Use it for a "watch again" control, or to run a one-shot reveal again after the content around it changes. Called mid-type, it cancels the pending step first, so two sequences never run at once.
A blinking | cursor in --accent-primary is on by default, and no-cursor turns it off. Once typing finishes, the cursor fades out after about 3 seconds, or keeps blinking with loop. Under prefers-reduced-motion the full text shows at once.
Guidelines
Do
- Use it in hero sections and on landing pages
- Set `speed` between 30 and 80ms for typing that looks natural
- Use `delay` to run several typewriters one after another
- Put the important text in a static heading as well. A screen reader that reaches the typewriter mid-animation reads only what's typed so far
Don't
- Don't use it for text readers need to read right away. The animation holds it back
- Don't run more than two or three typewriters at once
- Don't set `speed` below 20ms. It reads as a flash, not typing
- Don't loop long paragraphs
Features
- Fires `arc-complete` when typing finishes
- Inherits its font from the parent
Preview
Usage
Typewriter is in the marketing group, so the default @arclux/arc-ui entry point doesn't include it. Import it from@arclux/arc-ui/marketing or from its own subpath,@arclux/arc-ui/typewriter.
This component needs JavaScript. Use the Web Component or a framework wrapper.
<!-- Simple typewriter -->
<arc-typewriter text="Welcome to the future of UI." speed="60" cursor></arc-typewriter>
<!-- With delay and loop -->
<arc-typewriter
text="Build faster. Ship sooner."
speed="40"
delay="500"
loop
pause-end="3000"
></arc-typewriter>
<!-- No cursor -->
<arc-typewriter text="Clean and simple." cursor="false"></arc-typewriter>import { Typewriter } from '@arclux/arc-ui-react';
function Hero() {
return (
<div>
<h1>
<Typewriter
text="Welcome to the future of UI."
speed={60}
cursor
onArcComplete={() => console.log('done')}
/>
</h1>
<Typewriter
text="Build faster. Ship sooner."
speed={40}
delay={1800}
loop
pauseEnd={3000}
/>
</div>
);
}<script setup>
import { Typewriter } from '@arclux/arc-ui-vue';
function onComplete() {
console.log('Typing finished');
}
</script>
<template>
<h1>
<Typewriter
text="Welcome to the future of UI."
:speed="60"
cursor
@arc-complete="onComplete"
/>
</h1>
</template><script>
import { Typewriter } from '@arclux/arc-ui-svelte';
</script>
<h1>
<Typewriter
text="Welcome to the future of UI."
speed={60}
cursor
on:arc-complete={() => console.log('done')}
/>
</h1>import { Component } from '@angular/core';
import { Typewriter } from '@arclux/arc-ui-angular';
@Component({
imports: [Typewriter],
template: `
<h1>
<arc-typewriter
text="Welcome to the future of UI."
[speed]="60"
cursor
(arcComplete)="onComplete()"
/>
</h1>
`,
})
export class HeroComponent {
onComplete() {
console.log('Typing finished');
}
}import { Typewriter } from '@arclux/arc-ui-solid';
function Hero() {
return (
<h1>
<Typewriter
text="Welcome to the future of UI."
speed={60}
cursor
/>
</h1>
);
}import { Typewriter } from '@arclux/arc-ui-preact';
function Hero() {
return (
<h1>
<Typewriter
text="Welcome to the future of UI."
speed={60}
cursor
/>
</h1>
);
}API
textstring''- The text to type out character by character
speednumber50- Milliseconds per character
delaynumber0- Initial delay in milliseconds before typing starts
pause-endnumber2000- Milliseconds to pause at the end before looping
cursorbooleantrue- Show a blinking cursor during and after typing
loopbooleanfalse- Loop the animation indefinitely
nowrapbooleanfalse
Methods
replay()- Restart the typing animation from the beginning.
Events
arc-complete- Fired when the typing animation finishes revealing all characters