Bootstrap 5 Form Example

Ruth Jul 09, 2026

Bootstrap, a popular open-source CSS framework, has been a game-changer for web developers, enabling them to create responsive and mobile-first websites with ease. With the release of Bootstrap 5, developers have access to even more powerful tools and features, including a revamped form system. In this article, we'll explore Bootstrap 5 form examples, highlighting its new features and how to use them effectively.

Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5

Before diving into the examples, let's briefly discuss why Bootstrap 5 forms are worth exploring. Bootstrap 5 brings improved accessibility, better customization options, and enhanced performance compared to its predecessor. It also introduces a new input group feature, making it easier to create complex form layouts.

Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5

Form Layouts in Bootstrap 5

Bootstrap 5 offers several form layout options, allowing you to create responsive forms that adapt to different screen sizes. The new grid system in Bootstrap 5 makes it simpler to create forms with various column sizes and offsets.

Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5

To get started, include the Bootstrap 5 CSS and JavaScript files in your project. You can either download them or use a CDN like this:

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>

Horizontal Form

HTML Form Validation with Bootstrap
HTML Form Validation with Bootstrap

Horizontal forms are an excellent choice when you want to align labels and inputs on the same line. In Bootstrap 5, you can create horizontal forms using the .row and .col classes along with the new .form-label class for better accessibility.

Here's an example of a horizontal form in Bootstrap 5:

<div class="row mb-3">
  <label for="inputEmail3" class="col-sm-2 col-form-label">Email</label>
  <div class="col-sm-10">
    <input type="email" class="form-control" id="inputEmail3">
  </div>
</div>

Vertical Form

Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5

Vertical forms are the default layout in Bootstrap 5 and are suitable for simple, one-column forms. To create a vertical form, simply use the .form-control class on your inputs and textareas.

Here's a basic vertical form example:

<form>
  <div class="mb-3">
    <label for="exampleInputEmail1" class="form-label">Email address</label>
    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
    <div id="emailHelp" class="form-text">We'll never share your email with anyone else.</div>
  </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>

Input Groups in Bootstrap 5

Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5

Input groups in Bootstrap 5 allow you to create complex form inputs with add-ons, such as text, buttons, or dropdown menus. They help improve the usability and appearance of your forms by grouping related elements together.

To create an input group, wrap your input and add-ons in a .input-group div, and use the .form-control class on your input element.

Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Free 22+ HTML5 Signup & Registration Forms - HTML, CSS
Free 22+ HTML5 Signup & Registration Forms - HTML, CSS
37 Free Bootstrap Form Templates You Can Try Right Now
37 Free Bootstrap Form Templates You Can Try Right Now
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Bootstrap Tutorial | Bootstrap Notes | Bootstrap 5
Best Free Bootstrap Login Forms » CSS Author
Best Free Bootstrap Login Forms » CSS Author
Bootstrap 5 Login Form Template
Bootstrap 5 Login Form Template
Website Landing Page using HTML CSS Bootstrap 5 #3
Website Landing Page using HTML CSS Bootstrap 5 #3
Bootstrap 5 popup form
Bootstrap 5 popup form
Bootstrap Fieldset Legend: How To + Examples + Template | AZMIND
Bootstrap Fieldset Legend: How To + Examples + Template | AZMIND
Login Form Template Bootstrap 5
Login Form Template Bootstrap 5
40 Best Free Bootstrap Login Form Templates 2026 - Colorlib
40 Best Free Bootstrap Login Form Templates 2026 - Colorlib
the screens are showing different types of webpages, including one for each user
the screens are showing different types of webpages, including one for each user
Bootstrap 5 subscribe to our newsletter form with image
Bootstrap 5 subscribe to our newsletter form with image
11 Best Of Bootstrap Beautiful Card
 Photos
11 Best Of Bootstrap Beautiful Card Photos

Basic Input Group

Here's an example of a basic input group with a text add-on:

<div class="input-group mb-3">
  <span class="input-group-text">@</span>
  <input type="text" class="form-control" placeholder="Username" aria-label="Username">
</div>

Input Group with Dropdown

You can also create input groups with dropdown menus using the .btn-group and .dropdown-toggle classes:

Here's an example:

<div class="input-group mb-3">
  <input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username">
  <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</button>
  <ul class="dropdown-menu">
    <li><a class="dropdown-item" href="#">Action</a></li>
    <li><a class="dropdown-item" href="#">Another action</a></li>
    <li><a class="dropdown-item" href="#">Something else here</a></li>
  </ul>
</div>

In conclusion, Bootstrap 5's form system offers a wealth of new features and improvements that can help you create more accessible, responsive, and engaging forms. By exploring the examples provided in this article, you'll be well on your way to harnessing the power of Bootstrap 5 forms in your projects. Happy coding!