shadcn.io is not affiliated with official shadcn/ui
Typing Animation Hero Block for React
A compact hero whose descriptive sentence types itself out once, behind a caret, in a framed box under a static headline, with a Shine Button, a second action and a ruled list of plan facts.
Installation
Overview
Let your message unfold one character at a time. Under an announcement pill and a static two-line headline, a sentence that describes a workflow types itself out once, in a box framed by hairlines with + marks on its corners, behind a caret that goes away when the sentence is done. A Shine Button and an outline button follow, and on wide screens a list of three plan facts, ruled at the top and between its rows, stands at the end beside the box. The whole sentence holds its place from the start, so nothing under it moves while it types. It's built from Typing Text, Announcement, Status, Shine Button, Button and Guides, with Lucide icons, Tailwind CSS and a CSS entrance that stays still under reduced motion. Made for developer tools, AI products and startup homepages, where a short sentence revealed on arrival draws the eye to the one thing you want to say.
FAQ
How do I change the sentence that types out?
Edit SENTENCE at the top of the file: the typed text and the invisible copy that holds its room both read it. One or two sentences work best; at 32 ms a character, a 100-character sentence takes about three seconds, and a long paragraph would keep visitors waiting. To type faster or slower, change speed, and delay for the wait before the first character (600 ms, so the headline lands first).
Why doesn't the content below move while the sentence types?
The paragraph is a one-cell grid holding two copies of the sentence: the whole one, invisible, and the typed one on top of it. The invisible copy sets the paragraph's height from the first frame, whatever the screen width and however many lines the sentence wraps to, so the buttons never jump down as lines fill in. A fixed height would clip the sentence on a phone, where it wraps to four or five lines.
What do screen readers hear?
The whole sentence, once, as soon as the page loads: TypingText keeps the full text in a visually hidden span and hides the typed letters and the caret from assistive technology, and the invisible copy is hidden too. So a screen reader never reads a half-typed sentence, nor the sentence twice. The headline is the page's one h1.
Why does the caret disappear at the end?
A caret that blinks forever is motion that never stops, which WCAG 2.2.2 asks to avoid, and it suggests that more text is coming. When the last character is typed, TypingText calls onComplete, which sets typed, and the caret switches to cursor="none", which keeps the line's height but draws nothing.
Where do the buttons link to?
Both are links to #: point them at your sign-up and your templates.
On Base UI, each button renders its link with render={<a href="/signup" />} and nativeButton={false}.
What happens with reduced motion or without JavaScript?
With reduced motion, the sentence appears whole at once, and the caret stands still until it's removed. Without JavaScript, the sentence shows whole too.
When should I use a typing sentence instead of a typewriter headline?
Use a typing sentence to reveal one sentence once, building a moment of anticipation under a fixed headline; here it also shows what a visitor would say to the product. Use a typewriter headline when you have several short benefits that finish the same sentence and want to cycle through them. Both keep the text readable to screen readers in full.
Related
- Pro
Typewriter Hero
Type and motionA compact centered hero whose headline types four words in turn behind a caret, with a Shine Button, a second action and a closing band with an avatar row and a pause button.
- Pro
Centered Minimal Hero
Type and motionA compact centered type-only hero: a two-line headline with a muted second line, one sentence, a Shine Button and a second action, on faded rails.
- Pro
Centered Gradient Text Hero
Type and motionA start-aligned statement hero whose headline ends on two words that fade from the text color toward the page, with a Shine Button, an outline button and a ruled band of three proof cells.
- Pro
Concentric Rings Hero
BackdropsA compact, centred hero for a design tool on solid rails: concentric rings breathe behind a headline, a Shine Button and an outline button, over a ruled band of three stats.
- Pro
Centered Shimmer Text Headline Hero
Type and motionA compact centered hero whose second headline line glints as a light runs through it, with a launch pill, the Shine Button and four stats in cells below.
- Pro
Reverse Split News List Hero
Updates and timelinesA reverse split hero on drafting lines for a team docs workspace: a greyscale product illustration beside an announcement pill, the headline, a ruled list of the latest updates as links, a Shine Button and a second action.