Skip to content

docs(gallery): add documentation for new gallery component#4484

Open
brandyscarney wants to merge 19 commits intomajor-9.0from
FW-7287
Open

docs(gallery): add documentation for new gallery component#4484
brandyscarney wants to merge 19 commits intomajor-9.0from
FW-7287

Conversation

@brandyscarney
Copy link
Copy Markdown
Member

@brandyscarney brandyscarney commented Apr 30, 2026

⚠️ All instances of the dev build must be removed or updated before merging. ⚠️

Adds documentation & playgrounds for the new ion-gallery component.

Preview

Note: when opening the basic usage or masonry images examples in StackBlitz the img URL must be changed from https://ionicframework.com/ to https://ionic-docs-git-fw-7287-ionic1.vercel.app to load the images.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 2026

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

Project Deployment Actions Updated (UTC)
ionic-docs Ready Ready Preview, Comment May 5, 2026 8:05pm

Request Review

Comment thread docs/components.md
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 chose to add this under "Grids" because otherwise we would need to redo the component page to either add a new image for a top-level Gallery section or to add something like "Layout" which would reorder a few of them. I can change this if we want to categorize this differently.

}

let npmTag = 'latest';
let npmTag = '8.8.6-dev.11777569278.1613db2e';
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.

We need to actually merge this with a dev build otherwise the docs build will fail since Gallery only exists on the dev build.

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 don't love this location of images used by the demos but other demos use this as well so I followed the existing structure.

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.

Do have a preferred folder structure that you would like to use?

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 would prefer to keep the images under the component's folder like this:

static
└── usage
    └── v9
        └── gallery
            └── assets
               |── 01.png 
               |── 02.png 
               |── 03.png 
               |── ...
               |── 10.png 
               |── 11.png 
               └── 12.png

But I am not going to try to refactor how this is currently working.

</ion-header>
<ion-content class="ion-padding">
<ion-gallery>
<img src="https://ionicframework.com/docs/img/demos/gallery/01.png" alt="Image 1" />
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 am following how other demos include images because the only other way to pass them to StackBlitz is using base64 encoding.

@brandyscarney brandyscarney marked this pull request as ready for review May 1, 2026 19:15
@brandyscarney brandyscarney requested a review from a team as a code owner May 1, 2026 19:15
@brandyscarney brandyscarney removed the request for review from a team May 1, 2026 19:15
@brandyscarney brandyscarney requested a review from OS-jacobbell May 1, 2026 19:15
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.

This looks so good, Brandy! Awesome work!!

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, with minor requested changes

<div>6</div>
</ion-gallery>

<style>
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.

Thoughts on including a comment stating that the styles are for demo only and not needed to get gallery working? The same for the other frameworks.

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.

Comment thread docs/api/gallery.md Outdated
In masonry layouts, top-level `img` elements are given default styles to ensure consistent rendering. These styles make images fill their container while preserving their aspect ratio and keeping them centered.

:::note
Images wrapped in other elements (for example, inside a `figure`) do not inherit these defaults. Apply the same styles to the nested `img` if you want matching behavior.
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.

Could we point them to a permalink of the styles needed on the Ionic Framework repo?

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 don't think this is a good idea because if we update those styles in the future then they will be out of sync here. I included a code block to make it simpler to copy/paste: c2a85bb

Comment thread docs/api/gallery.md
```

## Properties
<Props />
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.

The default value for columns did not render as expected. It just says DEFAULT_COLUMNS. Not sure if that's something we can fix easily or if it should be handle through another PR.

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.

This is just how docs are generated when you set the default to a const. You can see this happens in ion-split-pane too:

The solution would involve updating how Stencil generates these docs.

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.

Do have a preferred folder structure that you would like to use?

Comment thread static/usage/v9/gallery/basic/vue.md Outdated
Comment thread static/usage/v9/gallery/columns/vue.md Outdated
Comment thread static/usage/v9/gallery/masonry-best-fit/vue.md Outdated
Comment thread static/usage/v9/gallery/masonry-sequential/vue.md Outdated
Comment thread sidebars.js
label: 'Grids',
collapsed: false,
items: ['api/grid', 'api/col', 'api/row'],
items: ['api/grid', 'api/col', 'api/row', 'api/gallery'],
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.

Is it intentional to not have it alphabetical?

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.

Yes because the main documentation (including playgrounds) for grid is in ion-grid and we always want to highlight the main documentation first. Grid is a bit of a weird one because it doesn't prefix all of its components with ion-grid-* like other components (card, fab, item, etc) do:

CleanShot 2026-05-05 at 14 48 06@2x

If it did this would look less weird. But when you navigate from the components page it would look even weirder to land in the middle here:

CleanShot 2026-05-05 at 14 51 22@2x

@thetaPC
Copy link
Copy Markdown
Contributor

thetaPC commented May 5, 2026

@brandyscarney I did notice that Firefox doesn't load the images even after changing the URL. I assume that it's something out of our scope but just wanted to let you know as a heads up.

Screenshot 2026-05-05 at 10 49 43 AM

@brandyscarney
Copy link
Copy Markdown
Member Author

@thetaPC I confirmed that the same issue happens on the Cards example on Firefox so this seems to be a sitewide issue.

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.

3 participants