Skip to content

commerce-ui

@evolve-storefront/commerce-ui · v1.0.0 · Storybook ↗

Presentational components for commerce concepts: an address card, form and address book, a price summary, payment methods and an approval status badge. They take their data as props and fetch nothing, so a feature package or your own page can render them.

Get started

  1. Install the package with the peer dependencies it needs. It comes from the Evolve registry, which needs a one-time sign-in.

    pnpm add @evolve-storefront/commerce-ui next next-intl react
    Requirements5
    @labdigital/graphql-fetcher>=3optional
    graphql>=16optional
    next>=16.2.11 <17
    next-intl>=4
    react>=19
  2. Import its styles in the stylesheet where you load Tailwind. Without them the components render unstyled.

    @import "@evolve-storefront/commerce-ui/styles.css";
  3. Wrap your app in AddressConfigProvider. Setup lists its props.

  4. Add its translations to your message files with evolve messages.

Then render it on a page:

import {
AddressCard,
AddressCardHeader,
AddressCardTitle,
AddressLines,
} from "@evolve-storefront/commerce-ui/address-card";
import { type AddressFields, formatAddressLines, fullName } from "@evolve-storefront/core/address";
export function ShippingAddress({ address, locale }: { address: AddressFields; locale: string }) {
return (
<AddressCard>
<AddressCardHeader>
<AddressCardTitle>{fullName(address)}</AddressCardTitle>
</AddressCardHeader>
<AddressLines lines={formatAddressLines(address, { locale, includeName: false })} />
</AddressCard>
);
}

Components

What you place on your pages. Each one has a preview, its props, and how to change its layout.

Hooks

2 hooks to read and change the data yourself, for when you build your own UI. All hooks

More in this package