Skip to content

refactor(gallery): migrate to modular theming - #31612

Open
brandyscarney wants to merge 3 commits into
FW-7286-gallery-itemfrom
FW-7286-gallery
Open

brandyscarney wants to merge 3 commits into
FW-7286-gallery-itemfrom
FW-7286-gallery

Conversation

@brandyscarney

@brandyscarney brandyscarney commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Issue number: internal


What is the current behavior?

ion-gallery reads the theme and adds it as a class on its host, and its gap is hardcoded to 16px in both the gap prop default and the stylesheet, so a theme can't change it.

What is the new behavior?

  • Migrates ion-gallery to Modular Ionic: removes the theme virtual prop and the theme class on the host.
  • Adds IonGalleryRecipe with a gap token, exposed as --ion-gallery-gap. The ionic, ios and md themes set it to var(--ion-spacing-lg) (16px), so the default gap doesn't change.
  • gap no longer defaults to '16px'. When it's unset, invalid, or a breakpoint map leaves out the active breakpoint, the gallery uses the theme's gap. A gap value still overrides the theme.
  • Removes the 16px fallbacks on --internal-gallery-gap in gallery.scss and gallery-item.scss, so masonry items also use the theme's gap for the space between stacked items.
  • Renames gallery-interface.ts to gallery.interface.ts and gallery-constants.ts to gallery.constant.ts, and renames the exported types to IonGalleryColumns, IonGalleryGap and IonGalleryBreakpointValues. DEFAULT_GAP is removed.
  • Adds spec and e2e tests for the theme's gap: when gap is unset, for breakpoints a gap map doesn't set, and in each theme.

Does this introduce a breaking change?

  • Yes
  • No

ion-gallery hasn't been in a release yet, so removing theme, renaming the types and changing the gap default aren't breaking.

Other information

ion-gallery-item has no recipe because its stylesheet only has layout rules. The masonry spacing between its items comes from the gallery's gap.

How to test

Check Before After What to look for
Basic gallery-item PR this PR A grid of colored square tiles. The 16px gap between tiles should match.
Layouts gallery-item PR this PR Uniform items stay square. Masonry items stack with even gaps and no gap under the last item in each column.
Wrapper gallery-item PR this PR Items wrapped in <figure> line up with the others and keep the same size and gap.
Theme's gap this PR In the console, run document.querySelector('ion-gallery').style.setProperty('--ion-gallery-gap', '40px'). The gap on the first gallery should grow to 40px.

Swap ionic:theme and ionic:mode to ios or md to check the other themes.

@brandyscarney
brandyscarney added this pull request to stack #31613 October 20, 2026 19:28
@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
ionic-framework Ready Ready Preview Oct 20, 2026 8:00pm UTC

Request Review

@brandyscarney
brandyscarney marked this pull request as ready for review October 20, 2026 20:28
@brandyscarney
brandyscarney requested a review from a team as a code owner October 20, 2026 20:28
@brandyscarney
brandyscarney requested a review from thetaPC October 20, 2026 20:28

This branch was successfully deployed

1 active deployment
Preview — 406983cc Deployed Oct 20, 2026 by vercel[bot]
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant