GitHub

Media Gallery

A media gallery displays a group of thumbnails in a gallery format, allowing users to preview and select different media.

Components

DaffMediaGalleryComponent

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

The DaffMediaGalleryComonent is used to display a group of thumbnails in a gallery format.

<daff-media-gallery>
 <ng-template daffThumbnail thumbnailSrc="/thumbnail-path.jpg" label="Your description">
   <daff-image src="/image-path.jpg" alt="Your description" width="100" height="100"></daff-image>
 </ng-template>
</daff-media-gallery>
@Component()
class DaffMediaGalleryComponent implements DaffMediaGalleryRegistration {
  customId: InputSignal<string> = undefined, { alias: 'id' }

  elementChange: OutputEmitterRef<number> = output<number>()

  selectIndex(index: number): void
  next(focus: boolean = true): void
  previous(focus: boolean = true): void
  selectFirst(focus: boolean = true): void
  selectLast(focus: boolean = true): void
}

Inputs

customId
InputSignal<string>
Defaultundefined, { alias: 'id' }
Description

Custom ID for the media gallery that overrides the auto-generated one. When using this input, it is your responsibility to ensure that the ID is unique.

Outputs

elementChange
OutputEmitterRef<number>
Default –
Description

An event indicating that the selected media gallery element has changed.

() Methods

selectIndex
void

Select a specific entry in the media gallery by its index.

Parameters
Parameterindex: number
Description

The index to set, starting at 0.

next
void

Navigate to the next element in the list of thumbnails.

Parameters
Parameterfocus: boolean
Defaulttrue
Description

Whether to move focus to the newly selected item.

previous
void

Navigate to the previous element in the list of thumbnails.

Parameters
Parameterfocus: boolean
Defaulttrue
Description

Whether to move focus to the newly selected item.

selectFirst
void

Select the first element.

Parameters
Parameterfocus: boolean
Defaulttrue
Description

Whether to move focus to the newly selected item.

selectLast
void

Select the last element of the gallery.

Parameters
Parameterfocus: boolean
Defaulttrue
Description

Directives

DaffThumbnailDirective

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

DaffThumbnailDirective is a structural directive used to mark elements as thumbnails within the DaffMediaGalleryComponent.

<ng-template daffThumbnail></ng-template>
@Directive()
class DaffThumbnailDirective implements OnInit {
  thumbnailSrc: InputSignal<string> = undefined
  label: InputSignal<string> = undefined
  isVideo: InputSignal<boolean> = false
}

Inputs

thumbnailSrc
InputSignal<string>
Defaultundefined
Description

The file path to a thumbnail, presumably an image.

label
InputSignal<string>
Defaultundefined
Description

Provides an accessible label for a thumbnail.

isVideo
InputSignal<boolean>
Defaultfalse
Description

Indicates whether the thumbnail represents a video.


Modules

DaffMediaGalleryModule

Deprecated

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

@NgModule()
class DaffMediaGalleryModule {}