About
Text that types itself out, once or through several phrases, with a blinking caret.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Typewriter to your project and fits it to your theme.
Code
How Typewriter is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
"use client";
import "honestui/theme.css";
import { useState } from "react";
import { Typewriter } from "@/components/ui/honest-typewriter";
const questions = [
{
ask: "Which plan has single sign-on?",
answer: "Single sign-on is part of the Business plan. You can turn it on under Settings, then Security.",
},
{
ask: "How do I export my data?",
answer: "Open Settings, choose Data, and pick CSV or JSON. We email you a link when the file is ready.",
},
];
export default function TypewriterAnswer() {
const [index, setIndex] = useState(0);
const [finished, setFinished] = useState(false);
const { ask, answer } = questions[index];
return (
<div data-theme="light" className="flex w-full max-w-sm flex-col gap-3">
<p className="ml-auto w-fit rounded-2xl bg-muted px-4 py-2.5 text-sm text-foreground">{ask}</p>
<p className="min-h-18 text-sm leading-6 text-foreground">
<Typewriter
key={ask}
text={answer}
typeSpeed={22}
startDelay={500}
startOnView
keepCursor={false}
cursorClassName="bg-blue-500"
onPhraseComplete={() => setFinished(true)}
/>
</p>
<button
type="button"
disabled={!finished}
onClick={() => {
setFinished(false);
setIndex((current) => (current + 1) % questions.length);
}}
className="h-8 w-fit cursor-pointer rounded-lg border border-border px-3 text-[13px] font-medium text-foreground transition-colors outline-none hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-40"
>
Ask another question
</button>
</div>
);
}








