Theme Playground

Commerce

AddressForm

Structured checkout form for collecting shipping or billing address details with optional company, phone, and email fields.

Best for

shipping address collectionbilling formscheckout data entry

Import

import { AddressForm } from "@enadhq/enad-react-sdk/client/storefront"

When to use it

Use AddressForm when checkout needs a complete shipping or billing address surface with consistent labels, validation hooks, and optional business-related fields.

Composition notes

The form is fully controlled through value and onChange. countries switches the country field from free text to a select, while showCompany, showRegion, showPhone, and showEmail let you tune the field set for different markets and checkout flows.

Keep the value shape aligned with your checkout model so server validation can map straight back to field keys such as postalCode and address1. When the market changes the required fields, prefer toggling the optional props instead of forking the whole form markup.

Behavior and theming guidance

Keep validation and persistence outside the component so the form stays tied to the real checkout state. Use errors and labels to localize the experience and make field-level problems obvious.

The form already wires aria-invalid and field-level error descriptions for the text inputs, so the main job is feeding it accurate error messages at the right time. Use className to place the form inside your checkout grid, but keep spacing and field hierarchy consistent so billing and shipping forms still feel related.

Examples

Live examples you can edit directly in the sandbox.

2 examples

Shipping address form

Keep the form controlled from parent state so checkout logic, validation, and persistence stay in one place.

Localized form with field errors

Feed translated labels and server-side validation back into the same controlled form state.

Component Sets

Preview the first example across the available component-set presets to compare tone, spacing, and structural defaults.

Props

PropTypeDefaultDescription
valuePartial<AddressData>
No description yet.
onChange(field: keyof AddressData, value: string) => void
No description yet.
onSubmitstring
No description yet.
errorsstring{}
No description yet.
countriesstring[]
No description yet.
showCompanybooleanfalse
No description yet.
showRegionbooleantrue
No description yet.
showPhonebooleanfalse
No description yet.
showEmailbooleanfalse
No description yet.
classNamestring
No description yet.
labelsstring{}
No description yet.