Documentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/cosmic-developer/llms.txt
Use this file to discover all available pages before exploring further.
TeletypeText brings the aesthetic of a command-line terminal to the portfolio’s headings and status labels. Feed it a string and an optional delay, and it will tick through every character one by one at a fixed 50 ms interval — complete with a blinking aurora-teal cursor block that disappears the moment the last character lands. The effect makes static labels feel like live system output.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
text | string | required | The full string to reveal character by character |
delay | number | 0 | Seconds to wait before the typing animation begins |
className | string | "" | Optional extra Tailwind classes applied to the outer <span> |
Usage
TeletypeText renders a plain <span>, so it flows naturally inside any block or inline context. Wrap it in a styled container to control colour, font size, and spacing independently of the component itself.
How It Works
State initialisation
Two pieces of state are initialised:
displayed (an empty string that grows as characters are added) and isDone (a boolean that turns true once every character has been revealed, causing the blinking cursor to disappear).Delay then type
A
useEffect fires when text or delay changes. It sets a setTimeout for delay * 1000 milliseconds. Once the timeout fires, a setInterval starts ticking at 50 ms per character.Blinking cursor
While
isDone is false, a Framer Motion <motion.span> is rendered after the displayed text. It animates opacity between 1 and 0 on a 0.5 s infinite loop, visually identical to a terminal cursor block (w-2 h-[1em] bg-aurora-teal align-middle).Styling
TeletypeText outputs unstyled text inside a <span>. All visual treatment — font family, colour, size, spacing — should be applied on a wrapper element:
| Context | Classes |
|---|---|
| Home hero status | font-mono text-aurora-teal mb-4 tracking-widest uppercase text-sm |
| About page | font-mono text-aurora-magenta mb-2 text-sm |
| Skills page | font-mono text-aurora-green mb-2 text-sm |
| Work / timeline | font-mono text-aurora-violet mb-2 text-sm |
TeletypeText uses font-mono, which resolves to JetBrains Mono as defined in main.css. The typewriter effect pairs naturally with this monospaced font because every character occupies the same horizontal width, so the container does not reflow as new characters appear.