Form controls
Example
<div class="mb-3"> <label class="form-label" for="exampleFormControlInput1">Email address</label> <input type="email" class="form-control" id="exampleFormControlInput1" placeholder="name@example.com"> </div> <div class="mb-3"> <label class="form-label" for="exampleFormControlTextarea1">Example textarea</label> <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea> </div>
Sizing
Set heights using classes like .form-control-lg and .form-control-sm.
<input class="form-control form-control-lg" type="text" placeholder=".form-control-lg"> <input class="form-control" type="text" placeholder="Default input"> <input class="form-control form-control-sm" type="text" placeholder=".form-control-sm">
Disabled
Add the disabled boolean attribute on an input to give it a grayed out appearance and remove pointer events.
<input class="form-control" type="text" placeholder="Disabled input" disabled> <input class="form-control" type="text" placeholder="Disabled readonly input" disabled readonly>
Readonly
Add the readonly boolean attribute on an input to prevent modification of the input’s value. Read-only inputs appear lighter (just like disabled inputs), but retain the standard cursor.
<input class="form-control" type="text" placeholder="Readonly input here..." readonly>
Readonly plain text
If you want to have <input readonly> elements in your form styled as plain text, use the .form-control-plaintext class to remove the default form field styling and preserve the correct margin and padding.
<div class="mb-3 row"> <label class="col-sm-2 col-form-label" for="staticEmail">Email</label> <div class="col-sm-10"> <input type="text" class="form-control-plaintext" id="staticEmail" value="email@example.com" readonly> </div> </div> <div class="mb-3 row"> <label class="col-sm-2 col-form-label" for="inputPassword">Password</label> <div class="col-sm-10"> <input type="password" class="form-control" id="inputPassword"> </div> </div>
<form class="row g-3"> <div class="col-auto"> <label class="visually-hidden" for="staticEmail2">Email</label> <input type="text" class="form-control-plaintext" id="staticEmail2" value="email@example.com" readonly> </div> <div class="col-auto"> <label class="visually-hidden" for="inputPassword2">Password</label> <input type="password" class="form-control" id="inputPassword2" placeholder="Password"> </div> <div class="col-auto"> <button type="submit" class="btn btn-primary">Confirm identity</button> </div> </form>
File input
<div class="mb-3"> <label for="formFile" class="form-label">Default file input example</label> <input class="form-control" type="file" id="formFile"> </div> <div class="mb-3"> <label for="formFileMultiple" class="form-label">Multiple files input example</label> <input class="form-control" type="file" id="formFileMultiple" multiple> </div> <div class="mb-3"> <label for="formFileDisabled" class="form-label">Disabled file input example</label> <input class="form-control" type="file" id="formFileDisabled" disabled> </div> <div class="mb-3"> <label for="formFileSm" class="form-label">Small file input example</label> <input class="form-control form-control-sm" type="file" id="formFileSm"> </div> <div> <label for="formFileLg" class="form-label">Large file input example</label> <input class="form-control form-control-lg" type="file" id="formFileLg"> </div>
Color picker
<label class="form-label" for="exampleColorInput">Color picker</label> <input type="color" class="form-control form-control-color" id="exampleColorInput" value="#9a0044" title="Choose your color">