Skip to content

CardLayout: vertical alignment via flex-col - #160

Merged
pglevy merged 2 commits into
mainfrom
card-vertical-alignment
Jul 21, 2026
Merged

CardLayout: vertical alignment via flex-col#160
pglevy merged 2 commits into
mainfrom
card-vertical-alignment

Conversation

@pglevy

@pglevy pglevy commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

CardLayout now uses flex flex-col internally so that children can pin footer content to the bottom using mt-auto. This solves the common pattern of cards in a row with variable content length where footers (buttons, prices, actions) should align at the same vertical position.

Changes

  • CardLayout.tsx: Added flex flex-col to the outer card div and flex-1 flex flex-col to the inner content wrapper
  • Card.stories.tsx: Added VerticalAlignment story showing food-menu and pricing-card patterns

Usage

<div className="grid grid-cols-3 gap-4">
  <CardLayout padding="STANDARD" showBorder={true}>
    <h3>Title</h3>
    <p>Variable length content...</p>
    <div className="mt-auto pt-4">
      <button>Action</button>
    </div>
  </CardLayout>
</div>

No new props needed. For AUTO-height cards (default), this has zero visual effect.

Closes #110

@pglevy pglevy self-assigned this Jul 21, 2026
CardLayout now uses flex flex-col on the outer div and flex-1 flex flex-col
on the inner content wrapper. This lets children use mt-auto to pin footer
content to the bottom when cards stretch to equal height in a row.

No new props required — just add mt-auto to your footer element.

Added VerticalAlignment story demonstrating food-menu and pricing-card patterns.

Closes #110
@pglevy
pglevy force-pushed the card-vertical-alignment branch from 811314c to f3e3084 Compare July 21, 2026 19:56
@pglevy
pglevy merged commit 712da04 into main Jul 21, 2026
3 checks passed
@pglevy
pglevy deleted the card-vertical-alignment branch July 21, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Card doesn't handle vertical justification well by default

1 participant