loading

BS5 Forms

Stacked Form

Form style is applied correctly to all textual <input> and <textarea> components with class .form-control:

 

Example

				
					<form action="/action_page.php">
  <div class="mb-3 mt-3">
    <label for="email" class="form-label">Email:</label>
    <input type="email" class="form-control" id="email" placeholder="Enter email" name="email">
  </div>
  <div class="mb-3">
    <label for="pwd" class="form-label">Password:</label>
    <input type="password" class="form-control" id="pwd" placeholder="Enter password" name="pswd">
  </div>
  <div class="form-check mb-3">
    <label class="form-check-label">
      <input class="form-check-input" type="checkbox" name="remember"> Remember me
    </label>
  </div>
  <button type="submit" class="btn btn-primary">Submit</button>
</form>
				
			

Also take note that, in order to guarantee proper padding, we give each label element a .form-label class.

The markup of checkboxes is different. They are encircled with a container element. Both labels and .form-check have a class of .radio buttons and checkboxes use .form-check-label .form-check-input.

Textarea

 

Example

				
					<label for="comment">Comments:</label>
<textarea class="form-control" rows="5" id="comment" name="text"></textarea>
				
			

Form Row/Grid (Inline Forms)

Use .row and .col if you want your form elements to show up side by side:

Example

				
					<form>
  <div class="row">
    <div class="col">
      <input type="text" class="form-control" placeholder="Enter email" name="email">
    </div>
    <div class="col">
      <input type="password" class="form-control" placeholder="Enter password" name="pswd">
    </div>
  </div>
</form>
				
			

Form Control Size

With .form-control-lg or .form-control-sm, you can modify the size of .form-control inputs:

Example

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

Disabled and Readonly

To make the input field inactive, use the readonly or disabled attributes:

Example

				
					<input type="text" class="form-control" placeholder="Normal input">
<input type="text" class="form-control" placeholder="Disabled input" disabled>
<input type="text" class="form-control" placeholder="Readonly input" readonly>
				
			

Plain text Inputs

To style an input field without borders, use the .form-control-plaintext class, making sure to maintain the appropriate padding and margins:

Example

				
					<input type="text" class="form-control-plaintext" placeholder="Plaintext input">
<input type="text" class="form-control" placeholder="Normal input">
				
			

Color Picker

===== Color Picker BUTTON MUKAVU =====

You should use the .form-control-color class to appropriately style an input with type=”color”:

Example

				
					<input type="color" class="form-control form-control-color" value="#CCCCCC">
				
			
Share this Doc

BS5 Forms

Or copy link

Explore Topic