Skip to main content

Gallery

JSThis component requires JavaScript.
Displays a group of images in a carousel layout, allowing users to browse and view images in larger detail.

The Gallery displays a group of images in a carousel layout, allowing users to browse and view images in larger detail. It is ideal for displaying images that have a common theme, such as campus life, academic programs, research, and facilities.

The Gallery includes the Gallery Lightbox experience, allowing users to click an image to view it full-screen.

Examples

The Gallery Selector displays multiple groups of images with titles and descriptions in a carousel layout. It is ideal for displaying images that have a common theme, such as campus life, academic programs, research, and facilities. Each item is a gallery, and the component lets users move between galleries — on narrow viewports, item selection collapses into a dropdown.

Each gallery item can include a title, a description, and a link.

Descriptions and links are optional on each item.

Usage

Dos

  • Use high-quality imagery that aligns to our Photography standards and guidelines, such as images from our Signature Gallery.
  • Include only images that add value, prioritizing the strongest images first.
  • Limit image count — typically 4-12 images total.
  • Write clear and concise image captions that describe what is being shown.
  • Provide clear introductory context on the page so users understand the purpose of the gallery before interacting with it. This might be a heading and paragraph introducing the topic of the gallery.

Don'ts

  • Don't use low-quality images.
  • Don't use groups of logos (e.g., partnerships).
  • Don't overload the gallery with too many images. Users will become disengaged.
  • Don't mix unrelated images that don't belong together conceptually.

Implementation Notes

Slides and image sets

The Gallery Controller takes a slides array, where each slide contains an array of images. This is an array of arrays, since each individual slide can be made up of multiple images. When used inside the Gallery Selector, each gallery item provides its slides through the item's image_slides property.

Slide grid

On wide viewports, the Gallery can display several images at a time on one slide. Each slide is divided into a grid of 12 columns and 6 rows. To place your images in this grid, specify each image's column_start, column_end, row_start, and row_end. These are column and row line numbers using CSS grid syntax, so for an image to span the full height of the slide, you'd specify row_start: 1 and row_end: 7not 6, because 6 is the line number that begins row 6; you specify 7 because you want it to occupy all of the last row. In the rendered HTML, these become the data-grid-column-start, data-grid-column-end, data-grid-row-start, and data-grid-row-end attributes.

Image URLs

Since the Gallery includes the Gallery Lightbox experience, each image specifies a urls.full_size URL for when it's viewed in the full-screen Gallery Lightbox and a urls.thumbnail URL for when it's displayed in the smaller Gallery slide. Make sure the thumbnail image is still large enough to display without exceeding its native size when slotted into the slide grid.

The click-to-open Gallery Lightbox is included by default in the Gallery Controller. When building a gallery directly on top of the Gallery Base, pass with_lightbox: true to include it.

Accessibility

Image captions

Image captions (provided via each image's tooltip) are not a replacement for or duplicate of alt text.

  • Alt text is required and must describe the visual content of the image to a user who cannot see it.
  • Image captions are optional and explain why the image is significant.

Both sets of text are accessible to users of assistive technology, so ensure that they are not repetitive. Image captions should contain only text, and no interactive elements like links or buttons.

For example, for an overhead photo of a library:

Alt text: An overhead view of students working at tables in the Orton Hall library.

Caption: Surrounded by knowledge and famed architecture, Orton Hall is a popular study spot.

The Gallery should only change slides in response to the user's action. Don't programmatically change slides using a timer or other mechanism.

Usage

Dos

  • Use high-quality imagery that aligns to our Photography standards and guidelines, such as images from our Signature Gallery.
  • Include only images that add value, prioritizing the strongest images first.
  • Limit image count — typically 4-12 images total.
  • Write clear and concise titles and supporting text.
  • Write clear and concise image captions that name the space and describe the activity shown.

Don'ts

  • Don't use low-quality images.
  • Don't use groups of logos (e.g., partnerships).
  • Don't overload the gallery with more than 12 images.
  • Don't mix unrelated images that don't belong together conceptually.

Implementation Notes

The Gallery Selector shares the same slide grid and image URL rules as the Gallery. Provide your galleries through the items variable — each item has a title, an optional description, an optional link, and an image_slides array (an array of arrays, since each slide can hold multiple images).

Mapping slides to items without Twig

For the component to seamlessly transition between galleries — and to display images one at a time on narrow viewports — every gallery's slides are rendered together in the content area. The component therefore needs to know which slides belong to which item.

If you implement the Gallery Selector without the Twig templates, tag the content wrapper with a data-slide-item-map attribute containing an array of items. Each item is itself an array of the "flat" slide indexes that belong to it. The component's JavaScript parses this array to assign each slide to its corresponding item.

For example, with galleries containing 4, 1, 1, 1, 1, and 1 slides respectively:

data-slide-item-map="[[0,1,2,3],[4],[5],[6],[7],[8]]"

Accessibility

Labels

To make the component understandable to screen reader users, provide the following labels:

  • heading — an H2-sized heading that labels the entire component. Examples could include "Explore Ohio State campuses" or "Areas of Ohio Stadium."
  • dropdown_label — the accessible label for the item-selection dropdown shown on narrow viewports.
  • dropdown_helper_text — helper text for that dropdown control.

Heading level

By default, the Gallery Selector's heading is rendered as an <h2> tag. If you need to use a different heading level to maintain a logical heading order on your page, provide the appropriate level with the heading_level variable. This is a number that defaults to 2. It changes the semantic HTML heading tag without affecting the heading's visual appearance.

Image captions

The same image caption and alt text guidance as the Gallery applies here.

The Gallery Selector should only change slides in response to the user's action. Don't programmatically change slides using a timer or other mechanism.

Focus management

On narrow viewports, the component manually manages focus because the element order in the DOM doesn't follow a logical tabbing order — a result of how elements re-flow from desktop to mobile. The JavaScript identifies and focuses the first focusable element that follows or precedes the component in the DOM when tabbing out forward or backward, respectively. This is the desired behavior in the vast majority of use cases.

If you need to override this behavior — for example, because the DOM structure before or after the Gallery Selector does not follow a logical visual or structural tab order, or because you've embedded the component in an iframe — you can specify a previous and next focusable element by providing a valid query selector to the component wrapper via the data-previous-focusable and data-next-focusable attributes. If these are not found or do not resolve to a valid focusable element, the component logs a warning in the console and disables its manual focus management to prevent a focus trap.

References

Back to top