Bootstrap 5 Components

Bootstrap comes with dozens of components that you can use to create interactive and attractive web pages. Here are some of the most commonly used components:

Components on this page:

Buttons

Button Styles
Button Sizes
Outline Buttons
Code Example:
<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-outline-success">Success</button>
<button type="button" class="btn btn-primary btn-lg">Large button</button>

Cards

Cards are flexible content containers with multiple variants and options.

Card image
Basic Card

Some quick example text to build on the card title and make up the bulk of the card's content.

Go somewhere
Featured
Card with header

This card has a header and a footer for extra information.

Learn more
Text Card
Card subtitle

Some quick example text to build on the card title and make up the bulk of the card's content.

Card link Another link
Code Example:
<div class="card">
  <img src="..." class="card-img-top" alt="...">
  <div class="card-body">
    <h5 class="card-title">Card title</h5>
    <p class="card-text">Some text here...</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
</div>

Alerts

Alerts provide contextual feedback messages for typical user actions.

Code Example:
<div class="alert alert-primary" role="alert">
  A simple primary alert—check it out!
</div>

<!-- Dismissible Alert -->
<div class="alert alert-warning alert-dismissible fade show" role="alert">
  <strong>Holy guacamole!</strong> You should check in on some of those fields below.
  <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>

Forms

Bootstrap's form controls expand on our Rebooted form styles with classes.

Basic Form
We'll never share your email with anyone else.
Form Controls
Inline Form
Code Example:
<form>
  <div class="mb-3">
    <label for="exampleInputEmail1" class="form-label">Email address</label>
    <input type="email" class="form-control" id="exampleInputEmail1">
  </div>
  <div class="mb-3">
    <label for="exampleInputPassword1" class="form-label">Password</label>
    <input type="password" class="form-control" id="exampleInputPassword1">
  </div>
  <button type="submit" class="btn btn-primary">Submit</button>
</form>

Modals

Modals are dialog boxes/popups that are displayed on top of the current page.

Code Example:
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
  Launch modal
</button>

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">...
      <div class="modal-body">...
      <div class="modal-footer">...
    </div>
  </div>
</div>