Boostrap 5 Form Example

Ruth Jul 09, 2026

Looking to create responsive forms in your web projects? Bootstrap 5, the latest version of the popular CSS framework, offers a robust and easy-to-use form component. Let's delve into some examples to help you get started with Bootstrap 5 forms.

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

Before we dive into the examples, ensure you have included the Bootstrap 5 CDN in your project. You'll need both the CSS and JavaScript files. Here's how you can include them:

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

Basic Form Structure

First, let's create a basic form structure. In Bootstrap 5, forms are built within a `.row` and `.col` classes for responsive layouts.

Meilleurs modèles de formulaires d'inscription HTML et CSS | BeginDot
Meilleurs modèles de formulaires d'inscription HTML et CSS | BeginDot

Here's a simple example:

```html

```

Form Validation

Best Free Bootstrap Login Forms » CSS Author
Best Free Bootstrap Login Forms » CSS Author

Bootstrap 5 includes built-in validation styles for form controls. Here's how you can use it:

Add the `is-valid` or `is-invalid` class to the parent `.col` element to trigger the validation styles. You can also use JavaScript to add these classes dynamically based on user input.

Form Layouts

the form wizard screen is displayed on an ipad
the form wizard screen is displayed on an ipad

Bootstrap 5 offers several form layout options. You can choose from horizontal forms, inline forms, or grid forms. Here's an example of a horizontal form:

Wrap your label and form control in a `.row`, and use `.col-form-label` for the label and `.col` for the form control. Add `.form-group` for better alignment and spacing.

```html

```

Form Components

Bootstrap 5 subscribe to our newsletter form with image
Bootstrap 5 subscribe to our newsletter form with image

Bootstrap 5 also includes various form components like checkboxes, radios, switches, and more. Let's explore some examples.

Checkboxes and Radios

an image of a phone screen showing the user's name and numbers on it
an image of a phone screen showing the user's name and numbers on it
11 Best Of Bootstrap Beautiful Card
 Photos
11 Best Of Bootstrap Beautiful Card Photos
Bootstrap Fieldset Legend: How To + Examples + Template | AZMIND
Bootstrap Fieldset Legend: How To + Examples + Template | AZMIND
Fichier PDF FORMULAIRE-AMSTERDAM.pdf
Fichier PDF FORMULAIRE-AMSTERDAM.pdf
Dual Design Registration Form
Dual Design Registration Form
Bootstrap Forms
Bootstrap Forms
an image of a website page with the wordpress plugs highlighted in blue and white
an image of a website page with the wordpress plugs highlighted in blue and white
Booking Form Builder | SaaS Admin Dashboard UIUX by Be Confidency on Muzli
Booking Form Builder | SaaS Admin Dashboard UIUX by Be Confidency on Muzli
Simple HTML Bootstrap Form Template
Simple HTML Bootstrap Form Template
34 Best Bootstrap Search Box Examples 2026 - uiCookies
34 Best Bootstrap Search Box Examples 2026 - uiCookies
How to Create Forms in monday work management | TechRepublic
How to Create Forms in monday work management | TechRepublic
Admin Dashboard: HTML & CSS Powerhouse
Admin Dashboard: HTML & CSS Powerhouse
a paper with some writing on it and numbers in the bottom right hand corner,
a paper with some writing on it and numbers in the bottom right hand corner,
UI feedback for a complex web form
UI feedback for a complex web form
Contact Form Templates | Free Online Forms
Contact Form Templates | Free Online Forms
the screenshot shows different types of text and numbers
the screenshot shows different types of text and numbers
Rukada - Responsive Bootstrap 5 Admin Template
Rukada - Responsive Bootstrap 5 Admin Template
Ynex - Blazor Server Bootstrap Admin Template
Ynex - Blazor Server Bootstrap Admin Template
a form of application for employment in france
a form of application for employment in france
Type Document Long Form Template
Type Document Long Form Template

Use the `.form-check` class for checkboxes and radios. Here's an example:

For checkboxes, use the `.form-check-input` class for the input element, and for radios, use the `.form-check-input` class along with the `.form-check-label` class for the label.

Switches

Switches are custom checkboxes that can be toggled on or off. Here's how you can create a switch:

Use the `.form-check form-check-switch` class for the input element, and the `.form-check-label` class for the label. Add the `.switch-input` class for the input element to style it as a switch.

With these examples, you're well on your way to creating responsive and stylish forms using Bootstrap 5. Happy coding!