Dynamic Loading Text
Feedback
AI
Loading
Animated loading indicator that cycles through contextual messages based on the current processing stage.
Default Variant
Standard loading indicator with animated dots
Analyzing your request
Compact Variant
Inline loading indicator for tight spaces
Processing data
Detailed Variant
Full loading display with progress bar and time estimate
Analyzing patterns
Stage: analyzing
Progress0%
Est. 30s remaining
Loading Stages
Five built-in stages with contextual messages
Analyzing your request
Processing data
Analyzing patterns
Generating response
Almost ready
Custom Messages
Override default messages with your own
Fetching data from server
Props
Component API reference
| Prop | Type | Default | Description |
|---|---|---|---|
stage | 'thinking' | 'processing' | 'analyzing' | 'generating' | 'finalizing' | 'thinking' | Current loading stage |
customMessages | string[] | — | Custom messages to cycle through (overrides stage messages) |
variant | 'default' | 'compact' | 'detailed' | 'default' | Display variant |
showProgress | boolean | false | Show progress bar (only for detailed variant) |
estimatedTime | number | — | Estimated time in seconds for progress calculation |
className | string | — | Additional CSS classes |
Usage
Import and implementation example
import { DynamicLoadingText } from '@/components/ui/dynamic-loading-text'
export default function Example() { return ( <> {/* Basic loading */} <DynamicLoadingText stage="thinking" />
{/* Compact inline */} <DynamicLoadingText variant="compact" stage="processing" />
{/* Detailed with progress */} <DynamicLoadingText variant="detailed" stage="analyzing" showProgress estimatedTime={30} />
{/* Custom messages */} <DynamicLoadingText customMessages={['Loading models', 'Running inference', 'Formatting output']} /> </> )}Features
Built-in functionality
- Five loading stages: Thinking, processing, analyzing, generating, and finalizing
- Message cycling: Automatically cycles through contextual messages every 2 seconds
- Animated dots: Animated ellipsis dots that update every 500ms
- Progress bar: Optional progress bar with time estimation
- Three variants: Default, compact, and detailed display modes
- Custom messages: Override built-in messages with custom text
- Time tracking: Tracks elapsed time and estimates remaining time
Accessibility
Accessibility considerations
ARIA Attributes
Loading spinner provides visual feedbackText content is readable by screen readersKeyboard Navigation
| Key | Action |
|---|---|
| N/A | Non-interactive loading indicator |
Notes
- Consider adding aria-live="polite" for dynamic message updates
- Progress bar provides visual progress indication
- Stage label in detailed mode gives context about current phase