@molecule/app-activity-timeline-angular
Angular vertical activity timeline — the counterpart of
@molecule/app-activity-timeline-react: the same props (React names) and the
same DOM for the same input.
A vertical timeline of events (calls, emails, meetings, deal stages,
shipment hops, milestones).
Sister package to @molecule/app-activity-feed-angular (which is a flat
avatar-prose list). Use this one when the chronological sequencing of events
is the main affordance — connector line + dots make ordering obvious at a
glance.
Extracted from the crm and employee-onboarding flagships.
Auto-generated, AI-first package reference for the molecule.dev ecosystem.
It is written to be read by coding agents as much as by people, and is generated from this
package's source — edit src/index.ts JSDoc, not this file.
Quick Start
import { Component } from '@angular/core'
import { ActivityTimeline, type TimelineEventData } from '@molecule/app-activity-timeline-angular'
@Component({
selector: 'app-activity',
standalone: true,
imports: [ActivityTimeline],
template: `
<div mol-activity-timeline [events]="events" [toneByKind]="tones">
<header slot="header">Today</header>
</div>
`,
})
export class ActivityPage {
events: TimelineEventData[] = []
tones = {
call: { icon: 'call', dotClass: 'bg-primary', iconClass: 'text-on-primary' },
email: { icon: 'mail', dotClass: 'bg-secondary' },
}
}
Type
feature
Installation
npm install @molecule/app-activity-timeline-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-ui @molecule/app-ui-angular
API
Interfaces
TimelineEventData
Single event displayed on the timeline. The kind drives the icon and
dot colour via the consumer-supplied toneByKind map on
<div mol-activity-timeline>.
interface TimelineEventData {
/** Stable row id (the render key). */
id: string
/** Event kind, matched against `toneByKind`. */
kind: string
/** Row heading: a template reference (a node), or text. */
title: string | number | TemplateRef<unknown>
/** Supporting line under the heading: a template reference, or text. */
description?: string | number | TemplateRef<unknown>
/** Reserved — not consumed; pass a pre-formatted `meta` instead. */
occurredAt?: string
/** Pre-formatted right-aligned label (e.g. "Mar 5", "2h ago"): a template reference, or text. */
meta?: string | number | TemplateRef<unknown>
/** Reserved — not consumed; wrap rows in a link via `rowWrapper` instead. */
href?: string
/** Extra footer content (badges, before/after chips, etc.): a template reference, or text. */
footer?: string | number | TemplateRef<unknown>
}
TimelineKindTone
Visual treatment for a particular event kind.
interface TimelineKindTone {
/**
* Material Symbols icon name (e.g. `'call'`, `'mail'`). Requires the
* Material Symbols Outlined font to be loaded in the app (e.g. via an
* `@molecule/app-fonts-*` bond) — without it the raw name renders as text.
*/
icon: string
/**
* Raw utility class string applied to the dot background (e.g. Tailwind
* `'bg-primary'`). NOTE: raw class strings couple the call site to the
* active styling bond — prefer semantic token classes and keep them out of
* shared code.
*/
dotClass?: string
/** Raw utility class string applied to the icon (e.g. `'text-on-primary'`). */
iconClass?: string
}
Classes
ActivityTimelineDot
ActivityTimelineDot component.
A single dot + icon marker. The host IS the dot's <div>
(div[mol-activity-timeline-dot]), matching React's root exactly. A
consumer-supplied dotClass/iconClass wins; the package defaults use theme
tokens (subtle primary fill + primary icon) that read correctly in both light
and dark — never a light-only literal.
@Component({
selector: 'div[mol-activity-timeline-dot]',
standalone: true,
inputs: ['tone', 'className'],
host: {
'[class]': 'classes()',
'[style.left]': "'0px'",
'[style.top]': "'0px'",
},
template: `<span [class]="iconClasses()">{{ icon() }}</span>`,
})
export class ActivityTimelineDot {
/** Visual treatment for the event's kind. */
tone!: TimelineKindTone
/** Extra classes on the dot. */
className?: string
/**
* The current class map.
* @returns The UIClassMap.
*/
cm(): UIClassMap {
return getClassMap()
}
/**
* Computes the dot's class list.
* @returns The class string.
*/
classes(): string {
const cm = this.cm()
return cm.cn(
cm.flex({ align: 'center', justify: 'center' }),
cm.w(6),
cm.h(6),
cm.position('absolute'),
cm.roundedFull,
this.tone?.dotClass ?? cm.bgPrimarySubtle,
this.tone?.iconClass ?? cm.textPrimary,
this.className,
)
}
/**
* Computes the icon span's class list.
* @returns The class string.
*/
iconClasses(): string {
return this.cm().cn(this.cm().textSize('xs'), this.cm().iconGlyphFont)
}
/**
* The icon name the span shows.
* @returns The Material Symbols icon name.
*/
icon(): string {
return this.tone?.icon ?? ''
}
}
ActivityTimelineRow
ActivityTimelineRow component.
A single row of <div mol-activity-timeline>: header / description / meta /
footer + a dot on the left, with the connector line drawn by the parent
container. The host IS the row's <div> (div[mol-activity-timeline-row]),
matching React's root exactly. Node-valued event fields are ng-template
references rendered through {@link NgTemplateOutlet}; string / number fields
render as text. wrapper is a template reference called with the row's own
content (a1) and the event (a0), as React's wrapper(children) render
prop is; its result replaces the row's content.
@Component({
selector: 'div[mol-activity-timeline-row]',
standalone: true,
imports: [NgTemplateOutlet, ActivityTimelineDot],
inputs: ['event', 'tone', 'wrapper'],
host: {
'[class]': 'classes()',
},
// prettier-ignore
template: `<ng-template #innerTpl><div mol-activity-timeline-dot [tone]="activeTone()"></div><div><div [class]="titleRowClasses()"><h3 [class]="titleClasses()">@if (isNode(event.title)) {<ng-container [ngTemplateOutlet]="templateOf(event.title)"></ng-container>}@else {{{ textOf(event.title) }}}</h3>@if (event.meta) {<span [class]="metaClasses()" style="white-space: nowrap">@if (isNode(event.meta)) {<ng-container [ngTemplateOutlet]="templateOf(event.meta)"></ng-container>}@else {{{ textOf(event.meta) }}}</span>}</div>@if (event.description) {<p [class]="descriptionClasses()">@if (isNode(event.description)) {<ng-container [ngTemplateOutlet]="templateOf(event.description)"></ng-container>}@else {{{ textOf(event.description) }}}</p>}@if (event.footer != null) {@if (isNode(event.footer)) {<ng-container [ngTemplateOutlet]="templateOf(event.footer)"></ng-container>}@else {{{ textOf(event.footer) }}}}</div></ng-template>@if (wrapper) {<ng-container [ngTemplateOutlet]="wrapper" [ngTemplateOutletContext]="wrapperContext(innerTpl)"></ng-container>}@else {<ng-container [ngTemplateOutlet]="innerTpl"></ng-container>}`,
})
export class ActivityTimelineRow {
/** The event the row shows. */
event!: TimelineEventData
/** Visual treatment for the event's kind. */
tone?: TimelineKindTone
/**
* Render the row inside a custom wrapper (a template reference whose context
* carries the event as `$implicit`/`a0` and the row's content as `a1`).
*/
wrapper?: TemplateRef<unknown>
/**
* The current class map.
* @returns The UIClassMap.
*/
cm(): UIClassMap {
return getClassMap()
}
/**
* Computes the row's class list.
* @returns The class string.
*/
classes(): string {
return this.cm().cn(this.cm().sp('pl', 10), this.cm().position('relative'))
}
/**
* The tone the dot renders (React's `tone ?? DEFAULT_TONE`).
* @returns The tone.
*/
activeTone(): TimelineKindTone {
return this.tone ?? DEFAULT_TONE
}
/**
* Computes the title row's class list.
* @returns The class string.
*/
titleRowClasses(): string {
const cm = this.cm()
return cm.cn(cm.flex({ justify: 'between', align: 'center' }), cm.sp('mb', 1))
}
/**
* Computes the title heading's class list.
* @returns The class string.
*/
titleClasses(): string {
return this.cm().cn(this.cm().textSize('sm'), this.cm().fontWeight('bold'))
}
/**
* Computes the meta label's class list.
* @returns The class string.
*/
metaClasses(): string {
const cm = this.cm()
return cm.cn(cm.fontWeight('medium'), cm.textSize('xs'), cm.textMuted, cm.uppercase)
}
/**
* Computes the description's class list.
* @returns The class string.
*/
descriptionClasses(): string {
return this.cm().cn(this.cm().textSize('xs'), this.cm().textMuted)
}
/**
* The context a wrapper template renders with.
* @param inner - The row's own content as a template.
* @returns The template context.
*/
wrapperContext(inner: TemplateRef<unknown>): Record<string, unknown> {
return { $implicit: this.event, a0: this.event, a1: inner, a2: undefined }
}
/**
* Whether a field holds a node (an `ng-template` reference) rather than text.
* @param value - The row field.
* @returns True when it renders through a template outlet.
*/
isNode(value: unknown): value is TemplateRef<unknown> {
return value instanceof TemplateRef
}
/**
* Narrows a value to an embedded template.
* @param value - A row field.
* @returns The template, or null.
*/
templateOf(value: unknown): TemplateRef<unknown> | null {
return value instanceof TemplateRef ? value : null
}
/**
* The text a field renders (React renders strings and numbers as text).
* @param value - The row field.
* @returns The text, or `''` for a node field.
*/
textOf(value: unknown): string {
return typeof value === 'string' || typeof value === 'number' ? String(value) : ''
}
}
ActivityTimeline
ActivityTimeline component.
Vertical timeline with connector rail and per-kind dot markers. The host IS
the panel <div> (div[mol-activity-timeline]), matching React's root
exactly: header content, the rail + rows stack, then footer content.
Node props are projected content ([slot=header] / [slot=footer]) or
template-reference inputs, as an input cannot carry a node; a plain string or
number renders as text. rowWrapper is a template reference called with each
event (a0) and the row's own content (a1), as React's render prop is.
@Component({
selector: 'div[mol-activity-timeline]',
standalone: true,
imports: [NgTemplateOutlet, ActivityTimelineRow],
inputs: ['events', 'toneByKind', 'defaultTone', 'rowWrapper', 'header', 'footer', 'className'],
host: {
'[class]': 'classes()',
},
// The template's whitespace is semantic (Angular keeps whitespace-only text
// nodes between elements), so every block is glued and no literal text
// separates them.
// prettier-ignore
template: `@if (isNode(header)) {<ng-container [ngTemplateOutlet]="templateOf(header)"></ng-container>}@else if (header != null) {{{ textOf(header) }}}<ng-content select="[slot=header]"></ng-content><div [class]="stackClasses()"><span aria-hidden="true" [class]="railClasses()" style="position: absolute; left: 0.75rem; top: 0.5rem; bottom: 0.5rem; width: 1px"></span>@for (event of events; track event.id) {<div mol-activity-timeline-row [event]="event" [tone]="toneOf(event)" [wrapper]="rowWrapper"></div>}</div>@if (isNode(footer)) {<ng-container [ngTemplateOutlet]="templateOf(footer)"></ng-container>}@else if (footer != null) {{{ textOf(footer) }}}<ng-content select="[slot=footer]"></ng-content>`,
})
export class ActivityTimeline {
/** The events to stack, in display order. */
events: TimelineEventData[] = []
/** Visual treatment per event kind. Falls back to a generic dot for unknown kinds. */
toneByKind?: Record<string, TimelineKindTone>
/** Default tone applied when `toneByKind` doesn't list the event's kind. */
defaultTone?: TimelineKindTone
/**
* Wrap each row (e.g. with a router link), as a template reference whose
* context carries the event as `$implicit`/`a0` and the row's content as `a1`.
*/
rowWrapper?: TemplateRef<unknown>
/** Slot rendered above the timeline (heading, filters, etc.). */
header?: unknown
/** Slot rendered below the timeline (load-more link, footer chips, etc.). */
footer?: unknown
/** Extra classes on the panel. */
className?: string
/**
* The current class map.
* @returns The UIClassMap.
*/
cm(): UIClassMap {
return getClassMap()
}
/**
* Computes the panel's class list.
* @returns The class string.
*/
classes(): string {
const cm = this.cm()
return cm.cn(cm.card(), cm.sp('p', 6), this.className)
}
/**
* Computes the rows stack's class list.
* @returns The class string.
*/
stackClasses(): string {
return this.cm().cn(this.cm().stack(8), this.cm().position('relative'))
}
/**
* Computes the connector rail's class list.
* @returns The class string.
*/
railClasses(): string {
return this.cm().cn(this.cm().bgBorder)
}
/**
* The tone a row renders: its kind's entry, else the case default, else the
* generic dot.
* @param event - The row's event.
* @returns Its tone.
*/
toneOf(event: TimelineEventData): TimelineKindTone {
return this.toneByKind?.[event.kind] ?? this.defaultTone ?? FALLBACK_TONE
}
/**
* Whether a prop holds a node (an `ng-template` reference) rather than text.
* @param value - The prop.
* @returns True when it renders through a template outlet.
*/
isNode(value: unknown): value is TemplateRef<unknown> {
return value instanceof TemplateRef
}
/**
* Narrows a value to an embedded template.
* @param value - A node-valued prop.
* @returns The template, or null.
*/
templateOf(value: unknown): TemplateRef<unknown> | null {
return value instanceof TemplateRef ? value : null
}
/**
* The text a prop renders (React renders strings and numbers as text).
* @param value - The prop.
* @returns The text, or `''` for a node value.
*/
textOf(value: unknown): string {
return typeof value === 'string' || typeof value === 'number' ? String(value) : ''
}
}
Injection Notes
Requirements
Peer dependencies:
@angular/common ^22.0.0
@angular/core ^22.0.0
@angular/platform-browser ^22.0.0
@molecule/app-angular ^3.5.0 || ^4.0.0
@molecule/app-ui ^1.3.11
@molecule/app-ui-angular ^1.1.0
Runtime Dependencies
-
@angular/common
-
@angular/core
-
@angular/platform-browser
-
@molecule/app-angular
-
@molecule/app-ui
-
@molecule/app-ui-angular
-
Requires a bonded ClassMap (getClassMap()); rendering throws otherwise.
-
Node props are projected content ([slot=header], [slot=footer]) or
template-reference inputs; node-valued event fields (title,
description, meta, footer) are template references or plain text.
-
rowWrapper is a template reference called with the event (a0) and the
row's own content (a1), as React's render prop is; its result replaces
the row's content, so a wrapper that shows the row renders the a1
template it is given.
-
Rows are tracked by event.id (@for (… ; track event.id)), so a
re-passed or re-ordered event list keeps each row's DOM the way React's
key does.