Skip to content

feat(gallery): add new gallery component#31101

Merged
brandyscarney merged 42 commits into
nextfrom
FW-7280
May 13, 2026
Merged

feat(gallery): add new gallery component#31101
brandyscarney merged 42 commits into
nextfrom
FW-7280

Conversation

@brandyscarney
Copy link
Copy Markdown
Member

@brandyscarney brandyscarney commented Apr 29, 2026

Issue number: internal


What is the current behavior?

Developers who want to use a masonry layout must rely on third-party solutions or implement their own.

What is the new behavior?

Adds a new ion-gallery component.

Features

  • layout property:
    • uniform - evenly sized grid rows
    • masonry - stacked masonry layout
  • order property (masonry only):
    • sequential - preserves DOM order
    • best-fit - places items in the shortest column
  • columns property:
    • Accepts number or string values
    • Supports responsive values by breakpoint (xs, sm, md, lg, xl, xxl)
    • Validates invalid inputs and falls back to defaults with printIonWarning
    • Breakpoint objects with no xsxxl values (e.g. {} or only mistyped keys) are treated as invalid and warned
  • gap property:
    • Same validation and warning behavior as columns for scalar values and breakpoint maps (including empty / non-matching maps)

Test Coverage

  • E2E (basic): uniform layout with images, including breakpoint screenshots
  • E2E (layout): uniform and masonry layouts across various div and image scenarios
  • Spec tests
    • columns / gap fallback, normalization, and invalid breakpoint maps (including empty objects and maps with only unrecognized keys)
    • layout / masonry scheduling and load-event behavior
    • order placement logic (sequential and best-fit)

Does this introduce a breaking change?

  • Yes
  • No

Other information

Basic Preview
Layout Preview

Dev build: 8.8.7-dev.11778680417.1f9234bd

@brandyscarney brandyscarney requested a review from a team as a code owner April 29, 2026 15:53
@brandyscarney brandyscarney requested a review from thetaPC April 29, 2026 15:53
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment May 13, 2026 6:45pm

Request Review

@brandyscarney brandyscarney marked this pull request as draft April 29, 2026 15:53
@github-actions github-actions Bot added package: core @ionic/core package package: angular @ionic/angular package package: vue @ionic/vue package package: react @ionic/react package labels Apr 29, 2026
Comment thread .vercelignore
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I updated this because this rule prevented the images in my assets/ directory from being served on Vercel.

// --------------------------------------------------

:host(.gallery-layout-uniform) {
gap: var(--ion-gallery-gap, 16px);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Gap currently can only be changed by CSS. Should this be a property that can be updated based on breakpoint, like columns?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, I lean towards it especially seeing that Chakra does that. I do wonder if we should split it into row-gap and column-gap but we can cross that bridge if we get a request for it so gap works for me.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added support for gap here: d494fab

I think if we wanted to support column & row we could just make it accept two values rather than doing two separate properties. I don't know, something to consider later.

Comment thread core/src/components/gallery/test/basic/gallery.e2e.ts
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We need to figure out the file structure. We have some files that separate by periods (gallery.spec.ts) and other by hyphens (gallery-interface.ts). Currently, ionic-modular is converting the interface files to periods (gallery-interface.ts -> gallery.interface.ts)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think it's fine to separate them with periods. I was just following the interface naming.

Comment thread core/src/components/gallery/test/layout/index.html
Comment thread core/src/components/gallery/gallery.tsx
Copy link
Copy Markdown
Contributor

@thetaPC thetaPC left a comment

Choose a reason for hiding this comment

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

LGTM, awesome work!

Copy link
Copy Markdown
Member

@ShaneK ShaneK left a comment

Choose a reason for hiding this comment

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

Looks good to me! I had some nits/questions, but I don't consider them blocking honestly. Just food for thought, I guess

Comment thread core/src/components/gallery/gallery.tsx Outdated
Comment thread core/src/components/gallery/gallery.tsx
Comment thread core/src/components/gallery/gallery.tsx
@brandyscarney brandyscarney merged commit d38f927 into next May 13, 2026
99 of 141 checks passed
@brandyscarney brandyscarney deleted the FW-7280 branch May 13, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: angular @ionic/angular package package: core @ionic/core package package: react @ionic/react package package: vue @ionic/vue package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants