Skip to content

refactor(card): modernize composition model and improve MD3 behavior #4929

Description

@ruben-rebelo

Refactor Card to improve Material Design 3 compliance, remove problematic children patterns, improve performance characteristics, and modernize the public API.

Problems

  • Current API relies heavily on children composition in ways that are difficult to optimize
  • Internal layout logic is tightly coupled to arbitrary child structures
  • MD3 behaviors and visuals are not fully aligned with current Material guidelines
  • Rendering performance can degrade in large lists or frequently updated screens
  • Type safety and discoverability of the API can be improved
  • The component has inconsistent behavior between platforms and edge cases

Focus Areas

  • Reduce dependence on deeply nested children
  • Improve Card.Content / Card.Actions architecture
  • Improve elevation and surface behavior
  • Improve shape and outlined variants
  • Simplify internal spacing rules

Proposed API Direction

Introduce clearer slot-based APIs:
<Card title="Title" subtitle="Subtitle" content={<Text>Content</Text>} actions={[...]} />

Performance Opportunities

  • Reduce nested wrappers
  • Optimize pressable behavior
  • Avoid unnecessary subtree re-renders
  • Improve memoization boundaries

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions