Close button

A generic close button for dismissing components like modals and alerts.

Example #

A generic close button can be created using the .btn-close class. These buttons can be used for dismissing components like modals and alerts. Close buttons can also be disabled by adding the disabled attribute.

<!-- Close button -->
<button type="button" class="btn-close" aria-label="Close"></button>

<!-- Disabled close button -->
<button type="button" class="btn-close" disabled aria-label="Close"></button>

Color scheme #

Add data-bs-theme="dark" or data-bs-theme="light" directly to the .btn-close to create a light or dark variant that ignores the global color mode. Please note, the attribute should be added to the close button for best results, not on a parent element.

<!-- Light close button for dark background -->
<div style="background-color: var(--bs-sable);">
  <button type="button" class="btn-close" aria-label="Close" data-bs-theme="dark"></button>

<!-- Dark close button for light background -->
<div style="background-color: var(--bs-lightgray);">
  <button type="button" class="btn-close" aria-label="Close" data-bs-theme="light"></button>
Up next

Help us grow

Our main goal is to make Halfmoon the go-to framework for building websites, dashboards and tools. If you believe in our mission, consider becoming a sponsor and help us grow.

You can email us directly if you have any queries. We are always happy to answer.

Subscribe for updates

We will notify you when the framework gets a substantial update. No spam ever.

Follow us on Twitter so that you can stay updated that way.