Skip to content
EspañolEnglish
All components (204)

Timeline

Dates and time · Timeline · .amset-timeline

What it is and when to use it

The work plan in bars: what goes from day such-and-such to day so-and-so and how much of it is done. A home-made Gantt, without dependencies between tasks. As in the rest of the charts in the library, the drawing is the adornment and the table is the data: below goes a real table with dates, duration and progress, hidden from view unless requested.

When to use it

  • The plan for a launch, a collection, a construction job: a few tasks with a start date (from) and an end date (to).
  • progress (from 0 to 100) draws the finished part inside the bar; tone on a task colors it with the common vocabulary (accent, info, success, warning, error or neutral), and tone on the timeline colors all those that do not bring their own. detail goes in the table.
  • range so that two timelines share a scale, and tableVisible when the table also has to be seen. withToday={false} removes the today line.

When not to

  • Events of one day in the month: MonthAgenda.
  • A process in phases that advances in order: Steps.
  • Comparing quantities: BarChart.

Keyboard: it is not interactive and has no Tab stops. The bars cannot be pressed: they are part of an image.

Accessibility: the drawing is an image with the summary written in its name ("Autumn collection plan. 5 tasks, from September 1 to October 15. The longest, Casting, 16 days."). The table is always in the DOM with its caption, even if it is not seen. The months and the today line are decoration. The bars are measured in calendar days counted in UTC, so that the clock change does not introduce a 23-hour day and throw the width off.

Sizes: bars 20, 24 or 32 px tall, with the names column at 7, 9 or 11 rem and its font.

Dates on the bar: the span as the language writes it ("Sep 10–25", "Sep 21 – Oct 5", "Oct 15" if it is a single day). If it does not fit it ends in "…", and on a bar narrower than 3 rem it is not drawn; in full it is in the bar's title and in the table.

Motion: the bars enter growing from their start, what is done grows behind them and the today line appears once they have arrived. If the dates change, the bars slide to their place. With reduced motion, none of that.

Fine-tuning: --amset-timeline-name is the width of the names column: the month header, the bars and the today line are placed starting from it. Also -height (the bars), -slot (between rows), -font (the names), -description (months, dates and table), -radius, -track (the background of each row), -bar and -bar-ink (the fill and the color of its dates), -progress (what is done, on top of the bar), -today and -today-width.

Context: it goes inside LocaleProvider (or AmsetProvider), which decides how months and dates are written.

What it looks like

Project plan
TaskStartsEndsDaysDone
DesignOct 1Oct 1010—
DevelopmentOct 8Oct 2821—
TestsOct 24Nov 412—

<Timeline
  label="Project plan"
  tasks={[
    { key: 'dis', title: 'Design', from: '2026-10-01', to: '2026-10-10' },
    { key: 'dev', title: 'Development', from: '2026-10-08', to: '2026-10-28' },
  ]}
/>

Props

Import it with import { Timeline } from '@amset/ui'. Required props are marked.

PropTypeWhat it does
labelrequiredstringWhat the plan is about. Required: it names the whole drawing.
tasksrequiredreadonly TimelineTask[]—
classNamestringMerged with the library classes; it does not replace them.
emptystring—
rangeDateRangeManual range, so that two timelines share a scale.
size"sm" | "md" | "lg"Bars of 20, 24 or 32 px, with their column of names and their font.
tableVisiblebooleanAlso shows the table. For the screen reader it is always there.
todayDate—
tone"neutral" | "accent" | "secondary" | "tertiary" | "info" | "success" | "warning" | "error"The color of the bars that do not bring their own `tone`. `accent` by default.
withTodaybooleanMarks today's date with a line.

It also accepts the attributes of the element it renders: className, style, data-*, aria-* and its events.

CSS variables

These CSS variables are how you adapt it. Declare them on the component's selector, not on :root: the stylesheet redeclares them in the rule itself, and a declaration on the same element always wins.

VariableDefault
--amset-timeline-name9rem
--amset-timeline-height1.5rem
--amset-timeline-slotvar(--amset-space-2)
--amset-timeline-fontvar(--amset-text-sm)
--amset-timeline-descriptionvar(--amset-text-xs)
--amset-timeline-radiusvar(--amset-radius-sm)
--amset-timeline-trackvar(--amset-surface-2)
--amset-timeline-barvar(--amset-accent)
--amset-timeline-bar-inkvar(--amset-accent-ink)
--amset-timeline-progresscolor-mix(in oklab, var(--amset-highlight) 30%, transparent)
--amset-timeline-todayvar(--amset-error)
--amset-timeline-today-width2px

How to change it

.amset-timeline {
  --amset-timeline-name: ...;
  --amset-timeline-height: ...;
}

In the test bench

Every state and variant, to try one at a time, on its page at ui.amset.tech: