2018-11-05 12:24:55 +01:00
---
layout: examples
title: Checkout example
2019-01-08 17:33:28 +01:00
extra_css:
2020-02-15 20:01:29 +01:00
- "form-validation.css"
2019-01-08 17:33:28 +01:00
extra_js:
2019-06-30 15:24:24 +02:00
- src: "form-validation.js"
2018-11-05 12:24:55 +01:00
body_class: "bg-light"
---
< div class = "container" >
2020-09-10 11:39:29 +02:00
< main >
< div class = "py-5 text-center" >
< img class = "d-block mx-auto mb-4" src = "/docs/{{< param docs_version >}}/assets/brand/bootstrap-logo.svg" alt = "" width = "72" height = "57" >
< h2 > Checkout form< / h2 >
< p class = "lead" > Below is an example form built entirely with Bootstrap’ s form controls. Each required form group has a validation state that can be triggered by attempting to submit the form without completing it.< / p >
2018-11-05 12:24:55 +01:00
< / div >
2020-09-10 11:39:29 +02:00
< div class = "row g-3" >
< div class = "col-md-5 col-lg-4 order-md-last" >
< h4 class = "d-flex justify-content-between align-items-center mb-3" >
< span class = "text-muted" > Your cart< / span >
< span class = "badge bg-secondary rounded-pill" > 3< / span >
< / h4 >
< ul class = "list-group mb-3" >
< li class = "list-group-item d-flex justify-content-between lh-sm" >
< div >
< h6 class = "my-0" > Product name< / h6 >
< small class = "text-muted" > Brief description< / small >
< / div >
< span class = "text-muted" > $12< / span >
< / li >
< li class = "list-group-item d-flex justify-content-between lh-sm" >
< div >
< h6 class = "my-0" > Second product< / h6 >
< small class = "text-muted" > Brief description< / small >
< / div >
< span class = "text-muted" > $8< / span >
< / li >
< li class = "list-group-item d-flex justify-content-between lh-sm" >
< div >
< h6 class = "my-0" > Third item< / h6 >
< small class = "text-muted" > Brief description< / small >
< / div >
< span class = "text-muted" > $5< / span >
< / li >
< li class = "list-group-item d-flex justify-content-between bg-light" >
< div class = "text-success" >
< h6 class = "my-0" > Promo code< / h6 >
< small > EXAMPLECODE< / small >
< / div >
< span class = "text-success" > − $5< / span >
< / li >
< li class = "list-group-item d-flex justify-content-between" >
< span > Total (USD)< / span >
< strong > $20< / strong >
< / li >
< / ul >
< form class = "card p-2" >
< div class = "input-group" >
< input type = "text" class = "form-control" placeholder = "Promo code" >
< button type = "submit" class = "btn btn-secondary" > Redeem< / button >
< / div >
< / form >
< / div >
< div class = "col-md-7 col-lg-8" >
< h4 class = "mb-3" > Billing address< / h4 >
< form class = "needs-validation" novalidate >
< div class = "row g-3" >
< div class = "col-sm-6" >
< label for = "firstName" class = "form-label" > First name< / label >
< input type = "text" class = "form-control" id = "firstName" placeholder = "" value = "" required >
< div class = "invalid-feedback" >
Valid first name is required.
< / div >
2018-01-15 01:06:52 +01:00
< / div >
2019-09-28 16:16:03 +02:00
2020-09-10 11:39:29 +02:00
< div class = "col-sm-6" >
< label for = "lastName" class = "form-label" > Last name< / label >
< input type = "text" class = "form-control" id = "lastName" placeholder = "" value = "" required >
< div class = "invalid-feedback" >
Valid last name is required.
< / div >
2018-01-15 01:06:52 +01:00
< / div >
2020-09-10 11:39:29 +02:00
< div class = "col-12" >
< label for = "username" class = "form-label" > Username< / label >
< div class = "input-group" >
< span class = "input-group-text" > @< / span >
< input type = "text" class = "form-control" id = "username" placeholder = "Username" required >
< div class = "invalid-feedback" >
Your username is required.
< / div >
2019-09-28 16:16:03 +02:00
< / div >
2018-01-15 01:06:52 +01:00
< / div >
2020-09-10 11:39:29 +02:00
< div class = "col-12" >
< label for = "email" class = "form-label" > Email < span class = "text-muted" > (Optional)< / span > < / label >
< input type = "email" class = "form-control" id = "email" placeholder = "you@example.com" >
< div class = "invalid-feedback" >
Please enter a valid email address for shipping updates.
< / div >
2019-09-28 16:16:03 +02:00
< / div >
2018-01-15 01:06:52 +01:00
2020-09-10 11:39:29 +02:00
< div class = "col-12" >
< label for = "address" class = "form-label" > Address< / label >
< input type = "text" class = "form-control" id = "address" placeholder = "1234 Main St" required >
< div class = "invalid-feedback" >
Please enter your shipping address.
< / div >
2019-09-28 16:16:03 +02:00
< / div >
2018-11-05 12:24:55 +01:00
2020-09-10 11:39:29 +02:00
< div class = "col-12" >
< label for = "address2" class = "form-label" > Address 2 < span class = "text-muted" > (Optional)< / span > < / label >
< input type = "text" class = "form-control" id = "address2" placeholder = "Apartment or suite" >
< / div >
2018-11-05 12:24:55 +01:00
2020-09-10 11:39:29 +02:00
< div class = "col-md-5" >
< label for = "country" class = "form-label" > Country< / label >
< select class = "form-select" id = "country" required >
< option value = "" > Choose...< / option >
< option > United States< / option >
< / select >
< div class = "invalid-feedback" >
Please select a valid country.
< / div >
2018-01-15 01:06:52 +01:00
< / div >
2019-09-28 16:16:03 +02:00
2020-09-10 11:39:29 +02:00
< div class = "col-md-4" >
< label for = "state" class = "form-label" > State< / label >
< select class = "form-select" id = "state" required >
< option value = "" > Choose...< / option >
< option > California< / option >
< / select >
< div class = "invalid-feedback" >
Please provide a valid state.
< / div >
2018-01-15 01:06:52 +01:00
< / div >
2019-09-28 16:16:03 +02:00
2020-09-10 11:39:29 +02:00
< div class = "col-md-3" >
< label for = "zip" class = "form-label" > Zip< / label >
< input type = "text" class = "form-control" id = "zip" placeholder = "" required >
< div class = "invalid-feedback" >
Zip code required.
< / div >
2018-01-15 01:06:52 +01:00
< / div >
2018-11-05 12:24:55 +01:00
< / div >
2019-09-28 16:16:03 +02:00
2020-09-10 11:39:29 +02:00
< hr class = "my-4" >
2018-11-05 12:24:55 +01:00
2019-12-20 08:00:49 +01:00
< div class = "form-check" >
2020-09-10 11:39:29 +02:00
< input type = "checkbox" class = "form-check-input" id = "same-address" >
< label class = "form-check-label" for = "same-address" > Shipping address is the same as my billing address< / label >
2018-11-05 12:24:55 +01:00
< / div >
2020-09-10 11:39:29 +02:00
2019-12-20 08:00:49 +01:00
< div class = "form-check" >
2020-09-10 11:39:29 +02:00
< input type = "checkbox" class = "form-check-input" id = "save-info" >
< label class = "form-check-label" for = "save-info" > Save this information for next time< / label >
2018-11-05 12:24:55 +01:00
< / div >
2019-09-28 16:16:03 +02:00
2020-09-10 11:39:29 +02:00
< hr class = "my-4" >
< h4 class = "mb-3" > Payment< / h4 >
< div class = "my-3" >
< div class = "form-check" >
< input id = "credit" name = "paymentMethod" type = "radio" class = "form-check-input" checked required >
< label class = "form-check-label" for = "credit" > Credit card< / label >
< / div >
< div class = "form-check" >
< input id = "debit" name = "paymentMethod" type = "radio" class = "form-check-input" required >
< label class = "form-check-label" for = "debit" > Debit card< / label >
< / div >
< div class = "form-check" >
< input id = "paypal" name = "paymentMethod" type = "radio" class = "form-check-input" required >
< label class = "form-check-label" for = "paypal" > PayPal< / label >
2018-11-05 12:24:55 +01:00
< / div >
< / div >
2019-09-28 16:16:03 +02:00
2020-09-10 11:39:29 +02:00
< div class = "row gy-3" >
< div class = "col-md-6" >
< label for = "cc-name" class = "form-label" > Name on card< / label >
< input type = "text" class = "form-control" id = "cc-name" placeholder = "" required >
< small class = "text-muted" > Full name as displayed on card< / small >
< div class = "invalid-feedback" >
Name on card is required
< / div >
2018-01-15 01:06:52 +01:00
< / div >
2019-09-28 16:16:03 +02:00
2020-09-10 11:39:29 +02:00
< div class = "col-md-6" >
< label for = "cc-number" class = "form-label" > Credit card number< / label >
< input type = "text" class = "form-control" id = "cc-number" placeholder = "" required >
< div class = "invalid-feedback" >
Credit card number is required
< / div >
2018-01-15 01:06:52 +01:00
< / div >
2019-09-28 16:16:03 +02:00
2020-09-10 11:39:29 +02:00
< div class = "col-md-3" >
< label for = "cc-expiration" class = "form-label" > Expiration< / label >
< input type = "text" class = "form-control" id = "cc-expiration" placeholder = "" required >
< div class = "invalid-feedback" >
Expiration date required
< / div >
< / div >
< div class = "col-md-3" >
< label for = "cc-cvv" class = "form-label" > CVV< / label >
< input type = "text" class = "form-control" id = "cc-cvv" placeholder = "" required >
< div class = "invalid-feedback" >
Security code required
< / div >
2018-01-15 01:06:52 +01:00
< / div >
2018-11-05 12:24:55 +01:00
< / div >
2019-09-28 16:16:03 +02:00
2020-09-10 11:39:29 +02:00
< hr class = "my-4" >
2019-09-28 16:16:03 +02:00
2020-09-10 11:39:29 +02:00
< button class = "btn btn-primary btn-lg btn-block" type = "submit" > Continue to checkout< / button >
< / form >
< / div >
2018-01-15 01:06:52 +01:00
< / div >
2020-09-10 11:39:29 +02:00
< / main >
2018-11-05 12:24:55 +01:00
< footer class = "my-5 pt-5 text-muted text-center text-small" >
2020-05-23 17:30:03 +02:00
< p class = "mb-1" > © 2017– {{< year > }} Company Name< / p >
2018-11-05 12:24:55 +01:00
< ul class = "list-inline" >
< li class = "list-inline-item" > < a href = "#" > Privacy< / a > < / li >
< li class = "list-inline-item" > < a href = "#" > Terms< / a > < / li >
< li class = "list-inline-item" > < a href = "#" > Support< / a > < / li >
< / ul >
< / footer >
< / div >