Skip to content

Timeline

A vertical list of events, each with a colored marker, a time, a title, and an optional body.

Decision

When Use
A short feed of what happened and when Timeline
A long history Paginated Table

Usage

import { createTimeline } from './configurationpage?name=myplugin_stolon.js';

container.appendChild(createTimeline({
    items: [{ time: '10:04', title: 'Library synced', body: '1,204 items.', status: 'green' }]
}).element);

Classes: stolon-timeline, stolon-timeline-item, stolon-timeline-marker. The handle is { element, getValue, setValue, setItems, setHeight, destroy }.

Parts: stolon-timeline-body, stolon-timeline-empty, stolon-timeline-text, stolon-timeline-time, stolon-timeline-title, stolon-timeline-wrap.

States and Modifiers

  • An item is { time, datetime, title, body, pre, status, icon }. pre is a block of mono text kept as written, such as a log or a stack trace, under the body, as stolon-timeline-pre. status is a status color name that colors the marker, and icon is a Material icon name, an icon for the status by default.
  • A datetime makes the time a time element.
  • A status also shows an icon in its marker and a hidden label, so the status never rests on color alone. statusLabels maps a status color name to the hidden label, such as { green: 'Done' }.
  • emptyText is a sentence shown while there are no events. It is the List's empty sentence, stolon-list-empty outside stolon-timeline-empty, after the events, and nothing shows without it.
  • The events are a List, so height, maxHeight, minHeight, and setHeight work as they do there. height is 'auto' by default, so the timeline grows with its events.

Reference

Generated from the code by scripts/build-docs.mjs. Edit the code, not this section.

createTimeline

function createTimeline(options?: TimelineOptions): TimelineHandle

A vertical list of events, each with a colored marker, a time, a title, and an optional body. A status also shows an icon in its marker and a hidden label, so the status never rests on color alone.

Option Type What it does
items TimelineItem[] array of { time, datetime, title, body, pre, status, icon } where pre is mono text kept as written, under the body, and status is a status color name such as 'green', and icon is a Material icon name (default an icon for the status) [optional]
emptyText string sentence shown while there are no events [optional]
statusLabels Record<string, string> map of status color name to the hidden label a screen reader reads, such as { green: 'Done' } (default a word for each color) [optional]
height ListHeight the list's height, 'auto', 'fill', a number of pixels, or a CSS length (default 'auto')
maxHeight number | string | null the most the list grows to before it scrolls [optional]
minHeight number | string | null the least a filling list takes (default 160px) [optional]
Handle member Type
getValue (): TimelineItem[]
setValue (next: TimelineItem[]): void
setItems (next: TimelineItem[]): void
setHeight (height: ListHeight, maxHeight?: number | string | null): void
destroy (): void
Type What it is
TimelineItem One event on a timeline. status is a status color name, icon a Material icon name, and pre a block of mono text kept as written, such as a log or a stack trace.
Class What it looks like
stolon-timeline Vertical list of events joined by a line, each with a colored marker
stolon-timeline-marker Round marker in the status color, with an optional icon in it
stolon-timeline-pre A block of mono text kept as written under an event's body, such as a log or a stack trace, which scrolls sideways inside itself

Example

Example Code

<!-- title: Timeline -->
<div id="mount"></div>
<script type="module">
const base = await window.__baseReady;
const view = document.getElementById('view');
const mount = document.getElementById('mount');
mount.appendChild(base.createTimeline({ items: [
    { time: '10:00', datetime: '2026-03-10T10:00', title: 'Sync started', body: 'Two servers in the pool.', status: 'purple', icon: 'sync' },
    { time: '10:04', title: 'Library synced', body: '1,204 items.', status: 'green', icon: 'check' },
    { time: '10:07', title: 'Could not reach a server', status: 'red' }
] }).element);
</script>