Basic Forms

Horizontal Form
Show Code
                    
        <form>
        <div class="form-group row">
        <label class="col-3 d-flex flex-row align-items-center" for="exampleInputEmail1">Email address</label>
        <div class="col-9">
        <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
        </div>
        </div>
        <div class="form-group row">
        <label class="col-3 d-flex flex-row align-items-center" for="exampleInputPassword1">Password</label>
        <div class="col-9">
        <input type="password" class="form-control" id="exampleInputPassword1">
        </div>
        </div>
        <div class="form-group form-check">
        <input type="checkbox" class="form-check-input" id="exampleCheck1">
        <label class="form-check-label" for="exampleCheck1">Check me out</label>
        </div>
        <button type="submit" class="btn btn-primary">Submit</button>
        </form>
                    
                  
Vertical Form
Show Code
We'll never share your email with anyone else.
                    
        <form>
        <div class="form-group">
        <label for="exampleInputEmail1">Email address</label>
        <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
        <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
        </div>
        <div class="form-group">
        <label for="exampleInputPassword1">Password</label>
        <input type="password" class="form-control" id="exampleInputPassword1">
        </div>
        <div class="form-group form-check">
        <input type="checkbox" class="form-check-input" id="exampleCheck1">
        <label class="form-check-label" for="exampleCheck1">Check me out</label>
        </div>
        <button type="submit" class="btn btn-primary">Submit</button>
        </form>
                    
                  
Form Controls
Show Code
                    
        <form>
        <div class="form-group">
        <label for="exampleFormControlInput1">Email address</label>
        <input type="email" class="form-control" id="exampleFormControlInput1" placeholder="[email protected]">
        </div>
        <div class="form-group">
        <label for="exampleFormControlSelect1">Example select</label>
        <select class="form-control" id="exampleFormControlSelect1">
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
        </select>
        </div>
        <div class="form-group">
        <label for="exampleFormControlSelect2">Example multiple select</label>
        <select multiple class="form-control" id="exampleFormControlSelect2">
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
        </select>
        </div>
        <div class="form-group">
        <label for="exampleFormControlTextarea1">Example textarea</label>
        <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea>
        </div>
        </form>
                    
                  
Form Element Sizes
Show Code
                    
        <input class="form-control form-control-lg mb-2" type="text" placeholder=".form-control-lg">
        <input class="form-control mb-2" type="text" placeholder="Default input">
        <input class="form-control form-control-sm mb-2" type="text" placeholder=".form-control-sm">
        <select class="form-control form-control-lg mb-2">
        <option>Large select</option>
        </select>
        <select class="form-control mb-2">
        <option>Default select</option>
        </select>
        <select class="form-control form-control-sm mb-2">
        <option>Small select</option>
        </select>
                    
                  
Range Inputs
Show Code
                    
        <form>
        <div class="form-group">
        <label for="formControlRange">Example Range input</label>
        <input type="range" class="form-control-range" id="formControlRange">
        </div>
        </form>
                    
                  
Readonly Plain Text
Show Code
                    
        <form>
        <div class="form-group row">
        <label for="staticEmail" class="col-sm-3 col-form-label">Email</label>
        <div class="col-sm-9">
        <input type="text" readonly class="form-control-plaintext" id="staticEmail" value="[email protected]">
        </div>
        </div>
        </form>
                    
                  
Checkboxes & Radios & Switch
Show Code
Default Switch
                    
        <div class="form-check">
        <input class="form-check-input" type="checkbox" value="" id="defaultCheck1">
        <label class="form-check-label" for="defaultCheck1">
        Default checkbox
        </label>
        </div>
        <div class="form-check">
        <input class="form-check-input" type="checkbox" value="" id="defaultCheck2" disabled>
        <label class="form-check-label" for="defaultCheck2">
        Disabled checkbox
        </label>
        </div>
        <div class="form-check">
        <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios1" value="option1" checked>
        <label class="form-check-label" for="exampleRadios1">
        Default radio
        </label>
        </div>
        <div class="form-check mt-2">
        <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios2" value="option2">
        <label class="form-check-label" for="exampleRadios2">
        Second default radio
        </label>
        </div>
        <div class="form-check">
        <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios3" value="option3" disabled>
        <label class="form-check-label" for="exampleRadios3">
        Disabled radio
        </label>
        </div>
        <div class="form-switch d-flex flex-row align-items-center mt-2">
        <label class="switch">
        <input type="checkbox" data-toggle="code">
        <span class="slider round"></span>
        </label>
        <div class="ml-1">Default Switch</div>
        </div>
                    
                  
