Skip to main content
Validation failures always surface as a FieldError[], both in-flight on onChange.errors and at submit time on onError.fieldErrors. Reuse one renderer across both surfaces.

Shape

field

Identifies which input inside the element failed. Bucket errors by field to render them next to the matching input.

code

Common codes: code is not part of a closed union; new codes may be added. Prefer rendering message and switching on code only when you have a specific behavior tied to a specific failure.

message

Already localized and shopper-safe. Render it as-is next to the input, in an inline error slot, or in a summary.

source (Checkout only)

Every Checkout-emitted FieldError carries a source string identifying which slot of the value envelope the field belongs to:
  • 'contact' for email, full name, phone, and company name.
  • 'billingAddress' for the billing-address atoms.
  • 'shippingAddress' for the shipping-address atoms (when the slot is configured).
  • 'paymentMethod' for card, bank, and wallet fields.
  • 'customElement' for any configured custom-element slot.
source maps 1:1 to top-level keys on CheckoutElementValue. Bucket errors by source to render them in the right section of your form.
Standalone elements never set source; use field directly.

Example renderer

See also

Last modified on July 22, 2026