Checkout
Checkout form patterns with single-page, split layout, and multi-step flows. Accessible and secure payment form designs.
Overview
Checkout forms are critical for e-commerce success. These patterns demonstrate best practices for collecting shipping and payment information while maintaining user trust and a smooth experience using Vanilla Breeze components.
Key features:
<fieldset>with<legend>for semantic grouping of related fields<form-field>for consistent input styling and validationdata-layout="sidebar"with<main>and<aside>for order summary placementdata-layout="split"for side-by-side fields (city/state, expiry/CVC)data-layout="cluster"for inline elements (security note, summary rows)<icon-wc name="lock">for security indicators- Proper
autocompleteattributes for address and payment autofill inputmode="numeric"for mobile keyboard optimization
Single-Page Checkout
A complete checkout form on a single page, using <fieldset> to group contact, shipping, and payment sections. Centered with data-layout="center" and wrapped in a <layout-card> for visual containment. Ideal for simpler purchases or when you want to minimize steps.
Fieldset Styles
VB provides native <fieldset> styling (border, radius, padding, legend formatting). These overrides increase the padding and legend font size for a more spacious checkout layout:
Split Layout with Order Summary
A two-column layout using data-layout="sidebar" with the checkout form in a <main> and an order summary <aside>. The sidebar layout automatically recognizes these semantic elements for content vs sidebar sizing. Order items use data-layout="cluster" for label/price pairs and data-layout="stack" for item details. Native <hr> elements provide visual dividers.
Order Summary Styles
Layout is handled entirely by data-layout attributes. These styles cover only visual concerns (font sizes, weights, and colors):
Multi-Step Checkout
A wizard-style checkout flow with a visual step indicator. Breaks the checkout into Shipping, Payment, and Review steps. Uses data-layout="cluster" for the progress indicator. Reduces cognitive load by focusing on one section at a time.
Step Indicator
The step indicator uses nav.steps from VB core — no custom CSS needed. See the Steps pattern for all variants and customization.
Configuration
Key configuration options for checkout forms:
| Element/Attribute | Purpose | Options |
|---|---|---|
fieldset + legend |
Group related fields semantically | Contact, Shipping, Payment sections |
data-layout="split" |
Side-by-side form fields | City/State, Expiry/CVC pairs |
data-layout="sidebar" |
Two-column layout with order summary | Uses <main> (content) + <aside> (sidebar) |
inputmode="numeric" |
Mobile numeric keyboard | Card number, CVC, ZIP code |
autocomplete |
Enable browser/payment autofill | cc-number, cc-exp, cc-csc, street-address |
maxlength |
Limit input length | CVC: 4, ZIP: 10 |
Usage Notes
PCI Compliance
- Never store raw credit card numbers on your server
- Use a payment processor (Stripe, Braintree, etc.) with hosted fields or tokenization
- These patterns show the form structure; actual payment handling requires integration with a PCI-compliant payment gateway
- Display security indicators (lock icon, "encrypted" messaging) to build user trust
Address Autofill
- Use proper
autocompletevalues:street-address,address-level2(city),address-level1(state),postal-code,country-name - Consider integrating address verification services (Google Places, SmartyStreets) for accuracy
- Support international addresses with flexible field requirements
Same Billing/Shipping Address
- Add a checkbox "Billing address same as shipping" to reduce form fields
- Show/hide billing address section based on checkbox state
- Pre-populate billing fields when checkbox is unchecked
Form Validation
- Validate card numbers with Luhn algorithm
- Check expiration date is in the future
- Validate ZIP/postal codes based on selected country
- Show inline validation errors using
<output class="error">
Accessibility
<fieldset>and<legend>provide semantic grouping for screen readers- All inputs have associated labels
- Error messages linked via
aria-describedby - Step indicator uses
aria-current="step"for current step - Progress is announced with descriptive step text (e.g., "Step 1 of 3: Shipping")
Related
Steps
Step indicator CSS pattern used in multi-step checkout
Registration
Sign up forms with multi-step flows
Form Field
Form field element with validation
Layout Sidebar
Sidebar layout for split designs
Icon
Icon component for security indicators