Bootstrap Form with Input

Ruth Jul 09, 2026

Bootstrap, a popular CSS framework, offers a wide range of pre-built components to simplify and speed up web development. One of its most useful features is the Bootstrap form, which provides a consistent and responsive design for forms out of the box. In this article, we'll delve into creating a Bootstrap form with input fields, exploring its components, and understanding how to style and customize them.

HTML Form Validation with Bootstrap
HTML Form Validation with Bootstrap

Bootstrap's form components are built using a combination of HTML, CSS, and JavaScript. They are designed to be mobile-responsive and accessible, ensuring a seamless user experience across various devices and platforms.

the homepage for an employee portal with a rocket ship in the background and text that reads, apply as a employee
the homepage for an employee portal with a rocket ship in the background and text that reads, apply as a employee

Setting Up the Bootstrap Form

Before we dive into the input fields, let's set up a basic Bootstrap form. First, include the Bootstrap CSS and JavaScript files in your HTML document. Then, wrap your form within a <form> tag and add the class="needs-validation" attribute for built-in form validation.

Free 22+ HTML5 Signup & Registration Forms - HTML, CSS
Free 22+ HTML5 Signup & Registration Forms - HTML, CSS

Here's a simple example:

<form class="needs-validation" novalidate>
  <div class="form-row">
    <div class="col-md-4 mb-3">
      <label for="validationCustom01">First name</label>
      <input type="text" class="form-control" id="validationCustom01" placeholder="First name" value="" required>
      <div class="valid-feedback">Looks good!</div>
    </div>
    <div class="col-md-4 mb-3">
      <label for="validationCustom02">Last name</label>
      <input type="text" class="form-control" id="validationCustom02" placeholder="Last name" value="" required>
      <div class="valid-feedback">Looks good!</div>
    </div>
    <div class="col-md-4 mb-3">
      <label for="validationCustomUsername">Username</label>
      <div class="input-group">
        <div class="input-group-prepend">
          <span class="input-group-text" id="inputGroupPrepend3">@</span>
        </div>
        <input type="text" class="form-control" id="validationCustomUsername" placeholder="Username" aria-describedby="inputGroupPrepend3" required>
        <div class="invalid-feedback">Please choose a username.</div>
      </div>
    </div>
  </div>
  <button class="btn btn-primary" type="submit">Submit form</button>
</form>

Bootstrap Input Types

๐Ÿ“ Create Text Input Forms and Submit Button in HTML
๐Ÿ“ Create Text Input Forms and Submit Button in HTML

Bootstrap supports various input types, including text, password, email, number, date, and more. You can use the type attribute to specify the input type within the <input> tag. For example:

<input type="text" class="form-control" placeholder="Text input">
<input type="password" class="form-control" placeholder="Password">
<input type="email" class="form-control" placeholder="Email address">

Form Validation

Bootstrap provides built-in form validation through the use of the required attribute and custom feedback messages. When an input field is invalid, Bootstrap adds the is-invalid class to the field, and the corresponding feedback message is displayed.

Wizard
Wizard

Here's an example of a required input field with custom feedback messages:

<div class="form-group">
  <label for="exampleInputEmail1">Email address</label>
  <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email" required>
  <div class="invalid-feedback">Please provide a valid email address.</div>
</div>

Customizing Bootstrap Forms

While Bootstrap provides a wide range of pre-built styles, you can also customize the forms to match your project's design. You can use Bootstrap's utility classes to adjust the layout, size, and color of the input fields and other form elements.

37 Free Bootstrap Form Templates You Can Try Right Now
37 Free Bootstrap Form Templates You Can Try Right Now

Form Sizes

Bootstrap offers three predefined sizes for form inputs: form-control-lg, form-control, and form-control-sm. You can apply these classes to the <input> tag to change the size of the input field. Additionally, you can use custom CSS to create custom sizes.

Best Free Bootstrap Login Forms ยป CSS Author
Best Free Bootstrap Login Forms ยป CSS Author
Bootstrap Forms
Bootstrap Forms
Bootstrap Forms - Tutlane
Bootstrap Forms - Tutlane
BOOTSTRAP INPUT FORM (2020) | HOW TO MAKE FORM IN BOOTSTRAP
BOOTSTRAP INPUT FORM (2020) | HOW TO MAKE FORM IN BOOTSTRAP
BOOTSTRAP 4 INPUT FORM | HOW TO MAKE FORM IN BOOTSTRAP 4 WITH ICON
BOOTSTRAP 4 INPUT FORM | HOW TO MAKE FORM IN BOOTSTRAP 4 WITH ICON
an image of a website page with multiple screens
an image of a website page with multiple screens
Bootstrap Responsive Design Registration Form
Bootstrap Responsive Design Registration Form
Bootstrap Crud Data Table for Database with Modal Form Template
Bootstrap Crud Data Table for Database with Modal Form Template
the form wizard screen is displayed on an ipad
the form wizard screen is displayed on an ipad
an email form with two different types of letters and numbers on the top right hand corner
an email form with two different types of letters and numbers on the top right hand corner
two screens showing the settings and options for each user's account or credit card
two screens showing the settings and options for each user's account or credit card
an apple sign up form on a purple and blue background with circles around the screen
an apple sign up form on a purple and blue background with circles around the screen
Bootstrap Fieldset Legend: How To + Examples + Template | AZMIND
Bootstrap Fieldset Legend: How To + Examples + Template | AZMIND
the new html form is displayed in this screenshote, and it appears to be different
the new html form is displayed in this screenshote, and it appears to be different
๐Ÿ“ Create Forms in HTML
๐Ÿ“ Create Forms in HTML
Bootstrap Multi Step Form Animations With CSS | Switch Form's Animation
Bootstrap Multi Step Form Animations With CSS | Switch Form's Animation
Free Bootstrap Registration Form
Free Bootstrap Registration Form
Bootstrap 3 Contact form with Validation
Bootstrap 3 Contact form with Validation
the bootstap login and register forms page
the bootstap login and register forms page
Bootstrap 5 popup form
Bootstrap 5 popup form

Input Groups

Input groups combine form controls like <input>, <textarea>, and <select> with add-ons like the <span> or <button> elements. They help to create more complex and visually appealing forms. Here's an example:

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

In conclusion, Bootstrap's form components provide a solid foundation for creating responsive and accessible forms. By understanding the various input types, validation options, and customization techniques, you can create powerful and engaging forms that enhance the user experience. Happy coding!