npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@molecule/app-timeline-angular

v1.1.1

Published

Angular chronological timeline with event rails and date markers

Readme

@molecule/app-timeline-angular

Angular chronological timeline primitives.

Exports:

  • <mol-timeline> / Timeline — vertical list of events with optional date separators.
  • <div mol-timeline-event> / TimelineEvent — one event row with rail (marker + connector) + content.
  • <div mol-timeline-rail> / TimelineRail — standalone rail (marker + connector) for custom rows.
  • <div mol-timeline-date> / TimelineDate — date separator rendered between groups.
  • TimelineEventData type for event records.

Use for activity chronologies, deal timelines, order tracking, audit logs. It is the Angular counterpart of @molecule/app-timeline-react: the same props (React names) and the same DOM for the same input, so switching framework is changing the package name in the imports.

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 { Timeline, TimelineDate } from '@molecule/app-timeline-angular'

@Component({
  selector: 'app-activity',
  standalone: true,
  imports: [Timeline, TimelineDate],
  template: `
    <mol-timeline [events]="events">
      <p slot="emptyState">No activity yet.</p>
    </mol-timeline>
  `,
})
export class Activity {
  events = [
    { id: '1', timestamp: '2 hours ago', title: 'Order placed' },
    { id: '2', timestamp: 'Yesterday', title: 'Payment confirmed', body: 'Visa ending 4242' },
    { id: '3', timestamp: 'Mar 12', title: 'Item shipped' },
  ]
}

Type

feature

Installation

npm install @molecule/app-timeline-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-ui @molecule/app-ui-angular

API

Interfaces

TimelineEventData

One entry of a <Timeline>. Node fields are ng-template references (a projected node) or plain text, since an input cannot carry a DOM node.

interface TimelineEventData {
  /** Stable identifier for this event (the row is tracked by it, like React's key). */
  id: string
  /** Marker icon / dot — defaults to a small dot. */
  marker?: string | number | TemplateRef<unknown>
  /** Display timestamp (ISO, relative, etc.). */
  timestamp: string | number | TemplateRef<unknown>
  /** Headline of the event. */
  title: string | number | TemplateRef<unknown>
  /** Optional body content. */
  body?: string | number | TemplateRef<unknown>
  /**
   * Optional accent color hint. Currently INERT — no component consumes it,
   * so setting it changes nothing; pass a custom `marker` node to color a row.
   */
  accent?: 'primary' | 'success' | 'warning' | 'error' | 'info' | 'neutral'
}

TimelineProps

Props accepted by {@link Timeline} — the same props @molecule/app-timeline-react accepts. emptyState is a template reference passed as an input (or projected content in a host template); the callback prop renderDateSeparator is a template reference whose context carries the event as $implicit / a0 and its predecessor as a1.

interface TimelineProps {
  /** Events in display order. */
  events: TimelineEventData[]
  /** Optional renderer for date separators between consecutive events. */
  renderDateSeparator?: TemplateRef<unknown>
  /** Rendered when there are no events. */
  emptyState?: string | number | TemplateRef<unknown>
  /** Extra classes on the outer wrapper. */
  className?: string
}

TimelineEventProps

Props accepted by {@link TimelineEvent} — the same props @molecule/app-timeline-react accepts.

interface TimelineEventProps {
  /** The event to render. */
  event: TimelineEventData
  /** Whether this is the last event in the list (suppresses the connector). */
  isLast?: boolean
  /** Extra classes. */
  className?: string
}

TimelineRailProps

Props accepted by {@link TimelineRail} — the same props @molecule/app-timeline-react accepts.

interface TimelineRailProps {
  /** Marker for this row — typically a dot or icon. */
  marker?: string | number | TemplateRef<unknown>
  /** Whether to render the vertical connector below the marker. Defaults to `true`. */
  connector?: boolean
  /** Extra classes on the outer wrapper. */
  className?: string
}

TimelineDateProps

Props accepted by {@link TimelineDate} — the same props @molecule/app-timeline-react accepts. children is projected content in Angular (an input cannot carry a node), so it is typed unknown: pass it in the host template, not as a value.

interface TimelineDateProps {
  /** Date label ("Today", "Yesterday", "March 12, 2025"), as projected content. */
  children?: unknown
  /** Extra classes. */
  className?: string
}

Classes

TimelineDate

TimelineDate component.

Date separator rendered between timeline groups. The host IS the separator's outer <div> (div[mol-timeline-date]), matching React's root exactly, and the label is projected content (the default <ng-content>).

