Table Column Type Image

Edit on GitHub

This document explains the Table Column Type Image in the Components library.

Overview

Table Column Image is an Angular Component that renders an image.

Check out an example usage of the Table Column Image in the @spryker/table config:

<spy-table
    [config]="{
        ...,
        columns: [
            ...,
            {
                id: 'columnId',
                title: 'Column Title',
                type: 'image',
                typeOptions: {
                    src: 'image URL',
                    alt: 'alt value',
                },
            },
            ...,
        ],
    }"
>
</spy-table>

Component registration

Register the component:

declare module '@spryker/table' {
    interface TableColumnTypeRegistry {
        image: TableColumnImageConfig;
    }
}

@NgModule({
    imports: [
        TableModule.forRoot(),
        TableModule.withColumnComponents({
            image: TableColumnImageComponent,
        }),
        TableColumnImageModule,
    ],
})
export class RootModule {}

Interfaces

Below you can find interfaces for the Table Column Image:

interface TableColumnImageConfig {
    src?: string;
    alt?: string;
}