Input Group
Show Code
@
@example.com
$
.00
With textarea
                    
        <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>
        <div class="input-group mb-3">
        <input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username" aria-describedby="basic-addon2">
        <div class="input-group-append">
        <span class="input-group-text" id="basic-addon2">@example.com</span>
        </div>
        </div>
        <div class="input-group mb-3">
        <div class="input-group-prepend">
        <span class="input-group-text">$</span>
        </div>
        <input type="text" class="form-control" aria-label="Amount (to the nearest dollar)">
        <div class="input-group-append">
        <span class="input-group-text">.00</span>
        </div>
        </div>
        <div class="input-group">
        <div class="input-group-prepend">
        <span class="input-group-text">With textarea</span>
        </div>
        <textarea class="form-control" aria-label="With textarea"></textarea>
        </div>
                    
                  
Input Group With Button
Show Code
                    
        <div class="input-group mb-3">
        <div class="input-group-prepend">
        <button class="btn btn-outline-dark" type="button" id="button-addon1">Button</button>
        </div>
        <input type="text" class="form-control" placeholder="" aria-label="Example text with button addon" aria-describedby="button-addon1">
        </div>
        <div class="input-group mb-3">
        <input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username" aria-describedby="button-addon2">
        <div class="input-group-append">
        <button class="btn btn-outline-dark" type="button" id="button-addon2">Button</button>
        </div>
        </div>
        <div class="input-group mb-3">
        <div class="input-group-prepend">
        <button class="btn btn-outline-dark" type="button" id="button-addon1">Button</button>
        </div>
        <input type="text" class="form-control" placeholder="" aria-label="Example text with button prepend and append addon" aria-describedby="button-addon2">
        <div class="input-group-append">
        <button class="btn btn-outline-dark" type="button" id="button-addon2">Button</button>
        </div>
        </div>
        <div class="input-group mb-3">
        <div class="input-group-prepend" id="button-addon3">
        <button class="btn btn-outline-dark" type="button">Button</button>
        <button class="btn btn-outline-dark" type="button">Button</button>
        </div>
        <input type="text" class="form-control" placeholder="" aria-label="Example text with two button addons" aria-describedby="button-addon3">
        </div>
        <div class="input-group">
        <input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username with two button addons" aria-describedby="button-addon4">
        <div class="input-group-append" id="button-addon4">
        <button class="btn btn-outline-dark" type="button">Button</button>
        <button class="btn btn-outline-dark" type="button">Button</button>
        </div>
        </div>
                    
                  
Validation
Show Code
Looks good!
Looks good!
Please provide a valid city.
Please select a valid state.
Please provide a valid zip.
You must agree before submitting.
                    
        <form>
        <div class="form-row">
        <div class="col-md-6 mb-3">
        <label for="validationServer01">First name</label>
        <input type="text" class="form-control is-valid mt-2" id="validationServer01" value="Mark" required>
        <div class="valid-feedback">
        Looks good!
        </div>
        </div>
        <div class="col-md-6 mb-3">
        <label for="validationServer02">Last name</label>
        <input type="text" class="form-control is-valid mt-2" id="validationServer02" value="Otto" required>
        <div class="valid-feedback">
        Looks good!
        </div>
        </div>
        </div>
        <div class="form-row">
        <div class="col-md-6 mb-3">
        <label for="validationServer03">City</label>
        <input type="text" class="form-control is-invalid mt-2" id="validationServer03" required>
        <div class="invalid-feedback">
        Please provide a valid city.
        </div>
        </div>
        <div class="col-md-3 mb-3">
        <label for="validationServer04">State</label>
        <select class="custom-select is-invalid mt-2" id="validationServer04" required>
        <option selected disabled value="">Choose...</option>
        <option>...</option>
        </select>
        <div class="invalid-feedback">
        Please select a valid state.
        </div>
        </div>
        <div class="col-md-3 mb-3">
        <label for="validationServer05">Zip</label>
        <input type="text" class="form-control is-invalid mt-2" id="validationServer05" required>
        <div class="invalid-feedback">
        Please provide a valid zip.
        </div>
        </div>
        </div>
        <div class="form-group">
        <div class="form-check">
        <input class="form-check-input is-invalid" type="checkbox" value="" id="invalidCheck3" required>
        <label class="form-check-label" for="invalidCheck3">
        Agree to terms and conditions
        </label>
        <div class="invalid-feedback">
        You must agree before submitting.
        </div>
        </div>
        </div>
        <button class="btn btn-primary" type="submit">Submit form</button>
        </form>