Componentmedia0.56 KB gzipZero dependencies
Typewriter
Types text char-by-char with blinking block cursor, loops through phrases
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add typewriterOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { Typewriter } from "@/components/ui/typewriter" <Typewriter phrases={['Hello world', 'Big Bull UI']} speed={100} loop />Source code
typewriter.tsx + 1 helperZero 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 />| Prop | Type | Description |
|---|---|---|
| phrases | string[] | Array of phrases to type through |
| speed | number | Typing speed in milliseconds per character |
| loop | boolean | Whether to loop through phrases continuously |