Skip to content

feat(react-headless-components-preview): add Card component#36005

Merged
dmytrokirpa merged 7 commits intomicrosoft:masterfrom
dmytrokirpa:feat/headless-components-preview-card
Apr 29, 2026
Merged

feat(react-headless-components-preview): add Card component#36005
dmytrokirpa merged 7 commits intomicrosoft:masterfrom
dmytrokirpa:feat/headless-components-preview-card

Conversation

@dmytrokirpa
Copy link
Copy Markdown
Contributor

Summary

Adds a headless Card with CardHeader, CardFooter, and CardPreview subcomponents that wrap the base hooks from @fluentui/react-card.

Depends on

⚠️ Until the prerequisite PR merges, the diff here also includes its commit. Please review that PR first. After it merges, this branch will be rebased to drop the duplicate commit.

Behavior

  • ✅ Selection works end-to-end: selected / defaultSelected / onSelectionChange, the auto-rendered checkbox slot (or floatingAction), aria-labelledby wiring from CardHeader, click & Enter-key toggling, and disabled short-circuiting.
  • focusMode is intentionally omitted from CardProps (Omit<CardBaseProps, 'focusMode'>). Tabster groupper-style Tab-trap semantics (limited / limited-trap-focus / unlimited) cannot be expressed with the WICG focusgroup polyfill the headless package relies on. Consumers can implement equivalent behavior on top of the rendered DOM if needed.

Storybook examples

  • Default — Card composition with header, preview, body, and footer.
  • Selectable — controlled selection driven by the auto-rendered checkbox slot.
  • Disabled — disabled selectable card showing aria-disabled handling and short-circuited toggling.

Verification

  • yarn nx build react-headless-components-preview succeeds (api.md regenerated).
  • yarn nx run react-headless-components-preview:test --testPathPatterns Card — 16/16 pass (isConformant + default render snapshot).

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 19, 2026

📊 Bundle size report

✅ No changes found

@github-actions
Copy link
Copy Markdown

Pull request demo site: URL

@dmytrokirpa dmytrokirpa self-assigned this Apr 19, 2026
@dmytrokirpa dmytrokirpa marked this pull request as draft April 19, 2026 13:34
@dmytrokirpa dmytrokirpa marked this pull request as ready for review April 22, 2026 14:15
@dmytrokirpa dmytrokirpa requested a review from mainframev April 22, 2026 14:15
@dmytrokirpa
Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

@dmytrokirpa dmytrokirpa force-pushed the feat/headless-components-preview-card branch from 5a84fe2 to 00770ba Compare April 27, 2026 14:48
@dmytrokirpa
Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

1 similar comment
@dmytrokirpa
Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

Comment thread packages/react-components/react-headless-components-preview/library/src/card.ts Outdated
Copy link
Copy Markdown
Contributor

@mainframev mainframev left a comment

Choose a reason for hiding this comment

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

@dmytrokirpa should we include specs for all headless components or only where there are more heavy a11y requirements & nuances like Dialog, Popover etc?

Adds a headless Card with CardHeader, CardFooter, and CardPreview
subcomponents that wrap the base hooks from @fluentui/react-card.

Selection works (selected, defaultSelected, onSelectionChange,
auto-rendered checkbox / floatingAction slots, click and Enter
toggling, disabled handling). focusMode is intentionally omitted
from CardProps because tabster groupper-style Tab-trap semantics
cannot be expressed with the WICG focusgroup polyfill the headless
package relies on.

Includes Default, Selectable, and Disabled Storybook examples.
@dmytrokirpa dmytrokirpa force-pushed the feat/headless-components-preview-card branch from 63ed479 to d4c8b51 Compare April 29, 2026 11:12
@dmytrokirpa
Copy link
Copy Markdown
Contributor Author

@dmytrokirpa should we include specs for all headless components or only where there are more heavy a11y requirements & nuances like Dialog, Popover etc?

That's a good question. I added specs for new components such as Dialog, and we should definitely create one for Popover. For now, we can skip specs for simple wrappers around base hooks components and add them later if needed.

@dmytrokirpa dmytrokirpa enabled auto-merge (squash) April 29, 2026 11:36
@dmytrokirpa dmytrokirpa merged commit c13c55c into microsoft:master Apr 29, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants