List Group Variations

Back

Loading concept...

🎨 Bootstrap List Group Variations: Your Magic Toolbox for Lists!

Imagine you have a toy box with different compartments. Each compartment holds different types of toys - numbered toys, colorful toys, toys with badges, and special toys with extra features. Bootstrap List Groups work exactly like that magic toy box!


πŸ“– The Story of the List Family

Once upon a time, there was a simple list who dreamed of becoming beautiful and useful. Bootstrap gave it superpowers - numbers, colors, badges, and more! Let’s meet each member of this amazing family.


1️⃣ List Group Numbered

What is it?

Think of a recipe or a treasure map where steps must be followed in order. Numbered lists help you count: 1, 2, 3!

The Magic Words

<ol class="list-group list-group-numbered">
  <li class="list-group-item">Wake up</li>
  <li class="list-group-item">Brush teeth</li>
  <li class="list-group-item">Eat breakfast</li>
</ol>

πŸ”‘ Key Points

Part What It Does
<ol> Ordered list (numbers!)
list-group-numbered Adds automatic numbers
<li> Each numbered item

πŸ’‘ Why Use It?

  • Steps in a process (like baking a cake)
  • Rankings (top 5 favorite games)
  • Instructions (how to play)

↔️ List Group Horizontal

What is it?

Imagine your toys standing in a line instead of stacked on top of each other. Horizontal lists go side by side!

The Magic Words

<ul class="list-group list-group-horizontal">
  <li class="list-group-item">🍎 Apple</li>
  <li class="list-group-item">🍌 Banana</li>
  <li class="list-group-item">🍊 Orange</li>
</ul>

🎯 Responsive Magic

You can make it horizontal only on bigger screens:

<!-- Horizontal on medium screens and up -->
<ul class="list-group list-group-horizontal-md">
  <li class="list-group-item">Item 1</li>
  <li class="list-group-item">Item 2</li>
</ul>
Class When It Goes Horizontal
list-group-horizontal Always
list-group-horizontal-sm 576px and wider
list-group-horizontal-md 768px and wider
list-group-horizontal-lg 992px and wider

🌈 List Group Colors

What is it?

Like crayons in a box - each item can have its own special color! Bootstrap gives you ready-made colors to show different meanings.

The Magic Words

<ul class="list-group">
  <li class="list-group-item
      list-group-item-primary">
    Blue - Important Info
  </li>
  <li class="list-group-item
      list-group-item-success">
    Green - All Good!
  </li>
  <li class="list-group-item
      list-group-item-danger">
    Red - Warning!
  </li>
  <li class="list-group-item
      list-group-item-warning">
    Yellow - Be Careful
  </li>
</ul>

🎨 Color Meanings

Color Class Feeling Use For
list-group-item-primary πŸ’™ Blue Main info
list-group-item-secondary 🩢 Gray Less important
list-group-item-success πŸ’š Green Good news
list-group-item-danger ❀️ Red Errors, alerts
list-group-item-warning πŸ’› Yellow Caution
list-group-item-info 🩡 Cyan Tips
list-group-item-light 🀍 Light Subtle
list-group-item-dark πŸ–€ Dark Strong

πŸ… List Group with Badges

What is it?

Imagine each item in your list wearing a little sticker that shows a number or label. Like notifications on your phone apps!

The Magic Words

<ul class="list-group">
  <li class="list-group-item
      d-flex justify-content-between
      align-items-center">
    Messages
    <span class="badge bg-primary
        rounded-pill">14</span>
  </li>
  <li class="list-group-item
      d-flex justify-content-between
      align-items-center">
    Friends Online
    <span class="badge bg-success
        rounded-pill">3</span>
  </li>
</ul>

πŸ”‘ Breaking It Down

Class What It Does
d-flex Makes items side by side
justify-content-between Pushes badge to the right
align-items-center Centers vertically
badge The little sticker
rounded-pill Makes badge round

✨ List Group Custom Content

What is it?

A super-powered list item that can hold titles, descriptions, and extra text - like a mini webpage inside each item!

The Magic Words

<div class="list-group">
  <a href="#" class="list-group-item
      list-group-item-action">
    <div class="d-flex w-100
        justify-content-between">
      <h5 class="mb-1">My Homework</h5>
      <small>3 days ago</small>
    </div>
    <p class="mb-1">
      Math worksheet about fractions.
    </p>
    <small>Due tomorrow!</small>
  </a>
</div>

πŸ“¦ What’s Inside

graph TD A["List Group Item"] --> B["Header Row"] B --> C["Title"] B --> D["Timestamp"] A --> E["Description"] A --> F["Extra Info"]

🎯 The Action Class

Adding list-group-item-action makes items:

  • Clickable (like buttons!)
  • Hoverable (changes color when you point)
  • Interactive (feels alive!)

β˜‘οΈ List Group Checkboxes

What is it?

A to-do list where you can tick off items! Each item has a little box you can check.

The Magic Words

<ul class="list-group">
  <li class="list-group-item">
    <input class="form-check-input me-1"
           type="checkbox"
           id="task1">
    <label class="form-check-label"
           for="task1">
      Clean my room
    </label>
  </li>
  <li class="list-group-item">
    <input class="form-check-input me-1"
           type="checkbox"
           id="task2"
           checked>
    <label class="form-check-label"
           for="task2">
      Finish homework
    </label>
  </li>
</ul>

πŸ”‘ Key Parts

Part What It Does
form-check-input Styles the checkbox
me-1 Adds space after checkbox
for="task1" Connects label to checkbox
checked Pre-checks the box

πŸ’‘ Pro Tip

Click the text label - not just the tiny box - and it still works! That’s because of the for attribute magic.


🎁 Putting It All Together

You can mix and match these powers! Here’s a super-list:

<ol class="list-group list-group-numbered">
  <li class="list-group-item
      d-flex justify-content-between
      align-items-start
      list-group-item-success">
    <div class="ms-2 me-auto">
      <div class="fw-bold">
        Level Complete!
      </div>
      You earned 100 points
    </div>
    <span class="badge bg-success
        rounded-pill">βœ“</span>
  </li>
</ol>

This combines:

  • βœ… Numbered (ol + list-group-numbered)
  • βœ… Colored (list-group-item-success)
  • βœ… Badge (badge with checkmark)
  • βœ… Custom content (title + description)

πŸš€ Quick Reference

graph TD A["List Group"] --> B["Numbered"] A --> C["Horizontal"] A --> D["Colored"] A --> E["With Badges"] A --> F["Custom Content"] A --> G["Checkboxes"] B --> B1["Use: ol tag"] C --> C1["Use: list-group-horizontal"] D --> D1["Use: list-group-item-COLOR"] E --> E1["Use: badge class"] F --> F1["Use: nested divs"] G --> G1["Use: form-check-input"]

🎯 Remember This!

Want To… Add This Class
Add numbers list-group-numbered
Go sideways list-group-horizontal
Add color list-group-item-{color}
Make clickable list-group-item-action
Add badge Use <span class="badge">
Add checkbox Use <input type="checkbox">

Now you’re ready to create beautiful, organized lists that do exactly what you need! Go build something amazing! πŸŽ‰

Loading story...

Story - Premium Content

Please sign in to view this story and start learning.

Upgrade to Premium to unlock full access to all stories.

Stay Tuned!

Story is coming soon.

Story Preview

Story - Premium Content

Please sign in to view this concept and start learning.

Upgrade to Premium to unlock full access to all content.