Skip to content
Haze UI

AI text loading

Minimal centered AI thinking status text that cycles phrases with a per-character luminance wave and optional elapsed seconds readout.

pnpm dlx shadcn@latest add @haze/ai-text-loading
Open preview in a new tab
Livesmall script

When to use

  • Displaying a lightweight live thinking phrase while an AI reply is being prepared
  • Replacing raw spinner rings with human-readable status cues that cycle through synthesis stages

When not to use

  • Users need an expandable list of timed tool calls and execution logs; use ai-loading instead
  • A compact inline loading indicator inside a button is needed; use spinner

Installation

Add the Haze registry to components.json once, then install AI text loading with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/ai-text-loading
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
idstring"haze-ai-text-loading"Unique prefix for the section landmark heading ID.
headingstring"Assistant thinking status"Screen-reader landmark heading for the loading status region.
phrasesstring[]4 demo thinking phrasesOrdered status phrases cycled with a per-character token luminance wave.
showElapsedbooleanfalseShows a subtle live elapsed seconds readout beside the cycling phrase.
intervalMsnumber2400Duration in milliseconds before advancing to the next phrase.
classstring–Extra classes applied to the outer section.

Keyboard interactions

Tab
Passes cleanly past the non-interactive status indicator without trapping focus

Accessibility

  • Per-character visual spans carry aria-hidden="true" so assistive technology reads clean whole phrases from the polite role="status" region.
  • Honors prefers-reduced-motion by disabling the character luminance wave and switching cleanly between whole phrases.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI block "AI text loading" with `npx shadcn@latest add @haze/ai-text-loading`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import AiTextLoading from "@/components/haze/blocks/ai-text-loading.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/blocks/ai-text-loading.md

  • Customize with real content

    Adapt the Haze ai-text-loading block for our product. Replace the demo values of these props with our real content: id, heading, phrases, showElapsed, intervalMs, class. Keep the layout, the heading level rules and these accessibility details: Per-character visual spans carry aria-hidden="true" so assistive technology reads clean whole phrases from the polite role="status" region. Honors prefers-reduced-motion by disabling the character luminance wave and switching cleanly between whole phrases. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using ai-text-loading, check it fits: use it when displaying a lightweight live thinking phrase while an ai reply is being prepared; replacing raw spinner rings with human-readable status cues that cycle through synthesis stages. Avoid it when users need an expandable list of timed tool calls and execution logs; use ai-loading instead; a compact inline loading indicator inside a button is needed; use spinner. Alternatives: @haze/text-shimmer, @haze/ai-loading, @haze/spinner.

Dependencies

  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog