keyboard_double_arrow_left
Close Button.
A generic close button for dismissing content like modals and alerts. Click here
Basic Example
Provide an option to dismiss or close a component with .btn-close
. Default styling is limited, but highly customizable. Modify the Sass variables to replace the default background-image
. Be sure to include text for screen readers, as we’ve done with aria-label
.
<button type="button" class="btn-close" aria-label="Close"></button>
Disabled state
Disabled close buttons change their opacity
. We’ve also applied pointer-events: none
and user-select: none
to preventing hover and active states from triggering.
<button type="button" class="btn-close" disabled aria-label="Close"></button>
Dark variant
Add data-bs-theme="dark"
to the .btn-close
, or to its parent element, to invert the close button. This uses the filter
property to invert the background-image
without overriding its value.
<div data-bs-theme="dark">
<button type="button" class="btn-close" aria-label="Close"></button>
<button type="button" class="btn-close" disabled aria-label="Close"></button>
</div>