← All guides
Bootstrap 6 ยท Subject Guide

Interactive Components

Hover lift, toggler, scrollspy, dialog, drawer, and avatar patterns.

Version note: Bootstrap 6 is alpha. These guides use the 6.0.0-alpha.1 CDN. Some class names from your notes may require a custom build or project CSS.

1. Hover lift

A small hover animation can make clickable cards feel responsive. If your project does not provide a hover-lift utility, use this CSS fallback.

Hover over this card to see the lift effect.
Ready-to-use code
<div class="hover-lift">Card content</div>

/* CSS fallback */
.hover-lift {
  transition: transform .2s ease, box-shadow .2s ease;
}
.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 1rem 2rem rgba(0,0,0,.12);
}

2. Toggler / collapse

Toggle content open and closed with Bootstrap's collapse component.

This content can be expanded and collapsed.
Ready-to-use code
<button class="btn btn-solid theme-primary" data-bs-toggle="collapse"
        data-bs-target="#details" aria-controls="details">
  Toggle details
</button>
<div class="collapse" id="details">Collapsible content</div>

3. Scrollspy

Scrollspy updates navigation state as the user scrolls through sections. The target links must match the section IDs.

Overview

Introductory content.

Details

More details. Scroll this panel.

Summary

Closing notes.

Ready-to-use code
<nav id="sectionNav" class="nav nav-pills">
  <a class="nav-link" href="#overview">Overview</a>
  <a class="nav-link" href="#details">Details</a>
</nav>
<div data-bs-spy="scroll" data-bs-target="#sectionNav"
     tabindex="0" style="height:240px;overflow-y:auto">
  <section id="overview">...</section>
  <section id="details">...</section>
</div>

4. Dialog

A native <dialog> is useful for confirmation or a focused task without navigating away. Bootstrap 6 handles the backdrop, focus trap, and Escape key for you.

Confirm action
Are you sure you want to continue?
Ready-to-use code
<button class="btn btn-solid theme-primary"
        data-bs-toggle="dialog" data-bs-target="#confirmDialog">
  Open dialog
</button>

<dialog class="dialog" id="confirmDialog"
        aria-labelledby="confirmDialogTitle">
  <div class="dialog-header">
    <h5 class="dialog-title" id="confirmDialogTitle">Confirm action</h5>
    <button class="btn-close" data-bs-dismiss="dialog"
            aria-label="Close"></button>
  </div>
  <div class="dialog-body">
    Are you sure you want to continue?
  </div>
  <div class="dialog-footer">
    <button class="btn btn-solid theme-secondary"
            data-bs-dismiss="dialog">Cancel</button>
    <button class="btn btn-solid theme-primary"
            data-bs-dismiss="dialog">Confirm</button>
  </div>
</dialog>

5. Drawer

A drawer is useful for filters, navigation, and contextual actions. Like the dialog, it is a native <dialog> element in Bootstrap 6.

Filter options
Put filters and quick actions here.
Ready-to-use code
<button class="btn btn-outline theme-primary"
        data-bs-toggle="drawer" data-bs-target="#filterDrawer">
  Open drawer
</button>

<dialog class="drawer drawer-end" id="filterDrawer"
        aria-labelledby="filterDrawerTitle">
  <div class="drawer-header">
    <h5 class="drawer-title" id="filterDrawerTitle">Filter options</h5>
    <button class="btn-close" data-bs-dismiss="drawer"
            aria-label="Close"></button>
  </div>
  <div class="drawer-body">
    Put filters and quick actions here.
  </div>
  <div class="drawer-footer">
    <button class="btn btn-solid theme-secondary"
            data-bs-dismiss="drawer">Reset</button>
    <button class="btn btn-solid theme-primary"
            data-bs-dismiss="drawer">Apply filters</button>
  </div>
</dialog>

6. Avatar

Use a photo or initials to identify a person. This initials avatar does not need an image file.

Yeshwanth Kumar
Delivery Manager
Ready-to-use code
<div class="avatar" role="img" aria-label="Avatar for Yeshwanth">YK</div>

/* CSS fallback */
.avatar {
  width: 3.2rem; height: 3.2rem; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: #e8efff; color: #244aa5; font-weight: 800;
}