Skip to content

feat: refactor Columns to support container query-based sizing#220

Merged
brandonmcconnell merged 11 commits intomainfrom
brandon/update-card-to-include-layout-prop--minimal-change
Mar 18, 2026
Merged

feat: refactor Columns to support container query-based sizing#220
brandonmcconnell merged 11 commits intomainfrom
brandon/update-card-to-include-layout-prop--minimal-change

Conversation

@brandonmcconnell
Copy link
Contributor

@brandonmcconnell brandonmcconnell commented Mar 18, 2026

Summary

Adds container query support to the Columns component, enabling it to adjust its layout based on the width of its parent container rather than the viewport.

This change:

  • Implements CSS variables for dynamic column sizing and utilizes Tailwind's container query syntax for responsive layouts.
  • Replaces previous static media query breakpoints with a more flexible container-based approach.
  • Includes a new Storybook example to demonstrate the Columns component's behavior within a container query context.
  • Standardizes the default column count and removes a max-width constraint, enhancing the component's adaptability.

Test Plan

  • Verify the new InsideContainer story in Storybook, observing that the Columns component correctly re-arranges its child elements when the containing div changes width (e.g., by resizing the Storybook canvas or the browser window).
  • Confirm that existing Columns stories still render as expected, maintaining their responsiveness to viewport changes where container queries are not explicitly applied.

Note

Medium Risk
Updates Columns layout logic from fixed breakpoint-based classes to CSS-variable/container-query-driven sizing, which can affect responsive rendering across consuming pages. Risk is moderate and largely visual/layout-related.

Overview
Refactors Columns to size its grid using a --cols CSS variable and Tailwind container-query syntax, replacing the previous hardcoded sm:grid-cols-{n} breakpoint rules and removing the implicit max-width constraint.

Adds a new Storybook story (InsideContainer) demonstrating that Columns can respond to a parent @container width (not just the viewport), and centralizes the default column count via a new DEFAULT_COLS export.

Written by Cursor Bugbot for commit 48a2833. This will update automatically on new commits. Configure here.

Ensure the component can utilize its full allocated width without being restricted by `prose` typography styles, allowing for more flexible layouts.
Update the "static" layout mode to "none" for improved clarity and consistency. This change better communicates that no specific auto-flow behavior is applied, allowing the default grid styling to take precedence.
Remove the `layout` prop and its associated `auto-fill`/`auto-fit` grid logic from the Columns component. This simplifies the component's API and internal implementation, streamlining its responsive behavior to rely on CSS variables and standard grid classes.

Storybook examples and argTypes have been updated to reflect this change, removing the `LayoutModes` story and simplifying the `InsideContainer` story.
Update the `InsideContainer` story to be explicitly resizable and visually distinct, providing a better demonstration of how the Columns component adapts to its parent container's width. Add clarifying JSDoc to guide user interaction.
@brandonmcconnell brandonmcconnell merged commit 5827cb1 into main Mar 18, 2026
2 of 3 checks passed
@brandonmcconnell brandonmcconnell deleted the brandon/update-card-to-include-layout-prop--minimal-change branch March 18, 2026 23:29
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.

2 participants