Skip to main content

Migrate Card from Polaris React

Choose s-section for a normal page region and the app card pattern when the card itself is a reusable, action-oriented composition. Avoid wrapping every block in a card.


Anchor to Choose the destinationChoose the destination

Polaris ReactPolaris web componentsMigration type
Cards-section or app card patternCompose

Polaris React usagePolaris web componentsMigration notes
Card as a page regions-sectionPreserve the section heading and related controls. Don't add a wrapper only to reproduce a border.
Card as a reusable resource summaryApp card patternMigrate the title, description, metadata, and action as one composition.
Card.Section or custom paddingSeparate sections, s-stack, or s-box paddingSplit only when a region has its own responsibility, and use documented spacing values.

Polaris ReactPolaris web componentsMigration notes
paddingpadding="base" or "none" on s-section, or a supported padding value on s-boxUse s-section padding="none" for edge-to-edge content, then wrap only inset content in s-box padding="base". Don't translate numeric tokens mechanically.
background="subdued"A pattern that owns a subdued surface, or s-box background="subdued" inside the semantic sectionDon't add a background only to reproduce every old card boundary. Keep the section heading and hierarchy clear.
roundedAboveRemoveSection surfaces and App Home patterns own their responsive shape. Don't recreate breakpoint-based corner rounding in app CSS.
childrenSection or pattern contentPreserve heading, actions, and reading order while removing wrappers that existed only for card styling.

Anchor to Migrate the call siteMigrate the call site

  1. Identify each responsibility currently hidden behind Card: layout, semantics, state, actions, and responsive behavior.

  2. Build the documented composition for those responsibilities; don't create a compatibility wrapper that accepts the old API.

  3. Reconnect app state and verify the composition at every existing call site.

  4. After verification, remove the Card import and any Polaris-only state, wrappers, or helpers that no longer have a caller.


Anchor to Preserve these behaviorsPreserve these behaviors

  • Information hierarchy, reading order, and accessible relationships.
  • App-owned state and every action or navigation outcome.
  • Responsive behavior and focus order across the composed elements.

Anchor to Test and remove Polaris ReactTest and remove Polaris React

Test the complete Card composition at each responsive size used by the app. Verify reading and focus order, accessible relationships, keyboard interaction, and every action outcome.

Don't remove @shopify/polaris while another component still imports it. Once all call sites are migrated, remove the package and its provider-level setup, then run the app's full test suite.


Migrating Card

export function CardMigrationExample() {
return (
<><s-section heading="Product details"><s-paragraph>Manage product information.</s-paragraph></s-section></>
);
}
import {Card, Text} from '@shopify/polaris';

export function CardMigrationExample() {
return (
<Card>
<Text as="h2" variant="headingSm">Product details</Text>
<Text as="p">Manage product information.</Text>
</Card>
);
}

Preview


Was this page helpful?