Stacked List

The <smart-stacked-list> component renders a vertical list of records with optional title, description, per-item icon/avatar, link, badge, action template, and bottom footer slot. It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract StackedListBaseComponent defines the shared API — optional IStackedListOptions and cssClass (alias class). StackedListStandardComponent is a barebones placeholder concrete implementation. StackedListPresetComponent is a styled Tailwind drop-in replacement. StackedListComponent is the public wrapper that renders StackedListStandardComponent by default and accepts a custom replacement (such as the preset) via STACKED_LIST_STANDARD_COMPONENT_TOKEN.


Usage

<smart-stacked-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

StackedListComponent (<smart-stacked-list>)

Main wrapper component. Renders StackedListStandardComponent by default. When STACKED_LIST_STANDARD_COMPONENT_TOKEN is provided, renders the injected component via NgComponentOutlet and hands it the options and class inputs.

StackedListStandardComponent (<smart-stacked-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 (with aria-label from the item's ariaLabel). Each item renders the icon/avatar (icon template wins over avatar URL), a body group with the title (rendered as <a class="title"> if href is provided, otherwise <span class="title">) and optional description/meta, and 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.

StackedListPresetComponent (<smart-stacked-list-preset>)

Styled variation that extends StackedListBaseComponent and is a drop-in replacement for StackedListStandardComponent. See Preset.

StackedListBaseComponent (abstract)

Abstract base directive for extending custom stacked-list implementations. Exposes options as an InputSignal<IStackedListOptions | undefined> and cssClass as an InputSignal<string> (with alias class).

API

Inputs

InputTypeDefaultDescription
optionsInputSignal<IStackedListOptions | undefined>-Optional configuration (title, description, items, layout flags, empty/footer slots)
classInputSignal<string>''External CSS classes (alias for cssClass)

IStackedListOptions

All properties are optional except IStackedListItem.title. A section is rendered only when its template/string is provided.

FieldTypeDefaultDescription
titlestring-Heading above the list (<h3>).
descriptionstring-Text under the heading.
itemsIStackedListItem[][]The rows.
emptyTplTemplateRef<unknown>-Rendered instead of the list when items is empty.
footerTplTemplateRef<unknown>-A slot below the list.
withDividersboolean-Preset only: hairlines between rows. The standard ignores it.
fullWidthOnMobileboolean-Preset only: a card that bleeds to the screen edge below sm and is rounded from sm up. The standard ignores it.

IStackedListItem

FieldTypeDefaultDescription
idstring-Tracking key of the row (the index is used without it).
titlestringrequiredRow title; a plain <a href> when href is set.
descriptionstring-Second line.
metastring-Small extra line (date, role).
avatarUrlstring-Leading avatar image.
iconTplTemplateRef<unknown>-Leading icon; wins over avatarUrl.
hrefstring-Makes the title a link.
badgeTplTemplateRef<unknown>-Trailing badge.
actionTplTemplateRef<unknown>-Trailing action.
ariaLabelstring-Accessible name of the row (aria-label on the <li>).

Preset

StackedListPresetComponent (selector smart-stacked-list-preset) is the styled skin used by the Storybook stories and the docs site. It extends StackedListBaseComponent, so it takes the same options and cssClass inputs.

It renders the Tailwind UI stacked list look in smart:-prefixed Tailwind v4 classes with a smart:dark: variant on every colour.

  • Header: text-base font-semibold gray-900 / white title and a text-sm gray-500 / gray-400 description.
  • Rows: flex items-center justify-between gap-x-6 py-5. The leading media is a size-12 rounded-full avatar (avatarUrl) or a gray-100 / gray-800 rounded-full tile wrapping iconTpl (the icon template wins). The body shows the title (text-sm/6 font-semibold, rendered as a link with hover underline when href is set), a truncated text-xs/5 description and a meta line. badgeTpl and actionTpl render in a trailing group.
  • Empty state: emptyTpl renders in a dashed gray-200 / white-10 rounded-lg box when items is empty.
  • Footer: footerTpl renders under the list.
  • External class: cssClass is appended to the root wrapper.

It honours both layout hints that the standard component ignores, as the table shows.

OptionPreset behaviour
withDividerstrue draws divide-y gray-100 / white-10 hairlines between rows. Unset or false separates rows by spacing only.
fullWidthOnMobiletrue renders the list as a white / gray-900 card with a ring. Below sm it bleeds to the screen edge (-mx-4, square corners); from sm up it is a rounded-xl card. Rows get px-4 sm:px-6 padding.

Provide StackedListPresetComponent under STACKED_LIST_STANDARD_COMPONENT_TOKEN to restyle every <smart-stacked-list>, or register every preset of the library at once with provideSmartPresets().

StackedListPresetComponent declares cssClass as input<string>('') without the class alias. When you use the <smart-stacked-list-preset> selector directly, bind [cssClass]. On <smart-stacked-list> just pass class and the wrapper forwards it.

The class recipes are internal to the preset and not exported.

STACKED_LIST_STANDARD_COMPONENT_TOKEN

InjectionToken that allows replacing the default StackedListStandardComponent with a custom implementation. Provide a component class extending StackedListBaseComponent under STACKED_LIST_STANDARD_COMPONENT_TOKEN; every <smart-stacked-list> below that injector renders it.

Extending the base class

import {
  ChangeDetectionStrategy,
  Component,
  computed,
  ViewEncapsulation,
} from '@angular/core';

import {
  IStackedListOptions,
  STACKED_LIST_STANDARD_COMPONENT_TOKEN,
  StackedListBaseComponent,
  StackedListComponent,
} from '@smartsoft001/angular';

@Component({
  selector: 'docs-custom-stacked-list',
  template: `
    <div [class]="containerClasses()">
      @if (options()?.title) {
        <h3 class="docs-stacked-list__title">{{ options()!.title }}</h3>
      }
      @if (options()?.description) {
        <p class="docs-stacked-list__description">
          {{ options()!.description }}
        </p>
      }

      <ul role="list">
        @for (item of options()?.items ?? []; track item.id ?? $index) {
          <li class="docs-stacked-list__item">
            @if (item.avatarUrl) {
              <img
                class="docs-stacked-list__avatar"
                [src]="item.avatarUrl"
                alt=""
              />
            }
            <span class="docs-stacked-list__body">
              @if (item.href) {
                <a [attr.href]="item.href">{{ item.title }}</a>
              } @else {
                <span>{{ item.title }}</span>
              }
              @if (item.description) {
                <span class="docs-stacked-list__meta">
                  {{ item.description }}
                </span>
              }
            </span>
            @if (item.meta) {
              <span class="docs-stacked-list__joined">{{ item.meta }}</span>
            }
          </li>
        }
      </ul>
    </div>
  `,
  encapsulation: ViewEncapsulation.None,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CustomStackedListComponent extends StackedListBaseComponent {
  containerClasses = computed(() =>
    [
      'docs-stacked-list',
      this.options()?.withDividers ? 'docs-stacked-list--divided' : '',
      this.options()?.fullWidthOnMobile ? 'docs-stacked-list--bleed' : '',
      this.cssClass(),
    ]
      .filter(Boolean)
      .join(' '),
  );
}

@Component({
  selector: 'docs-stacked-list-custom-example',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [StackedListComponent],
  // The token swaps the standard list for the custom one everywhere below this
  // component, so consumers keep writing `<smart-stacked-list>`.
  providers: [
    {
      provide: STACKED_LIST_STANDARD_COMPONENT_TOKEN,
      useValue: CustomStackedListComponent,
    },
  ],
  template: `<smart-stacked-list [options]="options" />`,
})
export class StackedListCustomExampleComponent {
  // withDividers and fullWidthOnMobile are styling hints: the standard list
  // ignores them, the preset styles them and a custom implementation decides
  // what they mean.
  options: IStackedListOptions = {
    title: 'Team members',
    description: 'People with access to this workspace.',
    withDividers: true,
    items: [
      {
        id: '1',
        title: 'Lindsay Walton',
        description: 'lindsay.walton@example.com',
        meta: 'Joined 12 January 2026',
      },
      {
        id: '2',
        title: 'Courtney Henry',
        description: 'courtney.henry@example.com',
        meta: 'Joined 3 February 2026',
      },
      {
        id: '3',
        title: 'Tom Cook',
        description: 'tom.cook@example.com',
        meta: 'Joined 27 February 2026',
      },
    ],
  };
}

Source

The component lives in packages/shared/angular/src/lib/components/stacked-list and is documented for Claude Code by the angular-components-stacked-list skill.

SmartStackedList renders a vertical list of rows from data you hold: each row has a leading avatar (avatarUrl) or icon (iconTpl wins), a title (a link when href is set), a description and a meta line, and trailing badge and action slots. withDividers and fullWidthOnMobile are layout hints honoured by SmartStackedListPreset; the standard rendering is unstyled. emptyTpl replaces the rows when there are none.


Usage

import { IStackedListOptions, SmartStackedList } from '@smartsoft001/react';

const options: IStackedListOptions = {
  title: 'Team members',
  description: 'People with access to this workspace.',
  withDividers: true,
  items: [
    {
      id: 'leslie',
      title: 'Leslie Alexander',
      description: 'leslie.alexander@example.com',
      meta: 'Co-Founder / CEO',
      href: '/team/leslie',
    },
    {
      id: 'michael',
      title: 'Michael Foster',
      description: 'michael.foster@example.com',
      meta: 'Co-Founder / CTO',
      href: '/team/michael',
    },
    {
      id: 'dries',
      title: 'Dries Vincent',
      description: 'dries.vincent@example.com',
      meta: 'Business Relations',
      href: '/team/dries',
    },
  ],
};

export function StackedListUsageExample() {
  return <SmartStackedList 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.

ExportKindWhat it is
SmartStackedListcomponentRenders the implementation registered as components['stacked-list'] on SmartProvider, SmartStackedListStandard by default.
SmartStackedListPresetcomponentStyled stacked list variation (preset).
SmartStackedListStandardcomponentThe default stacked-list rendering: one li.item per item (icon template > avatar, title as a link when href is set, description, meta, badge and action slots), the emptyTpl when there are no items, then the footerTpl slot.

The preset's class helpers (getStackedListRootClasses, getStackedListListClasses, getStackedListItemClasses, STACKED_LIST_ROOT, STACKED_LIST_TITLE, STACKED_LIST_DESCRIPTION, STACKED_LIST_HEADER, STACKED_LIST_DIVIDERS, STACKED_LIST_FULL_WIDTH_CARD, STACKED_LIST_ITEM, STACKED_LIST_ITEM_CARD_PADDING, STACKED_LIST_LEAD, STACKED_LIST_AVATAR, STACKED_LIST_ICON, STACKED_LIST_BODY, STACKED_LIST_ITEM_TITLE, STACKED_LIST_ITEM_TITLE_LINK, STACKED_LIST_ITEM_DESCRIPTION, STACKED_LIST_ITEM_META, STACKED_LIST_TRAIL, STACKED_LIST_EMPTY, STACKED_LIST_FOOTER) are exported too, with the type IStackedListPresetFlags (the withDividers / fullWidthOnMobile flags the list and item helpers take), for a custom implementation that wants the preset look.

Props and Types

SmartStackedListProps

PropTypeDefaultDescription
options?IStackedListOptions—Header, rows and hints.
className?string—Classes on the root element.

IStackedListOptions

FieldTypeDefaultDescription
title?string—Heading above the list.
description?string—Text under the heading.
items?IStackedListItem[][]The rows.
withDividers?boolean—Preset: hairlines between rows.
fullWidthOnMobile?boolean—Preset: a card that bleeds to the screen edge below sm and is rounded from sm up.
emptyTpl?ReactNode—Shown when there are no rows.
footerTpl?ReactNode—A slot below the list.

IStackedListItem

FieldTypeDefaultDescription
id?string—Key of the row.
titlestringrequiredRow title; a link when href is set.
description?string—Second line.
meta?string—Small extra line (date, role).
avatarUrl?string—Leading avatar.
iconTpl?ReactNode—Leading icon; wins over avatarUrl.
href?string—Makes the title a link.
badgeTpl?ReactNode—Trailing badge.
actionTpl?ReactNode—Trailing action.
ariaLabel?string—Accessible name of the row.

Replacing the Implementation

SmartStackedList renders the component registered under the 'stacked-list' key of SmartProvider's components, and SmartStackedListStandard when nothing is registered there. Every SmartStackedList below the provider then renders the registered component, which receives the same props.

SmartStackedListPreset is the styled (preset) implementation: register it under the 'stacked-list' key of SmartProvider's components, render it directly in place of SmartStackedList, 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 {
  IStackedListOptions,
  SmartProvider,
  SmartStackedList,
  SmartStackedListProps,
} from '@smartsoft001/react';

// The stacked list has no behaviour hook: an implementation only renders its
// props, and decides what the withDividers / fullWidthOnMobile hints mean.
export function CustomStackedList({
  options,
  className,
}: SmartStackedListProps) {
  const containerClasses = [
    'docs-stacked-list',
    options?.withDividers && 'docs-stacked-list--divided',
    options?.fullWidthOnMobile && 'docs-stacked-list--bleed',
    className,
  ]
    .filter(Boolean)
    .join(' ');

  return (
    <div className={containerClasses}>
      {options?.title && (
        <h3 className="docs-stacked-list__title">{options.title}</h3>
      )}
      {options?.description && (
        <p className="docs-stacked-list__description">{options.description}</p>
      )}

      <ul role="list">
        {(options?.items ?? []).map((item, index) => (
          <li key={item.id ?? index} className="docs-stacked-list__item">
            {item.avatarUrl && (
              <img
                className="docs-stacked-list__avatar"
                src={item.avatarUrl}
                alt=""
              />
            )}
            <span className="docs-stacked-list__body">
              {item.href ? (
                <a href={item.href}>{item.title}</a>
              ) : (
                <span>{item.title}</span>
              )}
              {item.description && (
                <span className="docs-stacked-list__meta">
                  {item.description}
                </span>
              )}
            </span>
            {item.meta && (
              <span className="docs-stacked-list__joined">{item.meta}</span>
            )}
          </li>
        ))}
      </ul>
    </div>
  );
}

// A module constant: a new object on every render would change the context.
const components = { 'stacked-list': CustomStackedList };

const options: IStackedListOptions = {
  title: 'Team members',
  description: 'People with access to this workspace.',
  withDividers: true,
  items: [
    {
      id: '1',
      title: 'Lindsay Walton',
      description: 'lindsay.walton@example.com',
      meta: 'Joined 12 January 2026',
    },
    {
      id: '2',
      title: 'Courtney Henry',
      description: 'courtney.henry@example.com',
      meta: 'Joined 3 February 2026',
    },
    {
      id: '3',
      title: 'Tom Cook',
      description: 'tom.cook@example.com',
      meta: 'Joined 27 February 2026',
    },
  ],
};

// Every <SmartStackedList> below the provider renders CustomStackedList.
export function StackedListCustomExample() {
  return (
    <SmartProvider components={components}>
      <SmartStackedList options={options} />
    </SmartProvider>
  );
}

Styling

  • The standard rendering is unstyled (li.item per row); the preset carries the Tailwind UI look with smart:dark: variants.

Source

The component lives in packages/shared/react/src/lib/components/stacked-list and is documented for Claude Code by the react-components-stacked-list skill.