This is the Angular counterpart of @molecule/app-timeline-react's TimelineDate: the same props (React names), the same ClassMap tokens, and the same DOM for the same input.

@Component({
  selector: 'div[mol-timeline-date]',
  standalone: true,
  inputs: ['className'],
  host: {
    '[class]': 'classes()',
  },
  template: `<span [class]="cm().cn(cm().flex1)"><ng-content></ng-content></span>`,
})
export class TimelineDate {
  /** Extra classes. */
  className?: string

  /**
   * The current class map.
   * @returns The UIClassMap.
   */
  cm(): UIClassMap {
    return getClassMap()
  }

  /**
   * Computes the separator's class list.
   * @returns The class string.
   */
  classes(): string {
    return this.cm().cn(
      this.cm().flex({ align: 'center', gap: 'sm' }),
      this.cm().sp('py', 2),
      this.cm().textSize('xs'),
      this.cm().fontWeight('semibold'),
      this.className,
    )
  }
}

TimelineEvent

TimelineEvent component.

One row of a <Timeline>: [rail (marker + connector)] [timestamp / title / body]. The host IS the row's outer <div> (div[mol-timeline-event]), matching React's root exactly. The event's node-valued fields are ng-template references rendered through NgTemplateOutlet; string / number fields render as text.

This is the Angular counterpart of @molecule/app-timeline-react's TimelineEvent: the same props (React names), the same ClassMap tokens, and the same DOM for the same input.

@Component({
  selector: 'div[mol-timeline-event]',
  standalone: true,
  imports: [NgTemplateOutlet, TimelineRail],
  inputs: ['event', 'isLast', 'className'],
  host: {
    '[class]': 'classes()',
  },
  // prettier-ignore
  template: `<div mol-timeline-rail [marker]="event.marker" [connector]="!isLast"></div><div [class]="contentClasses()"><div [class]="timestampClasses()">@if (isNode(event.timestamp)) {<ng-container [ngTemplateOutlet]="templateOf(event.timestamp)" />}@else {{{ textOf(event.timestamp) }}}</div><div [class]="titleClasses()">@if (isNode(event.title)) {<ng-container [ngTemplateOutlet]="templateOf(event.title)" />}@else {{{ textOf(event.title) }}}</div>@if (event.body) {<div [class]="cm().textSize('sm')">@if (isNode(event.body)) {<ng-container [ngTemplateOutlet]="templateOf(event.body)" />}@else {{{ textOf(event.body) }}}</div>}</div>`,
})
export class TimelineEvent {
  /** The event to render. */
  event!: TimelineEventData
  /** Whether this is the last event in the list (suppresses the connector). */
  isLast?: boolean
  /** Extra classes. */
  className?: string

  /**
   * 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().flex({ align: 'stretch', gap: 'sm' }), this.className)
  }

  /**
   * Computes the content column's class list.
   * @returns The class string.
   */
  contentClasses(): string {
    return this.cm().cn(this.cm().flex1, this.cm().stack(1), this.cm().sp('pb', 4))
  }

  /**
   * Computes the timestamp line's class list.
   * @returns The class string.
   */
  timestampClasses(): string {
    return this.cm().cn(this.cm().textSize('xs'), this.cm().fontWeight('medium'))
  }

  /**
   * Computes the title line's class list.
   * @returns The class string.
   */
  titleClasses(): string {
    return this.cm().cn(this.cm().textSize('sm'), this.cm().fontWeight('semibold'))
  }

  /**
   * Whether a field holds a node (an `ng-template` reference) rather than text.
   * @param value - The event 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 - The event 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 event field.
   * @returns The text, or `''` for a node field.
   */
  textOf(value: unknown): string {
    return typeof value === 'string' || typeof value === 'number' ? String(value) : ''
  }
}

TimelineRail

TimelineRail component.

Left-hand rail of a timeline row — renders the marker (a default dot when none is given) and an optional vertical connector extending downward. The host IS the rail's outer <div> (div[mol-timeline-rail]), matching React's root exactly. A node-valued marker is an ng-template reference rendered through NgTemplateOutlet; the connector's inline style is applied the way React applies it (through the CSSOM), so the serialized attribute matches.

This is the Angular counterpart of @molecule/app-timeline-react's TimelineRail: the same props (React names), the same ClassMap tokens, and the same DOM for the same input.

