Skip to content

feat(card): align component with fusion design system - FE-7266 - #8073

Open
DipperTheDan wants to merge 9 commits into
masterfrom
FE-7266_card-ds-audit
Open

feat(card): align component with fusion design system - FE-7266#8073
DipperTheDan wants to merge 9 commits into
masterfrom
FE-7266_card-ds-audit

Conversation

@DipperTheDan

Copy link
Copy Markdown
Contributor

Proposed behaviour

Align component with Fusion Design System.

Current behaviour

Component is out of date with the latest Fusion Design System.

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

N/A

Testing instructions

Component should match designs and specs provided in the ticket.

}

const paddingSizes = {
none: "var(--spacing000)",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have used the old DS tokens here to conform with the other spacing values in the declaration. This component is being deprecated too.

@DipperTheDan
DipperTheDan force-pushed the FE-7266_card-ds-audit branch from a315f35 to 6458f6b Compare July 10, 2026 13:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

  • Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.

Pull request overview

Aligns the Card component implementation, styles, stories, and tests with the Fusion Design System by moving to new spacing/radius/depth tokens, introducing new API surface (cardType, header, draggableAccessory), and deprecating legacy subcomponents/props.

Changes:

  • Updated Card styling to use Fusion tokens (new spacing options, new roundness tokens/aliases, new depth tokens, updated content border-radius behavior with header/footer).
  • Added/updated APIs and examples (cardType, header, draggableAccessory, draggable layout row), and deprecated legacy pieces (CardRow, CardColumn, CardFooter variant, custom boxShadow props).
  • Refreshed Storybook stories/MDX docs and unit/Playwright tests to match the new design + behavior.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/components/card/components.test-pw.tsx Updated Playwright component examples to new Card composition patterns (Box + Typography, new Button import).
src/components/card/card.test.tsx Updated and expanded unit tests for new roundness tokens, draggable accessory, cardType shadows, extra-small spacing behavior.
src/components/card/card.style.ts Migrated Card styling to Fusion tokens; added header-aware border radius logic and a draggable row style.
src/components/card/card.stories.tsx Reworked stories to match new layout and tokens; added new stories (without footer, spacing variants, draggable).
src/components/card/card.mdx Updated docs to reference new/added stories and updated roundness/draggable documentation.
src/components/card/card.config.ts Expanded allowed spacing values to include none and extra-small.
src/components/card/card.component.tsx Added cardType, header, draggableAccessory; updated defaults and draggable rendering structure.
src/components/card/card-test.stories.tsx Updated test stories and added focused-state stories for Chromatic coverage.
src/components/card/card-row/card-row.test.tsx Updated strict-context error message expectation.
src/components/card/card-row/card-row.style.ts Added support for none and extra-small spacing.
src/components/card/card-row/card-row.component.tsx Marked CardRow as deprecated.
src/components/card/card-footer/card-footer.test.tsx Updated strict-context error message expectation and roundness expectations.
src/components/card/card-footer/card-footer.style.ts Updated margin sizing and border-radius tokens to Fusion equivalents.
src/components/card/card-footer/card-footer.component.tsx Marked variant prop as deprecated.
src/components/card/card-column/card-column.component.tsx Marked CardColumn as deprecated.
src/components/card/internal/card.context.ts Updated roundness type/default and strict-context error message.
skills/carbon-react/index.md Content excluded by policy; not reviewed.
skills/carbon-react/components/card.md Content excluded by policy; not reviewed.
skills/carbon-react/components/card-row.md Content excluded by policy; not reviewed.
skills/carbon-react/components/card-footer.md Content excluded by policy; not reviewed.
skills/carbon-react/components/card-column.md Content excluded by policy; not reviewed.
Files excluded by content exclusion policy (5)
  • skills/carbon-react/components/card-column.md
  • skills/carbon-react/components/card-footer.md
  • skills/carbon-react/components/card-row.md
  • skills/carbon-react/components/card.md
  • skills/carbon-react/index.md

Comment thread src/components/card/card.style.ts Outdated
Comment thread src/components/card/card.style.ts Outdated
Comment thread src/components/card/card.style.ts
Comment thread src/components/card/card.style.ts
Comment thread src/components/card/components.test-pw.tsx Outdated
Comment thread src/components/card/__internal__/card.context.ts
Comment thread src/components/card/card-footer/card-footer.style.ts Outdated
expect(cardFooterElement).toHaveStyleRule(
"border-bottom-left-radius",
`var(--borderRadius${roundness === "default" ? "1" : "2"}00)`,
roundness === "moderate"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I'd add these respective values into the .each test params as we should really avoid conditions like these in tests

Comment thread src/components/card/card.component.tsx Outdated
Comment thread src/components/card/card.component.tsx Outdated
Comment thread src/components/card/card.pw.tsx
Comment thread src/components/card/card.style.ts Outdated
@edleeks87
edleeks87 self-requested a review July 16, 2026 06:35

@edleeks87 edleeks87 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @DipperTheDan out of interest do we know if the deprecated sub-components still work with the updates? Might be worth adding something so we know we aren't about to break everything for everyone

Comment thread src/components/card/card-footer/card-footer.style.ts Outdated
Comment thread src/components/card/card.component.tsx Outdated
rel,
target,
"aria-label": ariaLabel,
cardType = "standard",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: we could use variant here so we're consistent with how we've done this type of thing in other components

Comment thread src/components/card/card.style.ts Outdated

${({ roundness, hasFooter }) => css`
${roundness === "default" &&
${({ roundness, $hasHeader, $hasFooter }) => css`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
${({ roundness, $hasHeader, $hasFooter }) => css`
${({ $roundness, $hasHeader, $hasFooter }) => css`

Nice one for making the others non-transitive

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bump

@DipperTheDan

Copy link
Copy Markdown
Contributor Author

Nice work @DipperTheDan out of interest do we know if the deprecated sub-components still work with the updates? Might be worth adding something so we know we aren't about to break everything for everyone

Yeah, the old card-row and card-column still work. I hadn't documented any examples as I removed the deprecated components from the examples. What I'll do though is make some examples with deprecated card-row and card-column components and house the examples in the test folder. I'll make sure they're snapshotted with Chromatic too.

tomdavies73
tomdavies73 previously approved these changes Jul 21, 2026
edleeks87
edleeks87 previously approved these changes Jul 21, 2026
@DipperTheDan
DipperTheDan marked this pull request as ready for review July 21, 2026 14:25
@DipperTheDan
DipperTheDan requested review from a team as code owners July 21, 2026 14:25
@ljemmo

ljemmo commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

@DipperTheDan I've reviewed your build and these are the elements i found that need actioning:

  • Border color and border size etc is applied whereas i can't see any border in the card figma spec.
  • Top border color on card footer should bevar(--container-action-border-default). Currently its pointed to standard group as above.
  • The card BG token is currently pointing to the standard set. It should be consuming the action set. {container.action.bg-default}. This is an error on our side (sorry about that! - i've fixed in figma)
  • Footer appears to be consuming legacy border radius tokens: var(--borderRadius000). These need replacing with new global rad tokens.
  • The drag cursor appears when hovering over the interactive / clickable area of the card. Really this should only appear on the drag handle.
  • on your prop option list for roundness i wonder if we should follow the deprecated warning as above on hover boxshadow? Not initially vert clear that large and default are no longer used.

@DipperTheDan
DipperTheDan marked this pull request as draft July 24, 2026 13:37
@DipperTheDan
DipperTheDan force-pushed the FE-7266_card-ds-audit branch from 530e671 to ca45e7e Compare July 24, 2026 14:51
@DipperTheDan
DipperTheDan marked this pull request as ready for review July 29, 2026 08:32
ljemmo
ljemmo previously approved these changes Aug 5, 2026
@DipperTheDan
DipperTheDan marked this pull request as draft August 5, 2026 12:04
tomdavies73
tomdavies73 previously approved these changes Aug 5, 2026
Comment thread src/components/card/card.style.ts Outdated

${({ roundness, hasFooter }) => css`
${roundness === "default" &&
${({ roundness, $hasHeader, $hasFooter }) => css`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bump

```


### Playground

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: we should remove these from the skills files as they're not much use if you can't interact with them etc. Happy for it to be done as separate ticket if you don't mind raising it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do it as part of #8110

@DipperTheDan
DipperTheDan marked this pull request as ready for review August 6, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

5 participants