Skip to content

docs: add responsive Grid columns example based on the grid's width - #6199

Merged
vursen merged 4 commits into
mainfrom
docs/grid-responsive-columns
Sep 29, 2026
Merged

vursen merged 4 commits into
mainfrom
docs/grid-responsive-columns

Conversation

@totally-not-ai

@totally-not-ai totally-not-ai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Adds an example to the Column Visibility part of articles/components/grid/columns.adoc. It hides the individual columns and shows a single combined column when the Grid is narrow, and switches back when it's wide.

The example is available for all three frameworks and renders inside a Split Layout, so readers can drag the handle to resize the Grid:

  • Flow (GridResponsiveColumns.java): reacts to the Grid's own size through getElement().sizeSignal() inside a Signal.effect. A width of 0 (before the browser reports the size) is treated as wide.
  • Lit (grid-responsive-columns.ts) and React (react/grid-responsive-columns.tsx): use a ResizeObserver on the Grid.
  • A note explains that the Flow size signal starts at 0, so the layout can briefly flash, and mentions the window size signal as an alternative with a known initial value.
  • frontend/demo/example-resources.ts imports ElementResize.js as a temporary workaround for Element.sizeSignal() and other browser helpers don't work in embedded web components flow#26041, so the size signal works in exported demos.

This change was split out of #6184.

🤖 Generated with Claude Code

Show how to adjust column visibility based on the browser window width,
checking it on attach and on window resize.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
totally-not-ai Bot added a commit that referenced this pull request Sep 29, 2026
It's now proposed in #6199.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Preview Deployment

This PR has been deployed for preview.

URL: https://docs-preview-pr-6199.fly.dev

Changed pages

Added content is highlighted in green; removed content is marked in red on each page.

Built from 0b7228d

@vursen
vursen self-requested a review September 29, 2026 10:13
Use Element.sizeSignal() in the Flow example instead of a window resize
listener, add Lit and React versions based on ResizeObserver, render all
three live inside a split layout, and load ElementResize.js on the docs
page because the embedded web component bootstrap does not include it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vursen
vursen force-pushed the docs/grid-responsive-columns branch from 03e4b72 to 62caaf4 Compare September 29, 2026 11:00
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vursen
vursen marked this pull request as ready for review September 29, 2026 11:12
@vursen

vursen commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

@totally-not-ai update the PR title and description to match the latest changes

@totally-not-ai totally-not-ai Bot changed the title docs: add responsive Grid columns example docs: add responsive Grid columns example based on the grid's width Sep 29, 2026
@vursen
vursen merged commit ebd1371 into main Sep 29, 2026
9 of 10 checks passed
@vursen
vursen deleted the docs/grid-responsive-columns branch September 29, 2026 11:22
@totally-not-ai

Copy link
Copy Markdown
Contributor Author

@vursen Updated the title and description to match the latest changes. The example now responds to the Grid's own width (size signal in Flow, ResizeObserver in Lit and React) instead of the window width, covers all three frameworks in a Split Layout demo, and includes the note on the initial zero size and the ElementResize.js workaround for vaadin/flow#26041.

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.

1 participant