@Component({
  selector: 'div[mol-timeline-rail]',
  standalone: true,
  imports: [NgTemplateOutlet],
  inputs: ['marker', 'connector', 'className'],
  host: {
    '[class]': 'classes()',
  },
  template: `<div>
      @if (markerTemplate(); as marker) {
        <ng-container [ngTemplateOutlet]="marker" />
      } @else if (markerText() !== null) {
        {{ markerText() }}
      } @else {
        <span aria-hidden="true">•</span>
      }
    </div>
    @if (hasConnector()) {
      <div [class]="connectorClasses()" [style]="connectorStyle()"></div>
    }`,
})
export class TimelineRail {
  /** Marker for this row, as a template reference or plain text. */
  marker?: string | number | TemplateRef<unknown>
  /** Whether to render the vertical connector below the marker (defaults to `true`). */
  connector?: boolean
  /** Extra classes on the outer wrapper. */
  className?: string

  /**
   * The current class map.
   * @returns The UIClassMap.
   */
  cm(): UIClassMap {
    return getClassMap()
  }

  /**
   * Computes the outer rail class list.
   * @returns The class string.
   */
  classes(): string {
    return this.cm().cn(
      this.cm().flex({ direction: 'col', align: 'center' }),
      this.cm().shrink0,
      this.className,
    )
  }

  /**
   * React's `connector = true` default: an absent input keeps the connector.
   * @returns Whether the connector renders.
   */
  hasConnector(): boolean {
    return this.connector ?? true
  }

  /**
   * Whether the marker holds a node (an `ng-template` reference) rather than text.
   * @returns True when it renders through a template outlet.
   */
  markerTemplate(): TemplateRef<unknown> | null {
    return this.marker instanceof TemplateRef ? this.marker : null
  }

  /**
   * The text a marker renders (React renders strings and numbers as text).
   * @returns The text, or null when the marker is a node or absent.
   */
  markerText(): string | null {
    if (typeof this.marker === 'string') return this.marker
    if (typeof this.marker === 'number') return String(this.marker)
    return null
  }

  /**
   * Computes the connector's class list (`cm.w(0)` + `cm.h('full')`).
   * @returns The class string.
   */
  connectorClasses(): string {
    return this.cm().cn(this.cm().w(0), this.cm().h('full'))
  }

  /**
   * The connector's inline style, exactly React's object.
   * @returns The style declarations.
   */
  connectorStyle(): Record<string, string> {
    return { 'border-left': '1px solid currentColor', opacity: '0.2', 'min-height': '24px' }
  }
}

Timeline

Timeline component.

Vertical chronological list of events, each rendered with a marker + connector on the left (<div mol-timeline-event>). Optional date separators come from renderDateSeparator, a template reference whose context carries the event as $implicit / a0 and its predecessor as a1.

React's root is the wrapper <div> — or, with no events and an empty state, that empty state alone (a fragment). Everything the host holds (the empty state's capture and the wrapper <div>) renders in the host's place and the host itself leaves the page, so the fragment root is React's exact DOM. The empty state is projected content ([slot=emptyState]) or a template reference passed as an input, reconciled against React's branch by the placement function registered in the constructor. Rows are tracked by the event's id value (@for (…; track event.id)), like React's per-item keys.

This is the Angular counterpart of @molecule/app-timeline-react's Timeline: the same props (React names), the same ClassMap tokens, and the same DOM for the same input.

@Component({
  selector: 'mol-timeline',
  standalone: true,
  hostDirectives: [MolPlacement],
  imports: [NgTemplateOutlet, TimelineEvent],
  inputs: ['events', 'renderDateSeparator', 'emptyState', 'className'],
  // prettier-ignore
  template: `<span #empty>@if (emptyText(); as text) {{{ text }}}@if (emptyTemplate(); as empty) {<ng-container [ngTemplateOutlet]="empty"></ng-container>}<ng-content select="[slot=emptyState]"></ng-content></span><div #list [class]="classes()">@for (event of events; track event.id; let i = $index) {<div>@if (separatorTemplate(); as separator) {<ng-container [ngTemplateOutlet]="separator" [ngTemplateOutletContext]="separatorContext(event, i)"></ng-container>}<div mol-timeline-event [event]="event" [isLast]="i === events.length - 1"></div></div>}</div>`,
})
export class Timeline {
  /** Events in display order. */
  events: TimelineEventData[] = []
  /** Optional renderer for date separators: a template reference with the event in its context. */
  renderDateSeparator?: TemplateRef<unknown>
  /** Rendered when there are no events: a template reference, plain text, or `[slot=emptyState]`. */
  emptyState?: unknown
  /** Extra classes on the outer wrapper. */
  className?: string

