← All Components
<mth-gallery>
Composite media gallery pairing public mth-carousel and mth-lightbox tags with an RTL-aware roving-focus thumbnail strip.
When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.
Live Interactive Preview
Ready · interact with <mth-gallery>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/gallery"></script>
<mth-gallery active-index="0" loop></mth-gallery>import '@methane-ui/ui/gallery';
import '@methane-ui/react';
export function Example() {
return <mth-gallery active-index="0" loop></mth-gallery>;
}<script setup lang="ts">
import '@methane-ui/ui/gallery';
</script>
<template>
<mth-gallery active-index="0" loop></mth-gallery>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/gallery';
import { MthGalleryDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthGalleryDirective],
template: `<mth-gallery active-index="0" loop></mth-gallery>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/gallery';
import MthGallery from '@methane-ui/svelte/MthGallery.svelte';
</script>
<MthGallery active-index="0" loop></MthGallery>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
label | label | string | "" | Accessible label for the gallery. |
items | — | ReadonlyArray<unknown> | null | null | Array of GalleryItem media entries. |
activeIndex | active-index | number | 0 | Zero-based index of the active gallery item. |
lightboxOpen | lightbox-open | boolean | false | Controls whether the composed mth-lightbox overlay is open. |
loop | loop | boolean | true | Allows wrapping slide navigation in the composed carousel. |
showThumbnails | show-thumbnails | boolean | true | Displays the thumbnail strip below the carousel. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-change | { index: number; item: unknown | null } | Fired when the active gallery item changes. |
mth-lightbox-open | { index: number } | Fired when a slide opens in the lightbox. |
mth-lightbox-close | undefined | Fired when the lightbox closes. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowLeft / ArrowRight | both | thumbnail strip focused | navigates gallery thumbnails (RTL-aware) |
| Home / End | both | thumbnail strip focused | moves to first or last thumbnail |
| Enter / Space | both | thumbnail focused | selects corresponding gallery item |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | delegatesFocus: true with zero host internals.role (ADR-014). | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 3 APG keyboard transitions across LTR/RTL. | mth-gallery.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(lightbox-open). | Conformance suite |
| i18n | Routes 5 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |