Skip to content
HTML Templates For Developers

Cardfield — Payment Form UI

A dark card payment form with a live flipping card preview, number grouping, card-type detection, Luhn and expiry checks, and processing and success states.

PremiumVanilla HTMLOne-pageDark theme
Cardfield — Payment Form UI — template preview

Live preview

This is the actual template running in a sandbox, shown at 1280px wide.

Description

Cardfield is a payment form UI on a deep slate canvas. A violet-to-blue card sits beside the form and mirrors every keystroke: the number is grouped and masked, the name and expiry appear as typed, and the card turns over to show the security code whenever that field has focus.

Validation is real, not decorative. The number is checked with the Luhn algorithm, the card type is detected from its prefix and shown as plain text (Visa, Mastercard, Amex, Discover, Diners Club), grouping and the security-code length follow the type, and the expiry must be a real month that has not passed. Errors are written in plain language and tied to their fields.

Pressing Pay shows a processing state and then a receipt-style success screen. A sticky banner and a note beside the button state clearly that no payment is processed, and three demo test numbers fill the form so buyers can see every state. One stylesheet, one script, no dependencies or network requests.

Key features

  • Live card preview that mirrors number, name and expiry as you type
  • Card flips to show the security code while that field is focused
  • Number grouping by card type (4-4-4-4 and Amex 4-6-5)
  • Card type detected from the prefix and shown as text, no logos needed
  • Luhn checksum validation of the card number
  • Expiry parsing with auto slash, month range and past-date checks
  • Security-code length follows the detected type (3 or 4 digits)
  • Pay button with processing spinner and a receipt-style success screen
  • Persistent sticky demo notice plus a note beside the pay button
  • Demo test-number buttons to fill the form, reduced-motion friendly

Front-end template: what is demonstration only

  • No payment is processed: validation and the success receipt run in the browser only, card data is never sent or stored, and the reference number is random.
  • Test card numbers are for demonstration and only satisfy the Luhn check.

What is included

Pages and sections

  • Sticky demo notice
  • Header with brand
  • Headline and flipping card preview
  • Order summary
  • Demo test numbers
  • Card details form
  • Processing state
  • Success receipt

Framework

Plain HTML5, CSS3 and JavaScript. No framework, no build step — open index.html and edit.

Bundled open-source components

  • Space Grotesk typeface (OFL-1.1)
  • Space Mono typeface (OFL-1.1)

Everything is inside the download with its licence. Nothing loads from a CDN.

Supported browsers

Chrome, Edge, Firefox, Safari, Opera

Current versions. Checked in Chromium at desktop, tablet and phone widths.

Files in the download (12) · 76 KB ZIP
  • LICENSE.txt1.7 KB
  • README.md2.5 KB
  • assets/css/style.css13 KB
  • assets/fonts/space-grotesk-LICENSE.txt4.3 KB
  • assets/fonts/space-grotesk-latin-wght-normal.woff222 KB
  • assets/fonts/space-mono-LICENSE.txt4.6 KB
  • assets/fonts/space-mono-latin-400-normal.woff216 KB
  • assets/fonts/space-mono-latin-700-normal.woff216 KB
  • assets/images/favicon.svg493 B
  • assets/js/main.js9.9 KB
  • documentation/index.html11 KB
  • index.html8.3 KB

Includes a README, a documentation page with customisation notes, and the licence text.

Read the documentation

Changelog

  1. Version 1.0.0 Nov 23, 2026Current

    • Initial release.

Licence

Regular Licence. One purchase covers one end product — a website, application or email programme for you or one client. You may modify the template freely; you may not redistribute or resell the template itself. Updates are free.

Read the full licence terms

Customer reviews

No reviews yet. Reviews come only from customers who have downloaded or bought this template.

Write a review