Bootstrap 5: Mastering Text Input Fields

Ruth Jul 09, 2026

Bootstrap 5, the latest iteration of the popular CSS framework, brings a host of improvements and new features, including a revamped form input system. Text inputs are a critical component of any web form, and Bootstrap 5 offers a range of options to style and customize them. Let's dive into the world of Bootstrap 5 form input text.

📝 Create Text Input Forms and Submit Button in HTML
📝 Create Text Input Forms and Submit Button in HTML

Before we delve into the specifics, it's essential to understand that Bootstrap 5 uses a utility-first approach. This means that instead of predefined components like in Bootstrap 4, you'll apply utility classes directly to your HTML to style elements. This approach offers more flexibility and customization options.

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

Basic Text Inputs

Creating a basic text input in Bootstrap 5 is straightforward. You simply need to add the `form-control` class to your input field. Here's a simple example:

A Beginner's Guide to the Latest Bootstrap 5 Utilities
A Beginner's Guide to the Latest Bootstrap 5 Utilities

<input type="text" class="form-control" placeholder="Example text input">

Sizes

📝 Create Forms in HTML
📝 Create Forms in HTML

Bootstrap 5 offers three sizes for text inputs: `lg` (large), `sm` (small), and `xs` (extra small). To apply a size, add the corresponding class to your input. For example, to create a large text input:

<input type="text" class="form-control form-control-lg" placeholder="Large text input">

Colors

Bootstrap Forms
Bootstrap Forms

You can also change the color of the text input by using the `bg-*` and `text-*` classes. For instance, to create a text input with a light blue background and dark text:

<input type="text" class="form-control bg-light text-dark" placeholder="Light blue text input">

Floating Labels

BOOTSTRAP INPUT FORM (2020) | HOW TO MAKE FORM IN BOOTSTRAP
BOOTSTRAP INPUT FORM (2020) | HOW TO MAKE FORM IN BOOTSTRAP

Floating labels are a new feature in Bootstrap 5. They move above the input field when it's focused or contains a value. To use them, add the `form-floating` class to the parent element and the `form-control` class to the input field. Then, add the `form-label` class to a sibling element containing the label text:

<div class="form-floating mb-3"> <input type="text" class="form-control" id="floatingInput"> <label for="floatingInput">Example label</label> </div>

an orange background with some type of text in the bottom right corner and another type of text below
an orange background with some type of text in the bottom right corner and another type of text below
HTML Input Types : A Comprehensive Guide
HTML Input Types : A Comprehensive Guide
37 Free Bootstrap Form Templates You Can Try Right Now
37 Free Bootstrap Form Templates You Can Try Right Now
Wizard
Wizard
HTML Input Types – Complete Guide for Beginners
HTML Input Types – Complete Guide for Beginners
Stop Googling HTML Inputs—Save This Instead!
Stop Googling HTML Inputs—Save This Instead!
Bootstrap Responsive Design Registration Form
Bootstrap Responsive Design Registration Form
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
HTML Forms Cheat Sheet for Beginners — Simple Guide
HTML Forms Cheat Sheet for Beginners — Simple Guide
INPUT TYPES IN HTML 👨‍🦱
INPUT TYPES IN HTML 👨‍🦱
HTML/CSS|Formの使い方(label, input, select, textarea) - わくわくBank
HTML/CSS|Formの使い方(label, input, select, textarea) - わくわくBank
the bootstap login and register forms page
the bootstap login and register forms page
two screens showing the different types of text in an open - source web page, with one being highlighted
two screens showing the different types of text in an open - source web page, with one being highlighted
Add remove input fields dynamically using jQuery and bootstrap
Add remove input fields dynamically using jQuery and bootstrap
JavaScript Form Events: Handle User Input Like a Pro 📝
JavaScript Form Events: Handle User Input Like a Pro 📝
Bootstrap 5 responsive registration form
Bootstrap 5 responsive registration form
Input types in Html
Input types in Html
Bootstrap Registration Forms: 3 Free Responsive Templates | AZMIND
Bootstrap Registration Forms: 3 Free Responsive Templates | AZMIND
Have a Field Day with HTML5 Forms
Have a Field Day with HTML5 Forms
the text box is highlighted in red and blue
the text box is highlighted in red and blue

Validation

Bootstrap 5 also provides built-in validation styles for form inputs. To indicate a valid input, add the `is-valid` class. For an invalid input, use the `is-invalid` class. Here's an example:

<input type="text" class="form-control is-valid" id="validInput"> <div class="valid-feedback">Looks good!</div>

Disabled and Readonly Inputs

To disable an input, add the `disabled` attribute. To make an input readonly, add the `readonly` attribute. Both will prevent user interaction with the input:

<input type="text" class="form-control" id="disabledInput" disabled> <input type="text" class="form-control" id="readonlyInput" readonly>

In conclusion, Bootstrap 5's form input text system offers a wide range of customization options, from sizes and colors to floating labels and validation styles. By leveraging these features, you can create engaging and user-friendly forms for your web applications. Happy coding!