Bootstrap 5 – Media & Interactive Display
Estimated reading: 3 minutes 10 views

🧼 Bootstrap 5 – Placeholders: Simulate Content While Loading

🧲 Introduction – What Are Placeholders in Bootstrap 5?

Placeholders in Bootstrap 5 are utility classes used to show loading skeletons or fake content blocks while the real data is being fetched. They help maintain UI layout and improve user perception of performance by indicating that something is loading behind the scenes.

🎯 In this guide, you’ll learn:

  • How to create text, image, and block placeholders
  • Use animations for shimmer effects
  • Match placeholder styles with components like cards and tables
  • Best practices for responsive and accessible placeholders

βœ… Example 1 – Basic Text Placeholder

<p>
  <span class="placeholder col-6"></span>
</p>

πŸ” Explanation:

ClassPurpose
.placeholderBase class for all placeholders
.col-6Sets width to 50% using Bootstrap grid

βœ… Example 2 – Animated Placeholders

<p class="placeholder-glow">
  <span class="placeholder col-6"></span>
</p>

<p class="placeholder-wave">
  <span class="placeholder col-6"></span>
</p>
ClassAnimation Style
.placeholder-glowSoft fade-in animation
.placeholder-waveRipple or shimmer loading animation

βœ… Example 3 – Placeholder for Buttons

<a class="btn btn-primary disabled placeholder col-4" aria-disabled="true"></a>
  • Use .placeholder on buttons with .disabled to simulate UI buttons during loading.

βœ… Example 4 – Placeholder Card Example

<div class="card" aria-hidden="true">
  <img src="..." class="card-img-top" alt="..." />
  <div class="card-body">
    <h5 class="card-title placeholder-glow">
      <span class="placeholder col-6"></span>
    </h5>
    <p class="card-text placeholder-glow">
      <span class="placeholder col-7"></span>
      <span class="placeholder col-4"></span>
      <span class="placeholder col-4"></span>
      <span class="placeholder col-6"></span>
      <span class="placeholder col-8"></span>
    </p>
    <a class="btn btn-primary disabled placeholder col-6" aria-disabled="true"></a>
  </div>
</div>

πŸ” Use Case:

  • Create complete loading cards before data (e.g., user profiles, product info) is ready.
  • Use aria-hidden="true" to skip placeholder content for screen readers.

βœ… Placeholder Colors

Use Bootstrap’s background utility classes:

<span class="placeholder col-12 bg-primary"></span>
<span class="placeholder col-12 bg-success"></span>
<span class="placeholder col-12 bg-warning"></span>
ClassColor
bg-primaryBlue
bg-successGreen
bg-warningYellow

πŸ› οΈ Best Practices for Placeholders

TipWhy It Helps
Use same layout as real contentPrevents layout shifts and jank
Pair with animationsGives visual feedback during loading
Add aria-hidden="true"Hides placeholder from screen readers
Use matching component widthsEnsures alignment when real data loads in
Replace with real content ASAPAvoid excessive skeleton delays

πŸ“Œ Summary – Simulate Content Load with Bootstrap Placeholders

Bootstrap 5 placeholders are modern skeleton screens used to indicate that content is loading. They offer visual feedback and maintain layout structure, enhancing UX on slower connections or dynamic content apps.

πŸ” Key Takeaways:

  • Use .placeholder classes to show loading UI blocks
  • Animate with .placeholder-glow or .placeholder-wave
  • Combine with .disabled for buttons or cards
  • Hide from screen readers with aria-hidden="true"
  • Control widths using Bootstrap grid classes (e.g., col-6, col-4)

βš™οΈ Ideal for loading dashboards, cards, tables, and interactive content.


❓ FAQs – Bootstrap 5 Placeholders

❓ What’s the difference between glow and wave animations?
βœ… .placeholder-glow fades softly, while .placeholder-wave shows a ripple/shimmer effect.


❓ Can placeholders be used in buttons or navs?
βœ… Yes. Apply .placeholder with .disabled and appropriate sizing (col-*).


❓ Are placeholders responsive?
βœ… Yes. Use Bootstrap’s grid classes to adjust width across breakpoints (e.g., col-sm-4, col-md-6).


❓ Do placeholders affect accessibility?
βœ… Use aria-hidden="true" so screen readers skip them during loading.


Share Now :

Leave a Reply

Your email address will not be published. Required fields are marked *

Share

Bootstrap 5 – Placeholders

Or Copy Link

CONTENTS
Scroll to Top