Componentmedia0.56 KB gzipZero dependencies

Typewriter

Types text char-by-char with blinking block cursor, loops through phrases

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add typewriter

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { Typewriter } from "@/components/ui/typewriter" <Typewriter phrases={['Hello world', 'Big Bull UI']} speed={100} loop />

Source code

typewriter.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxtypewriter.tsx67 lines
"use client";import * as React from "react";import { cn } from "./lib/utils"; export type TypewriterProps = {  phrases: string[];  speed?: number;  loop?: boolean;}; const Typewriter = ({ phrases = [], speed = 100, loop = true }: TypewriterProps) => {  const [phraseIndex, setPhraseIndex] = React.useState(0);  const [charIndex, setCharIndex] = React.useState(0);  const currentPhrase = phrases[phraseIndex] ?? "";  const isTyping = charIndex < currentPhrase.length;   React.useEffect(() => {    if (phrases.length === 0) return;

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { Typewriter } from "@/components/ui/typewriter"; <Typewriter />
PropTypeDescription
phrasesstring[]Array of phrases to type through
speednumberTyping speed in milliseconds per character
loopbooleanWhether to loop through phrases continuously