Media Gallery

<daff-media-gallery> is used to display a group of [daffThumbnail]s in a gallery format. Media galleries are useful to showcase multiple images related to a single product or topic.

Usage

Within a standalone component

To use media gallery in a standalone component, import it directly into your custom component:

@Component({
  selector: 'custom-component',
  templateUrl: './custom-component.component.html',
  standalone: true,
  imports: [
    DAFF_MEDIA_GALLERY_COMPONENTS,
  ],
})
export class CustomComponent {}

Within a module (deprecated)

To use media gallery in a module, import DaffMediaGalleryModule into your custom module:

import { NgModule } from '@angular/core';

import { DaffMediaGalleryModule } from '@daffodil/design/media-gallery';

@NgModule({
    declarations: [
    CustomComponent,
  ],
  exports: [
    CustomComponent,
  ],
  imports: [
    DaffMediaGalleryModule,
  ],
})
export class CustomComponentModule { }

This method is deprecated. It's recommended to update all custom components to standalone.

Thumbnail

[daffThumbnail] should be used as a directive with <daff-image>. View Image Documentation

It should never be used as a standalone component. The first thumbnail is selected by default and dynamically rendered as the primary image by utilizing the <daff-media-renderer> component. The selected thumbnail can be controlled by the enduser, and the position of the list of thumbnails is dependent on the screen size.

Image Aspect Ratio

It's recommended to utilize the same aspect ratio for all images in the same media gallery. Otherwise, the height and width of the media gallery may change with every different aspect ratio presented by the selected thumbnail as show in the example.

The thumbnail dimension is set to 80x80 pixels, so the recommended aspect ratio is 1:1. However, it is not required since the thumbnail will horizontally and vertically center align images within a thumbnail.

Accessibility

Accessibility considerations for media gallery is handled by the DaffImageComponent. The alt attribute must be defined in <daff-image>. It specifies an alternate text for an image. An error will appear if it's not defined. This is important because it allows screen readers to describe what's in the image for visually impaired people. View Image Documentation

Graycore, LLC © 2018 - 2024. Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.