Grid List
The <smart-grid-list> component renders a grid of card-like records with optional title, description, per-item icon/image, link, badge, action template, and bottom footer slot. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract GridListBaseComponent defines the shared API — optional IGridListOptions and cssClass (alias class). GridListStandardComponent is a barebones placeholder concrete implementation. GridListComponent is the public wrapper that renders GridListStandardComponent by default and accepts a custom replacement via GRID_LIST_STANDARD_COMPONENT_TOKEN.
Usage
<smart-grid-list [options]="options" />
The preview renders the code above in an application that registers every preset (provideSmartPresets(), see Installation) and the English translations; without the presets, a component that has one renders its standard implementation instead, for most components unstyled markup.
Components
GridListComponent (<smart-grid-list>)
Main wrapper component. Renders GridListStandardComponent by default. When GRID_LIST_STANDARD_COMPONENT_TOKEN is provided, renders the injected component via NgComponentOutlet.
GridListStandardComponent (<smart-grid-list-standard>)
Barebones placeholder concrete implementation. Renders a wrapper <div> containing an optional <h3 class="title">, optional <p class="description">, and a <ul role="list"> with one <li class="item"> per item. Each item renders the icon/image (icon template wins over image URL), a body group with the title (rendered as <a class="title"> if href is provided, otherwise <span class="title">) and optional description, plus optional badge/action template slots. When the item list is empty, the optional emptyTpl is rendered inside <div class="empty">. A bottom footerTpl renders inside <div class="footer">. The external cssClass is applied to the root wrapper. It does not include any visual styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
GridListBaseComponent (abstract)
Abstract base directive for extending custom grid-list implementations. Exposes options as an InputSignal<IGridListOptions | undefined> and cssClass as an InputSignal<string> (with alias class).
API
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
options | InputSignal<IGridListOptions | undefined> | - | Header, items, grid shape and slots |
class | InputSignal<string> | '' | Classes on the root element (cssClass input, alias class) |
IGridListOptions
| Field | Type | Default | Description |
|---|---|---|---|
title | string | - | Heading above the grid. |
description | string | - | Text under the heading. |
items | IGridListItem[] | [] | The tiles. |
columns | SmartGridListColumns | - | Preset only: one column on mobile, two from sm, the requested count from lg (1 or unset stays one column). |
gap | 'sm' | 'md' | 'lg' | 'md' | Preset only: the spacing between tiles. |
layout | SmartGridListLayout | 'cards' | Preset only: media on top (cards), an inline row (horizontal) or a centred logo (logos). |
emptyTpl | TemplateRef<unknown> | - | Shown when there are no items (the preset falls back to an untranslated "No items to display."). |
footerTpl | TemplateRef<unknown> | - | A slot below the grid. |
SmartGridListColumns is 1 | 2 | 3 | 4 | 5 | 6; SmartGridListLayout is 'cards' | 'horizontal' | 'logos'.
IGridListItem
| Field | Type | Default | Description |
|---|---|---|---|
id | string | - | Track key of the tile. |
title | string | required | Tile title; a link when href is set. |
description | string | - | Tile text. |
imageUrl | string | - | Tile image. |
imageAlt | string | - | Alt text of the image. |
href | string | - | Makes the title a link. |
iconTpl | TemplateRef<unknown> | - | Media icon; wins over imageUrl. |
badgeTpl | TemplateRef<unknown> | - | Badge next to the title. |
actionTpl | TemplateRef<unknown> | - | Action slot of the tile. |
ariaLabel | string | - | Accessible name of the tile. |
The standard renders every field except columns, gap and layout, which only shape the preset's grid (or a custom implementation's); a section is rendered only when its template/string is provided. Within an item, iconTpl takes precedence over imageUrl when both are set.
GRID_LIST_STANDARD_COMPONENT_TOKEN
InjectionToken that allows replacing the default GridListStandardComponent with a custom implementation. Provide a Type<GridListBaseComponent> to override; the wrapper passes options and the class on.
Extending the base class
import {
ChangeDetectionStrategy,
Component,
computed,
ViewEncapsulation,
} from '@angular/core';
import {
GRID_LIST_STANDARD_COMPONENT_TOKEN,
GridListBaseComponent,
GridListComponent,
IGridListOptions,
} from '@smartsoft001/angular';
@Component({
selector: 'docs-custom-grid-list',
template: `
<div [class]="containerClasses()">
@if (options()?.title) {
<h3 class="docs-grid-list__title">{{ options()?.title }}</h3>
}
<ul
class="docs-grid-list__items"
[attr.data-columns]="options()?.columns ?? null"
>
@for (item of options()?.items ?? []; track item.id ?? $index) {
<li class="docs-grid-list__item">
@if (item.imageUrl) {
<img
class="docs-grid-list__image"
[src]="item.imageUrl"
[attr.alt]="item.imageAlt ?? ''"
/>
}
@if (item.href) {
<a class="docs-grid-list__link" [attr.href]="item.href">
{{ item.title }}
</a>
} @else {
<span class="docs-grid-list__label">{{ item.title }}</span>
}
@if (item.description) {
<p class="docs-grid-list__description">{{ item.description }}</p>
}
</li>
}
</ul>
</div>
`,
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CustomGridListComponent extends GridListBaseComponent {
containerClasses = computed(() => {
const classes = ['docs-grid-list'];
const extra = this.cssClass();
if (extra) classes.push(extra);
return classes.join(' ');
});
}
@Component({
selector: 'docs-grid-list-custom-example',
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [GridListComponent],
// The token swaps the standard grid list for the custom one everywhere
// below this component, so consumers keep writing `<smart-grid-list>`.
providers: [
{
provide: GRID_LIST_STANDARD_COMPONENT_TOKEN,
useValue: CustomGridListComponent,
},
],
template: `<smart-grid-list [options]="options" />`,
})
export class GridListCustomExampleComponent {
options: IGridListOptions = {
title: 'Team',
columns: 3,
items: [
{
id: 'lindsay',
title: 'Lindsay Walton',
description: 'Front-end Developer',
href: '/team/lindsay-walton',
},
{ id: 'courtney', title: 'Courtney Henry', description: 'Designer' },
{ id: 'tom', title: 'Tom Cook', description: 'Director of Product' },
],
};
}
Preset
GridListPresetComponent (<smart-grid-list-preset>) is a styled drop-in replacement for the barebones standard component, built entirely with vanilla Tailwind utilities (every class carries the smart: prefix) and explicit smart:dark:* twins in the same template. It extends GridListStandardComponent and reads the same IGridListOptions — no new options fields are introduced.
Layout:
- Optional
title/descriptionrender as a header block above the grid. - The grid is
smart:grid smart:grid-cols-1, widened responsively fromcolumns(smart:sm:grid-cols-2fromsm, thensmart:lg:grid-cols-<n>fromlg;1/unset stays single-column) and spaced fromgap(sm→smart:gap-3,md/default→smart:gap-4,lg→smart:gap-6). - Each item is a bordered rounded card.
layoutdrives the interior arrangement:cards(default) stacks media on top of the body,horizontalplaces media inline to the left of the body,logoscenters a contained logo above a centered caption. - Per item:
iconTpl(wins overimageUrl) orimageUrlrender as the media slot; the title renders as a link with asmart:hover:text-blue-600accent whenhrefis set, otherwise plain text;badgeTplsits beside the title;descriptionrenders under it;actionTplrenders in a bordered tile footer. - Empty items render
emptyTplor a centered default message;footerTplrenders below the grid.
Every zone is addressable via data-role hooks: header, grid, item, media, title, description, badge, action, empty, footer.
Register it for GRID_LIST_STANDARD_COMPONENT_TOKEN to restyle every <smart-grid-list>, or register every preset at once with provideSmartPresets().
The preset declares cssClass without the class alias, so bind [cssClass] when you use the <smart-grid-list-preset> selector directly; class on <smart-grid-list> reaches it through the wrapper and is merged onto the root wrapper.
The class recipes are internal (not exported from @smartsoft001/angular).
Documented gaps: layout only affects the tile interior arrangement (not per-item overrides); there is no built-in pagination or selection state.
- Preset:
packages/shared/angular/src/lib/components/grid-list/preset/preset.component.ts
Source
The component lives in packages/shared/angular/src/lib/components/grid-list and is documented for Claude Code by the angular-components-grid-list skill.
SmartGridList renders items as tiles: a media slot (iconTpl, else imageUrl), a title (a link when href is set) with an optional badge, a description and an action slot. columns, gap and layout (cards, horizontal, logos) shape the grid in SmartGridListPreset; the standard rendering is an unstyled list with class hooks. emptyTpl is shown when there are no items.
Usage
import { IGridListOptions, SmartGridList } from '@smartsoft001/react';
const options: IGridListOptions = {
title: 'Team',
description: 'The people behind the product.',
// The preset lays the tiles out in three columns from the `lg` breakpoint.
columns: 3,
items: [
{
id: 'lindsay',
title: 'Lindsay Walton',
description: 'Front-end Developer',
href: '/team/lindsay-walton',
},
{ id: 'courtney', title: 'Courtney Henry', description: 'Designer' },
{ id: 'tom', title: 'Tom Cook', description: 'Director of Product' },
],
};
export function GridListUsageExample() {
return <SmartGridList options={options} />;
}
The preview renders the code above in an application that registers every preset (SMART_PRESET_COMPONENTS on SmartProvider, see Installation) and the English translations; without the presets, a component that has one renders its standard implementation instead, for most components unstyled markup.
Exports
All from @smartsoft001/react.
| Export | Kind | What it is |
|---|---|---|
SmartGridList | component | Renders the implementation registered as components['grid-list'] on SmartProvider, SmartGridListStandard by default. |
SmartGridListPreset | component | Styled grid-list variation (preset). |
SmartGridListStandard | component | The default grid-list rendering: one li.item per item (icon template > image, title as a link when href is set, description, badge and action slots), the emptyTpl when there are no items, then the footerTpl slot. |
The preset's class helpers (getGridListColumnsClasses, getGridListGapClasses, getGridListGridClasses, getGridListTileClasses, getGridListMediaClasses, GRID_LIST_CONTAINER, GRID_LIST_TILE) are exported too, for a custom implementation that wants the preset look.
Props and Types
SmartGridListProps
| Prop | Type | Default | Description |
|---|---|---|---|
options? | IGridListOptions | — | Header, items, grid shape and slots. |
className? | string | — | Classes on the root element. |
IGridListOptions
| Field | Type | Default | Description |
|---|---|---|---|
title? | string | — | Heading above the grid. |
description? | string | — | Text under the heading. |
items? | IGridListItem[] | [] | The tiles. |
columns? | SmartGridListColumns | — | Preset: one column on mobile, two from sm, the requested count from lg. |
gap? | 'sm' | 'md' | 'lg' | — | Preset: sm, md (default) or lg spacing. |
layout? | SmartGridListLayout | 'cards' | Preset: media on top (cards), an inline row (horizontal) or a centred logo (logos). |
emptyTpl? | ReactNode | — | Shown when there are no items (the preset falls back to an untranslated "No items to display."). |
footerTpl? | ReactNode | — | A slot below the grid. |
IGridListItem
| Field | Type | Default | Description |
|---|---|---|---|
id? | string | — | Key of the tile. |
title | string | required | Tile title; a link when href is set. |
description? | string | — | Tile text. |
imageUrl? | string | — | Tile image. |
imageAlt? | string | — | Alt text of the image. |
href? | string | — | Makes the title a link. |
iconTpl? | ReactNode | — | Media icon; wins over imageUrl. |
badgeTpl? | ReactNode | — | Badge next to the title. |
actionTpl? | ReactNode | — | Action slot in the tile footer. |
ariaLabel? | string | — | Accessible name of the tile. |
Related types
SmartGridListColumns:1 \| 2 \| 3 \| 4 \| 5 \| 6SmartGridListLayout:'cards' \| 'horizontal' \| 'logos'
Replacing the Implementation
SmartGridList renders the component registered under the 'grid-list' key of SmartProvider's components, and SmartGridListStandard when nothing is registered there. Every SmartGridList below the provider then renders the registered component, which receives the same props.
SmartGridListPreset is the styled (preset) implementation: register it under the 'grid-list' key of SmartProvider's components, render it directly in place of SmartGridList, or spread SMART_PRESET_COMPONENTS on the provider to register every preset at once (see the react-provider skill). Pass components as a stable object (a module constant or a memoised value), or the context changes on every render.
import {
cn,
IGridListOptions,
SmartGridList,
SmartGridListProps,
SmartProvider,
} from '@smartsoft001/react';
export function CustomGridList({ options, className }: SmartGridListProps) {
return (
<div className={cn('docs-grid-list', className)}>
{options?.title && (
<h3 className="docs-grid-list__title">{options.title}</h3>
)}
<ul className="docs-grid-list__items" data-columns={options?.columns}>
{(options?.items ?? []).map((item, index) => (
<li key={item.id ?? index} className="docs-grid-list__item">
{item.imageUrl && (
<img
className="docs-grid-list__image"
src={item.imageUrl}
alt={item.imageAlt ?? ''}
/>
)}
{item.href ? (
<a className="docs-grid-list__link" href={item.href}>
{item.title}
</a>
) : (
<span className="docs-grid-list__label">{item.title}</span>
)}
{item.description && (
<p className="docs-grid-list__description">{item.description}</p>
)}
</li>
))}
</ul>
</div>
);
}
// A module constant: a new object on every render would change the context.
const components = { 'grid-list': CustomGridList };
const options: IGridListOptions = {
title: 'Team',
columns: 3,
items: [
{
id: 'lindsay',
title: 'Lindsay Walton',
description: 'Front-end Developer',
href: '/team/lindsay-walton',
},
{ id: 'courtney', title: 'Courtney Henry', description: 'Designer' },
{ id: 'tom', title: 'Tom Cook', description: 'Director of Product' },
],
};
export function GridListCustomExample() {
// Every SmartGridList below the provider renders CustomGridList.
return (
<SmartProvider components={components}>
<SmartGridList options={options} />
</SmartProvider>
);
}
Styling
SmartGridListStandardrenders oneli.itemper item without layout styles:columns,gapandlayoutonly take effect inSmartGridListPreset(or your own CSS).- The preset tiles are bordered cards with
smart:dark:variants.
Source
The component lives in packages/shared/react/src/lib/components/grid-list and is documented for Claude Code by the react-components-grid-list skill.