  /** The projected empty-state capture point (its content renders in its place, and it leaves the page). */
  @ViewChild('empty') private empty?: ElementRef<HTMLElement>

  /** The wrapper `<div>` (detached when the empty state renders instead). */
  @ViewChild('list') private list?: ElementRef<HTMLElement>

  private readonly host: ElementRef<HTMLElement> = inject(ElementRef)

  constructor() {
    // React's root is the wrapper `<div>`, or the empty state alone (a fragment): the
    // host's content renders in the host's place and the host itself leaves the page.
    usePlacement((hasContent) => this.reconcile(hasContent))
  }

  /**
   * The current class map.
   * @returns The UIClassMap.
   */
  cm(): UIClassMap {
    return getClassMap()
  }

  /**
   * Computes the outer wrapper's class list (`cm.stack(0)` + `className`).
   * @returns The class string.
   */
  classes(): string {
    return this.cm().cn(this.cm().stack(0), this.className)
  }

  /**
   * React's branch: with no events, the empty state renders bare (its
   * template when it is a node).
   * @returns The empty-state template, or null.
   */
  emptyTemplate(): TemplateRef<unknown> | null {
    if (this.events.length !== 0 || !this.emptyState) return null
    return this.emptyState instanceof TemplateRef ? this.emptyState : null
  }

  /**
   * React's branch: with no events, a text empty state renders bare.
   * @returns The empty-state text, or null when the wrapper renders instead.
   */
  emptyText(): string | null {
    if (this.events.length !== 0 || !this.emptyState) return null
    if (this.emptyState instanceof TemplateRef) return null
    return String(this.emptyState)
  }

  /**
   * The date-separator template, when the caller supplied one.
   * @returns The template, or null.
   */
  separatorTemplate(): TemplateRef<unknown> | null {
    return this.renderDateSeparator instanceof TemplateRef ? this.renderDateSeparator : null
  }

  /**
   * The separator template's context: React's `renderDateSeparator(event, prev)`
   * arguments as `$implicit` / `a0` (the event) and `a1` (its predecessor).
   * @param event - The event the separator precedes.
   * @param index - The event's index in the list.
   * @returns The template context.
   */
  separatorContext(event: TimelineEventData, index: number): Record<string, unknown> {
    const prev = index > 0 ? this.events[index - 1] : undefined
    return { $implicit: event, a0: event, a1: prev, a2: undefined }
  }

  /**
   * Applies React's condition: with no events and an empty state, the empty
   * state renders bare and the wrapper disappears; otherwise the wrapper
   * renders and the empty state is dropped.
   *
   * @param hasContent - Reads whether a slot has content.
   */
  private reconcile(hasContent: SlotReader): void {
    const host = this.host.nativeElement
    const empty = this.empty?.nativeElement
    const list = this.list?.nativeElement
    const hasEmpty = (this.events?.length ?? 0) === 0 && hasContent(empty)
    if (hasEmpty) {
      // The capture's content renders exactly where the capture stood, and the capture
      // itself leaves the page.
      placeContentBefore(empty, empty)
    } else {
      // Back inside the capture, so it leaves the page with it.
      placeContent(empty, null)
    }
    setElementPresent(empty, false)
    setElementPresent(list, !hasEmpty)
    // React's root is the fragment: everything renders in the host's place, and the host
    // itself leaves the page.
    placeContentBefore(host, host)
    setElementPresent(host, false)
  }
}

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.13.0
  • @molecule/app-ui ^1.0.1
  • @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

This is NOT the Angular binding for @molecule/app-timeline (the headless provider core wired via setProvider) — it is standalone presentational markup with no provider. For domain-specific rows see the sibling packages @molecule/app-activity-timeline-angular, @molecule/app-order-timeline-angular, @molecule/app-status-timeline-angular, @molecule/app-stage-timeline-angular and @molecule/app-day-timeline-angular.

TimelineEventData.accent is currently INERT — no component reads it, so setting it changes nothing; color a row by passing a custom marker node instead. timestamp is a display node — format/translate it before passing. Node-valued props are ng-template references; Timeline's root is a fragment in its empty branch, so its content renders in the host's place and the host itself leaves the page, and rows are tracked by the event's id, like React's keys. The prop surface (documented on the exported TimelineProps, TimelineEventProps, TimelineRailProps and TimelineDateProps interfaces): Timeline(events, renderDateSeparator, emptyState, className), TimelineEvent(event, isLast, className), TimelineRail(marker, connector, className), TimelineDate(children, className).