ListContainer
The <smart-list-container> component is a presentational layout wrapper that groups list items with a semantic role="list". It follows the Base + Standard + Wrapper pattern with an InjectionToken-based extension mechanism. The abstract ListContainerBaseComponent defines the shared API — optional IListContainerOptions and cssClass (alias class). ListContainerStandardComponent is a barebones placeholder concrete implementation that projects content via <ng-content /> inside a role="list" div with an optional data-variant attribute. ListContainerComponent is the public wrapper that renders ListContainerStandardComponent by default and accepts a custom replacement via LIST_CONTAINER_STANDARD_COMPONENT_TOKEN.
Usage
<smart-list-container [options]="options">
@for (notification of notifications; track notification.id) {
<div role="listitem">
<p>{{ notification.text }}</p>
<small>{{ notification.time }}</small>
</div>
}
</smart-list-container>
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
ListContainerComponent (<smart-list-container>)
Main wrapper component. Renders ListContainerStandardComponent by default. When LIST_CONTAINER_STANDARD_COMPONENT_TOKEN is provided, renders the injected component via NgComponentOutlet. Children placed inside <smart-list-container> are projected into the standard list container or, when the token is provided, into the injected component's default <ng-content />.
ListContainerStandardComponent (<smart-list-container-standard>)
Barebones placeholder concrete implementation. Renders a <div role="list"> that:
- exposes the variant value via
data-variant(omitted whenoptionsis not provided), - applies the external
cssClassdirectly on that<div>, - projects all children via
<ng-content />.
It does not include Tailwind UI styling — it exists solely as the default structural placeholder until a custom implementation is registered through the token.
ListContainerBaseComponent (abstract)
Abstract base directive for extending custom list container implementations. Exposes options as an InputSignal<IListContainerOptions | undefined> and cssClass as an InputSignal<string> (with alias class). Has no outputs or methods.
API
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
options | InputSignal<IListContainerOptions | undefined> | - | Optional configuration (variant, fullWidthOnMobile) |
class | InputSignal<string> | '' | External CSS classes (alias for cssClass) |
IListContainerOptions
| Field | Type | Default | Description |
|---|---|---|---|
variant | SmartListContainerVariant | - | Exposed as the data-variant attribute of the role="list" element, a hook for your CSS or a custom implementation; the standard adds no styles for it. |
fullWidthOnMobile | boolean | - | Not read by the built-in implementation; available to a custom implementation (edge-to-edge on small screens). |
SmartListContainerVariant is 'simple-dividers' | 'card-dividers' | 'separate-cards' | 'flat-card-dividers'.
There is no preset for this component: register a component of your own through the token for a styled container.
LIST_CONTAINER_STANDARD_COMPONENT_TOKEN
InjectionToken from @smartsoft001/angular that allows replacing the default ListContainerStandardComponent with a custom implementation. Provide a Type<ListContainerBaseComponent> in your application or component providers.
Extending the base class
import {
ChangeDetectionStrategy,
Component,
computed,
ViewEncapsulation,
} from '@angular/core';
import {
IListContainerOptions,
LIST_CONTAINER_STANDARD_COMPONENT_TOKEN,
ListContainerBaseComponent,
ListContainerComponent,
} from '@smartsoft001/angular';
/**
* A custom list container built on `ListContainerBaseComponent`.
*
* The base contributes the `options` and `class` inputs; the implementation
* decides how the rows are framed and separated. `<smart-list-container>`
* projects its content into the implementation's `<ng-content />`.
*/
@Component({
selector: 'docs-custom-list-container',
template: `
<ul role="list" [class]="containerClasses()">
<ng-content />
</ul>
`,
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class CustomListContainerComponent extends ListContainerBaseComponent {
containerClasses = computed(() => {
const classes = ['docs-list-container'];
const variant = this.options()?.variant;
if (variant) classes.push(`docs-list-container--${variant}`);
// No built-in container reads `fullWidthOnMobile`: a custom one may.
if (this.options()?.fullWidthOnMobile) {
classes.push('docs-list-container--full-width-mobile');
}
const extra = this.cssClass();
if (extra) classes.push(extra);
return classes.join(' ');
});
}
/**
* Registering the implementation against
* `LIST_CONTAINER_STANDARD_COMPONENT_TOKEN` makes every
* `<smart-list-container>` in this injector render it instead of the standard
* variation.
*/
@Component({
selector: 'docs-list-container-custom-example',
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [ListContainerComponent],
providers: [
{
provide: LIST_CONTAINER_STANDARD_COMPONENT_TOKEN,
useValue: CustomListContainerComponent,
},
],
template: `
<smart-list-container [options]="options">
@for (member of members; track member.name) {
<li class="docs-list-container__item">
<span class="docs-list-container__name">{{ member.name }}</span>
<span class="docs-list-container__role">{{ member.role }}</span>
</li>
}
</smart-list-container>
`,
})
export class ListContainerCustomExampleComponent {
options: IListContainerOptions = {
variant: 'separate-cards',
fullWidthOnMobile: true,
};
members = [
{ name: 'Lindsay Walton', role: 'Front-end Developer' },
{ name: 'Courtney Henry', role: 'Designer' },
{ name: 'Tom Cook', role: 'Director of Product' },
];
}
Source
The component lives in packages/shared/angular/src/lib/components/list-container and is documented for Claude Code by the angular-components-list-container skill.
SmartListContainer wraps list entries (children) in a role="list" element and exposes options.variant as data-variant so your CSS (or an implementation of your own) can draw dividers or cards. There is no preset for it: register a component of your own under the list-container key for a styled container.
Usage
import { IListContainerOptions, SmartListContainer } from '@smartsoft001/react';
const options: IListContainerOptions = { variant: 'card-dividers' };
const notifications = [
{ id: 'n1', text: 'Invoice #1042 was paid', time: '2 min ago' },
{ id: 'n2', text: 'Courtney Henry joined the team', time: '1 h ago' },
{ id: 'n3', text: 'Your export is ready to download', time: 'Yesterday' },
];
export function ListContainerUsageExample() {
return (
<SmartListContainer options={options}>
{notifications.map((notification) => (
<div key={notification.id} role="listitem">
<p>{notification.text}</p>
<small>{notification.time}</small>
</div>
))}
</SmartListContainer>
);
}
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 |
|---|---|---|
SmartListContainer | component | Renders the implementation registered as components['list-container'] on SmartProvider, SmartListContainerStandard by default. |
SmartListContainerStandard | component | The default list-container rendering: a role="list" element around children, exposing options.variant as data-variant for styling. |
Props and Types
SmartListContainerProps
| Prop | Type | Default | Description |
|---|---|---|---|
options? | IListContainerOptions | — | Variant and mobile behaviour. |
className? | string | — | Classes on the role="list" element. |
children? | ReactNode | — | The list entries. |
IListContainerOptions
| Field | Type | Default | Description |
|---|---|---|---|
variant? | SmartListContainerVariant | — | Exposed as data-variant, a hook for your CSS or a custom implementation; the standard adds no styles for it. |
fullWidthOnMobile? | boolean | — | Not read by the built-in implementation; available to a custom implementation (edge-to-edge on small screens). |
Related types
SmartListContainerVariant:'simple-dividers' \| 'card-dividers' \| 'separate-cards' \| 'flat-card-dividers'
Replacing the Implementation
SmartListContainer renders the component registered under the 'list-container' key of SmartProvider's components, and SmartListContainerStandard when nothing is registered there. Every SmartListContainer below the provider then renders the registered component, which receives the same props.
There is no preset for this component: register a component of your own that takes SmartListContainerProps, as shown below, as components={{ 'list-container': CustomListContainer }}. Pass components as a stable object (a module constant or a memoised value), or the context changes on every render.
import {
IListContainerOptions,
SmartListContainer,
SmartListContainerProps,
SmartProvider,
} from '@smartsoft001/react';
/**
* A custom list container: it receives the props of `SmartListContainer`
* (`options`, `className`, `children`) and decides how the rows are framed
* and separated.
*/
export function CustomListContainer({
options,
className,
children,
}: SmartListContainerProps) {
const classes = [
'docs-list-container',
options?.variant && `docs-list-container--${options.variant}`,
options?.fullWidthOnMobile && 'docs-list-container--full-width-mobile',
className,
]
.filter(Boolean)
.join(' ');
return (
<ul role="list" className={classes}>
{children}
</ul>
);
}
// A module constant: a new object on every render would change the context.
const components = { 'list-container': CustomListContainer };
const options: IListContainerOptions = {
variant: 'separate-cards',
fullWidthOnMobile: true,
};
const members = [
{ name: 'Lindsay Walton', role: 'Front-end Developer' },
{ name: 'Courtney Henry', role: 'Designer' },
{ name: 'Tom Cook', role: 'Director of Product' },
];
/**
* Every `SmartListContainer` below this provider renders
* `CustomListContainer` instead of the standard rendering.
*/
export function ListContainerCustomExample() {
return (
<SmartProvider components={components}>
<SmartListContainer options={options}>
{members.map((member) => (
<li key={member.name} className="docs-list-container__item">
<span className="docs-list-container__name">{member.name}</span>
<span className="docs-list-container__role">{member.role}</span>
</li>
))}
</SmartListContainer>
</SmartProvider>
);
}
Styling
- The standard rendering is unstyled: style
[data-variant]with your own CSS or register your own component.
Source
The component lives in packages/shared/react/src/lib/components/list-container and is documented for Claude Code by the react-components-list-container skill.