Skip to content

Timeline ​

An ordered list of events: an order's history, a project's milestones, an activity feed.

Timeline demo. Data is embedded and nothing is saved.
php
<?php

use Caelrik\Ui\Components\Timeline;
use Caelrik\Ui\Support\Html;

return [
    Html::raw('<div class="row g-4"><div class="col-md-5"><h2 class="h5">Order 1042</h2>'),
    Timeline::make('order')->label('Order history')
        ->event('Order placed', new DateTimeImmutable('2026-11-01 09:30'), 'Paid by card.', 'success', '✓')
        ->event('Packed', new DateTimeImmutable('2026-11-02 14:00'), color: 'success', marker: '✓')
        ->event(
            'Shipped',
            'Yesterday',
            Html::raw('<p>Tracking number <a href="#tracking">TR-1042</a></p>'),
            marker: '3',
            current: true,
        )
        ->event('Delivered', 'Expected Friday', marker: '4'),
    Html::raw('</div><div class="col-md-7"><h2 class="h5">Project history</h2>'),
    Timeline::make('history')->label('Project history')->alternate()
        ->event('Founded', new DateTimeImmutable('2024-03-01'), 'Two people and a grid.', color: 'info')
        ->event('First release', new DateTimeImmutable('2025-01-15'), 'Grid, forms and charts.', color: 'primary')
        ->event('Version 0.4', new DateTimeImmutable('2026-11-19'), 'Navigation and layout.', 'success', current: true)
        ->event('Version 1.0', 'Next year', 'Stable.', color: 'warning'),
    Html::raw('</div></div>'),
];

Usage ​

php
use Caelrik\Ui\Components\Timeline;

Timeline::make('order')
    ->label('Order history')
    ->event('Order placed', new DateTimeImmutable('2026-11-01 09:30'), 'Paid by card.', color: 'success', marker: '✓')
    ->event('Shipped', 'Yesterday', Html::raw('<p>Tracking <a href="/track/1042">TR-1042</a></p>'), current: true)
    ->event('Delivered', 'Expected Friday');

event() takes:

Argument
titleThe event's name (text).
timeA date, shown in the dateFormat() ("M j, Y" by default) inside a <time datetime> element; or a text such as "Yesterday".
contentText, or HTML from a component or Html::raw().
colorThe marker's color: primary, secondary, success, danger, warning, info.
markerA short text in the marker ("✓", "3").
urlMakes the title a link (relative, http or https).
currentThe current step. Only one event is current.

Options ​

  • label() names the list for screen readers: "Order history, list, 4 items".
  • headingLevel(3) makes the titles headings, to move from event to event with a screen reader's heading keys. They are paragraphs by default.
  • alternate() puts the events on both sides of the line on wide screens, and on one side on phones.

Accessibility ​

  • An ordered list (<ol>): screen readers say how many events there are and where they are.
  • The current step has aria-current="step", and its marker has a ring: it is not shown by color alone. Colors and markers are decorative; the title and the text tell the event.
  • Dates are <time> elements with a machine-readable datetime.
  • The line is a border, so it stays visible in forced-colors mode. Plain HTML: no JavaScript.

Released under the MIT License.