Loading Component
Loading Examples
All Animations
spinnerdotsringballbarsinfinity<Loading animation="spinner" /><Loading animation="dots" /><Loading animation="ring" /><Loading animation="ball" /><Loading animation="bars" /><Loading animation="infinity" />All Sizes
spinner
xssmmdlgxldots
xssmmdlgxlring
xssmmdlgxlball
xssmmdlgxlbars
xssmmdlgxlinfinity
xssmmdlgxl<Loading animation="spinner" size="xs" /><Loading animation="spinner" size="sm" /><Loading animation="spinner" size="md" /><Loading animation="spinner" size="lg" /><Loading animation="spinner" size="xl" />All Colors
spinner
primarysecondaryaccentneutralinfosuccesswarningerrordots
primarysecondaryaccentneutralinfosuccesswarningerrorring
primarysecondaryaccentneutralinfosuccesswarningerrorball
primarysecondaryaccentneutralinfosuccesswarningerrorbars
primarysecondaryaccentneutralinfosuccesswarningerrorinfinity
primarysecondaryaccentneutralinfosuccesswarningerror<Loading animation="spinner" color="primary" /><Loading animation="spinner" color="secondary" /><Loading animation="spinner" color="success" /><Loading animation="spinner" color="error" />Combinations
xs + primarysm + secondarymd + accentlg + infoxl + successlg + warning<Loading animation="spinner" size="xs" color="primary" /><Loading animation="dots" size="lg" color="success" />Real-World Use Cases
1. In Buttons
<button className="btn btn-primary"> <Loading animation="spinner" size="sm" color="primary-content" /> Loading...</button>2. Centered in Card
Loading content...
Please wait a moment
<div className="card-body"> <div className="flex flex-col items-center gap-4"> <Loading animation="spinner" size="xl" color="primary" /> <p>Loading content...</p> </div></div>3. Inline with Text
Fetching data from server...
Upload in progress...
Processing payment...
<div className="flex items-center gap-2"> <Loading animation="spinner" size="sm" color="info" /> <span>Fetching data...</span></div>4. Full Page Overlay
Loading application...
This won't take long
Page Content
Lorem ipsum dolor sit amet...
<div className="relative"> <div className="absolute inset-0 bg-base-100/90 backdrop-blur-sm"> <Loading animation="infinity" size="xl" color="primary" /> <p>Loading application...</p> </div></div>5. In Alerts
Syncing your data...
Processing your request...
Upload in progress...
<div className="alert alert-info"> <Loading animation="spinner" color="info-content" size="sm" /> <span>Syncing your data...</span></div>6. Table Loading
| Name | Status | Actions |
|---|---|---|
Loading data... | ||
<tbody> <tr> <td colSpan="3" className="text-center"> <Loading animation="bars" size="lg" color="primary" /> <span>Loading data...</span> </td> </tr></tbody>7. With Badge
ProcessingSyncingUploading
<Badge color="primary" className="gap-2"> <Loading animation="spinner" size="xs" color="primary-content" /> <span>Processing</span></Badge>Props Reference
| Prop | Type | Default | Description |
|---|---|---|---|
animation | string | 'spinner' | Animation type: spinner, dots, ring, ball, bars, infinity |
size | string | 'md' | Size: xs, sm, md, lg, xl |
color | string | 'base-content' | Any TextColor (primary, success, error, etc.) |
className | string | - | Additional CSS classes |
Best Practices
✅ Do
- Use appropriate sizes for context
- Match colors to theme (e.g., primary-content in buttons)
- Add descriptive text for clarity
- Use backdrop blur for overlays
❌ Don't
- Use XL size in small buttons
- Forget aria-label for accessibility
- Use conflicting colors (e.g., primary on primary bg)
- Show multiple loaders for same action