Timeline
Event history with directions, times, loading, icons and theme settings.
When to use
Timeline shows the history of related events and the order in which they occur: delivery, project changes, or process log. It does not control the passage of stages; for an interactive multi-step task, use Steps.
Events and story order
items contains title, content and an optional persistent key. color sets the color of the node, icon — its own icon. loading marks a wait event; reverse reverses the visual order while preserving the application's original data.
| Problem | Setting | Example |
|---|---|---|
| Show sequence | items |
Main story |
| Indicate expectation | item.loading, reverse |
Loading and order |
| Alternate sides | mode="alternate" |
Alternation |
| Separate time from content | title, content |
Signatures |
| Set horizontal axis | orientation="horizontal" |
Horizontal placement |
| Add event action | snippet in content |
Own node |
The loading label does not load the data itself. The application adds or updates the corresponding item after the result of the operation. Events should have a text state: a single color or spinning icon does not explain what happened.
Axis, sides and header space
orientation selects vertical/horizontal. Mode:start/end/alternate determines the side of events relative to the line; a separate item can specify placement:start/end. Logical sides follow the direction of the interface.
titleSpan specifies the space to the center of the node. Number is the fraction of the 24-column grid, line is the CSS length, including percentages. With alternate, the numeric titleSpan is not applied. For a long horizontal story, keep the scrolling local, as in the example, without expanding the entire page.
Variant:outlined/filled changes the design of nodes. Icon accepts text content or a snippet; native buttons inside content retain their own semantics and keyboard. Timeline does not sort entries by date: prepare the desired order of items in advance.
Semantic DOM and theme
Root - ol with elements of history. Content may include links, times and actions; Use clear signatures and times where machine-readable times are important to your application.
Throughout the Timeline semantic, names are prefixed with item: itemTitle/itemContent/itemRail. A single event uses title/content/rail. Item classNames/styles specify general settings. styles contains CSS strings; semantic example shows both levels.
Timeline design tokens are applied via theme.components.Timeline and change the line, nodes and padding. The topic can be updated independently of the event array; bind:nativeElement provides the root ol after mount. This design does not automatically filter or paginate the story.
ConfigProvider.timeline accepts TimelineConfig: class, style, classNames and styles; data and behavior remain props of the Timeline. Semantic defaults support callback of current props. The classes add up; for root, provider styles.root, provider style, local styles.root, local style are used. For events, local styles and item styles take precedence over general ones. The nested timeline={} replaces the entire record Timeline. Example settings shows these levels.
A separate ConfigProvider.steps passes only the root class/style to the Timeline: the semantic settings of Steps do not style Timeline events. Resetting timeline={} does not disable steps.class/style; this also requires steps={}.
Local prefixCls changes the namespace of the root, states, and Timeline nodes. A non-empty local prefix takes precedence; empty string and undefined inherit ConfigProvider.prefixCls with the -timeline suffix, defaulting to ant-timeline. The internal Steps separately inherits the same base prefix with the -steps suffix: the local Timeline.prefixCls does not affect it. Therefore, suite and Timeline.prefixCls="local-history" give local-history along with suite-steps, and without setting the provider, ant-steps is saved. theme and semantic API are not renamed. Local prefix and common prefix switch without changing history.
Examples
- Project created
- Tests completed
- Version published
Basic example
Events by time and node colors.
<script lang="ts">
import { Timeline } from '@woodger/antd';
</script>
<Timeline aria-label={("Main story")} items={([
{ key: 'created', content: "Project created", color: 'green' },
{ key: 'tested', content: "Tests completed", color: 'green' },
{ key: 'published', content: "Version published" }
])} />
outlined
- Preparation
- Check
- Ready
filled
- Preparation
- Check
- Ready
Unit options
outlined and filled.
<script lang="ts">
import { Timeline } from '@woodger/antd';
const items = [{ content: "Preparation" }, { content: "Check" }, { content: "Ready" }];
</script>
<style>
.examples {
display: grid;
gap: 24px;
}
h4 {
margin: 0 0 16px;
font: inherit;
font-weight: 600;
}
</style>
<div class="examples">
{#each ['outlined', 'filled'] as variant (variant)}
<div><h4>{(variant)}</h4><Timeline
items={(items)}
variant={variant as 'outlined' | 'filled'}
aria-label={("Option " + String((variant)) + "")}
/></div>
{/each}
</div>
- Assembly completed
- Checks passed
- Publication…
Loading and reverse order
Control item.loading and reverse.
<script lang="ts">
import { Checkbox, Timeline } from '@woodger/antd';
let reverse = $state(false);
let loading = $state(true);
</script>
<style>
.settings {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 16px;
margin-bottom: 24px;
}
</style>
<div class="settings">
<Checkbox bind:checked={reverse}>{("Reverse order")}</Checkbox>
<Checkbox bind:checked={loading}>{("Publication continues")}</Checkbox>
</div>
<Timeline aria-label={("Publication history")} {reverse} items={([
{ key: 'build', content: "Assembly completed" },
{ key: 'checks', content: "Checks passed" },
{ key: 'publish', content: loading ? "Publication…" : "Published", loading }
])} />
- Creating a project
- Code check
- Package assembly
- Publication
Alternation of events
start, alternate and end.
<script lang="ts">
import { RadioGroup, Timeline } from '@woodger/antd';
let mode = $state<'start' | 'alternate' | 'end'>('alternate');
</script>
<style>
.settings { margin-bottom: 24px; }
</style>
<div class="settings"><RadioGroup
aria-label={("Event position")}
value={mode}
options={(['start', 'alternate', 'end'])}
onValueChange={next => { mode = next; }}
/></div>
<Timeline aria-label={("Alternation of events")} {mode} items={([
{ content: "Creating a project" }, { content: "Code check" },
{ content: "Package assembly" }, { content: "Publication" }
])} />
- 09:00Creation
- 10:00Check
- 12:00Publication
Horizontal history
Scrolling within the card.
<script lang="ts">
import { Timeline } from '@woodger/antd';
</script>
<style>
.scroll {
max-width: 100%;
overflow-x: auto;
}
.scroll:focus-visible {
outline: 2px solid var(--ant-color-primary);
outline-offset: 2px;
}
.line { min-width: 520px; }
</style>
<div class="scroll" role="region" aria-label={("Scrolling history")} tabindex="0">
<div
class="line"
><Timeline
aria-label={("Horizontal history")}
orientation="horizontal"
items={([
{ title: '09:00', content: "Creation" }, { title: '10:00', content: "Check" },
{ title: '12:00', content: "Publication" }
])}
/></div>
</div>
- 09:00Processing started
- 09:30
- Awaiting decision
- Archive preparation
Icon and action
Snippet icon and button in content.
<script lang="ts">
import { Button, Timeline } from '@woodger/antd';
let accepted = $state(0);
let reverse = $state(false);
</script>
<style>
output {
display: block;
margin-block-start: 12px;
}
.actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.actions :global(.ant-btn) {
max-width: 100%;
height: auto;
min-height: var(--ant-control-height-sm);
white-space: normal;
}
</style>
{#snippet clock()}<svg
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
aria-hidden="true"
><circle
cx="12"
cy="12"
r="9"
stroke="currentColor"
stroke-width="2"
/><path
d="M12 6v6l4 2"
stroke="currentColor"
stroke-width="2"
/></svg>{/snippet}
{#snippet details()}<div class="actions">
<Button
size="small"
onclick={() => { accepted++; }}
>{("Confirm check")}</Button>
<Button
size="small"
onclick={() => { reverse = !reverse; }}
>{("Expand story")}</Button>
</div>{/snippet}
<Timeline
aria-label={("Story with action")}
{reverse}
titleSpan="60px"
items={([
{ key: 'start', title: '09:00', content: "Processing started", color: 'green' },
{ key: 'review', title: '09:30', content: details, icon: clock, color: 'purple' },
{ key: 'end', content: "Awaiting decision", color: '#d46b08' },
{ key: 'archive', content: "Archive preparation", color: 'gray' }
])}
/>
<output
aria-label={("Timeline Confirmations")}
>{("Confirmed: ")}{accepted}</output>
- Project created
- Tests completed
- Check required
- Release prepared
End edge
Events on the other side of the line.
<script lang="ts">
import { Timeline } from '@woodger/antd';
</script>
<Timeline aria-label={("Events at the final edge")} mode="end" items={([
{ content: "Project created" }, { content: "Tests completed", color: 'green' },
{ content: "Check required", color: 'red' }, { content: "Release prepared" }
])} />
- 09:00Project created
- 09:30Check completed
- Preparing files
- 12:00Version published
Time labels
The title is separate from the content.
<script lang="ts">
import { Timeline } from '@woodger/antd';
</script>
<Timeline aria-label={("History over time")} titleSpan="88px" items={([
{ title: '09:00', content: "Project created" },
{ title: '09:30', content: "Check completed" },
{ content: "Preparing files" },
{ title: '12:00', content: "Version published" }
])} />
100px
- 05:10Preparation
- 09:03Check
- Assembly
- 11:28Publication
25%
- 05:10Preparation
- 09:03Check
- Assembly
- 11:28Publication
18 columns, end
- 05:10Preparation
- 09:03Check
- Assembly
- 11:28Publication
Header indent
Pixels, percentages and columns.
<script lang="ts">
import { Timeline, type TimelineItem } from '@woodger/antd';
const items: TimelineItem[] = [
{ title: '05:10', content: "Preparation" }, { title: '09:03', content: "Check" },
{ content: "Assembly" }, { title: '11:28', content: "Publication" }
];
</script>
<style>
.examples {
display: grid;
gap: 24px;
}
h4 {
margin: 0 0 16px;
font: inherit;
font-weight: 600;
}
</style>
<div class="examples">
<div><h4>100px</h4><Timeline items={(items)} titleSpan="100px" aria-label={("Indent 100px")} /></div>
<div><h4>25%</h4><Timeline items={(items)} titleSpan="25%" aria-label={("Indent 25 percent")} /></div>
<div><h4>{("18 columns, end")}</h4><Timeline
items={(items)}
titleSpan={18}
mode="end"
aria-label={("Indentation 18 columns")}
/></div>
</div>
- 09:00General style
- 10:00Single Event Style
- Coordination
- Publication
Semantic DOM
Object, function and styles of a single event.
<script lang="ts">
import { Timeline } from '@woodger/antd';
</script>
<style>
.examples {
display: grid;
gap: 24px;
}
</style>
<div class="examples">
<Timeline
aria-label={("Design by object")}
classNames={{ root: 'timeline-object' }}
styles={{
root: 'padding: 12px',
itemTitle: 'font-weight: 700',
itemContent: 'font-size: 13px'
}}
items={([
{ title: '09:00', content: "General style" },
{
title: '10:00', content: "Single Event Style", styles: {
title: 'color: var(--ant-color-primary)',
content: 'font-weight: 600'
}
}
])}
/>
<Timeline aria-label={("Decoration function")} mode="end"
classNames={() => ({ root: 'timeline-function' })}
styles={({ props }) => ({ itemContent: `font-weight: ${props.mode === 'end' ? 700 : 400}` })}
items={([{ content: "Coordination" }, { content: "Publication" }])} />
</div>
- 09:00Preparation
- 10:00Check
- 11:00Ready
Component tokens
Six local Timeline tokens.
<script lang="ts">
import { ConfigProvider, Timeline } from '@woodger/antd';
</script>
<ConfigProvider theme={{
components: {
Timeline: {
tailColor: '#d3adf7', tailWidth: 4, dotBorderWidth: 3,
dotSize: 14, dotBg: '#fff7e6', itemPaddingBottom: 32
}
}
}}>
<Timeline aria-label={("Local Timeline Theme")} titleSpan="64px" items={([
{ title: '09:00', content: "Preparation" }, { title: '10:00', content: "Check" },
{ title: '11:00', content: "Ready" }
])} />
</ConfigProvider>
- 09:00Preparation
- 10:00Publication
Right to left
direction and time labels.
<script lang="ts">
import { ConfigProvider, Timeline } from '@woodger/antd';
</script>
<ConfigProvider direction="rtl">
<Timeline aria-label={("History from right to left")} titleSpan="64px" items={([
{ title: '09:00', content: "Preparation" }, { title: '10:00', content: "Publication" }
])} />
</ConfigProvider>
- 09:10Order created
- 09:15Payment confirmed
- 10:30Transferred for delivery
- Delivery expected
Order history from review
reverse and loading state of the last event.
<script lang="ts">
import { Timeline } from '@woodger/antd';
let reverse = $state(false);
let loading = $state(true);
</script>
<style>
.controls {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 16px;
}
.controls label {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
</style>
<div class="controls">
<label><input
type="checkbox"
bind:checked={reverse}
/>{(" Reverse order of events")}</label>
<label><input type="checkbox" bind:checked={loading} />{(" Waiting for the next event")}</label>
</div>
<Timeline
aria-label={("Order history")}
{reverse}
titleSpan="72px"
items={([
{ key: 'created', title: '09:10', content: "Order created", color: 'green' },
{ key: 'paid', title: '09:15', content: "Payment confirmed", color: 'green' },
{ key: 'sent', title: '10:30', content: "Transferred for delivery" },
...(loading ? [{ key: 'delivery', content: "Delivery expected", loading: true }] : [])
])}
/>
- 09:00Application received
- 10:00Application verified
- 09:00Application received
- 10:00Application verified
- 09:00Application received
- 10:00Application verified
General Timeline Settings
Priority of provider, local and item styles; isolation from semantic Steps settings.
<script lang="ts">
import { Checkbox, ConfigProvider, Timeline } from '@woodger/antd';
let emphasized = $state(true);
const items = [
{ title: '09:00', content: "Application received" },
{ title: '10:00', content: "Application verified" }
];
</script>
<style>
.example, .examples {
display: grid;
gap: 24px;
}
</style>
<div class="example">
<Checkbox bind:checked={emphasized}>{("Timeline Headings Accent")}</Checkbox>
<ConfigProvider
steps={({
class: 'history-steps', style: 'border-radius: 12px',
styles: { itemTitle: 'letter-spacing: 8px' }
})}
timeline={{
class: 'shared-timeline', style: 'padding: 12px',
classNames: { itemTitle: 'shared-timeline-title' },
styles: ({ props }) => ({
itemTitle: props.orientation === 'vertical' && emphasized
? 'font-weight: 700'
: 'font-weight: 400'
})
}}>
<div class="examples">
<Timeline aria-label={("History with defaults")} items={(items)} />
<Timeline
aria-label={("History with local style")}
style="padding: 20px"
classNames={{ itemTitle: 'local-timeline-title' }}
styles={{ itemTitle: 'font-weight: 400' }}
items={([items[0], { ...items[1], styles: { title: 'font-weight: 800' } }])}
/>
<ConfigProvider timeline={{}}>
<Timeline aria-label={("History without defaults Timeline")} items={(items)} />
</ConfigProvider>
</div>
</ConfigProvider>
</div>
- 09:00Creating a project
- 10:00Project publication
- 09:00Creating a project
- 10:00Project publication
Local CSS prefix
Own namespace Timeline while maintaining the internal Steps classes.
<script lang="ts">
import { Checkbox, Timeline } from '@woodger/antd';
let alternate = $state(false);
const items = [
{ title: '09:00', content: "Creating a project" },
{ title: '10:00', content: "Project publication" }
];
</script>
<style>
.example {
display: grid;
gap: 24px;
}
</style>
<div class="example">
<Checkbox bind:checked={alternate}>{("Another Timeline prefix")}</Checkbox>
<Timeline prefixCls={alternate ? 'woodger-history' : 'woodger-timeline'}
aria-label={("History with prefix")} items={(items)} />
<Timeline aria-label={("Standard history")} items={(items)} />
</div>
API
Verified against 11 ant.design 6.7.0 themes and public types of the installed Svelte package. variant outlined/filled has already been published. Full definitions of Props are in the library.
| Theme | Example or limitation |
|---|---|
| Basic | Sequence of events and colors. |
| Variant | outlined and filled from the current page 6.7. |
| Loading and Reversing | item.loading and reverse order. |
| Alternate | start, alternate and end. |
| Horizontal | Horizontal story with local scrolling. |
| Custom | Icon and action as Snippet. |
| End alternate | Align to end edge. |
| Title | Time is separate from content. |
| Title Offset | 100px, 25% and number columns. |
| Semantic Sample | General styles and individual event styles. |
| Custom semantic dom styling | Object and function with props. |
| Component config | ConfigProvider.timeline and Steps settings boundary. |
| Local CSS prefix | Namespace Timeline with preservation of internal Steps classes. |
Timeline
| Property | Description | Type | Default |
|---|---|---|---|
prefixCls | Full local Timeline CSS prefix. The empty string inherits the common prefix; ant-timeline is used without configuration. The inner Steps separately inherits ConfigProvider.prefixCls, independent of the local Timeline.prefixCls. | string | ConfigProvider + -timeline |
items | Events with stable key, title, content and icon. | readonly TimelineItem[] | [] |
mode | Placement of events relative to the line: start, alternate or end. | start | alternate | end | start |
orientation | Time line direction. | vertical | horizontal | vertical |
variant | Design of nodes. Supported by the public Svelte API. | outlined | filled | outlined |
titleSpan | Number of columns out of 24 or CSS length: for example 100px or 25%. | number | string | 12 |
reverse | Reverse visual order of events. | boolean | false |
styles | CSS lines root and item slots; object or function. | TimelineSlots | callback | ConfigProvider.timeline |
classNames | Semantic slots classes. | TimelineSlots | callback | ConfigProvider.timeline |
TimelineItem
| Property | Description | Type | Default |
|---|---|---|---|
title | Time label or title; supports Snippet. | TimelineContent | — |
content | Text or Snippet with event content. | TimelineContent | — |
icon | An icon instead of a regular node. | TimelineContent | circle |
loading | Indicator of an unfinished event. | boolean | false |
placement | Position of a specific event. | start | end | by mode |
color | Preset or custom CSS node color. | string | blue |
styles | Local root/wrapper/icon/section/header/title/content/rail. | StepsItemSlots | — |
ReactNode is replaced with values and Snippet, CSSProperties with CSS strings. Events use title/content/icon/placement; item.loading specifies the pending state.
ConfigProvider.timeline accepts TimelineConfig: class, style, classNames and styles. Semantic defaults support an object or callback with the current props. Local styles take precedence; nested timeline={} replaces the entire record. Item styles take priority. Only the root class/style is inherited from ConfigProvider.steps; semantic Steps settings are isolated.
Semantic DOM
Timeline displays ol with li. Common slots use the item prefix; individual event styles - short names title/content/rail. The decorative icon is hidden from the accessibility tree; the button inside content is accessible from the keyboard.
| Slot | Purpose |
|---|---|
root | Ordered list. |
item | Event. |
itemWrapper | Event wrapper. |
itemIcon | Node icon. |
itemSection | Event area. |
itemHeader | Header area. |
itemTitle | Title or time. |
itemContent | Contents. |
itemRail | Connecting line. |
Registration tokens
theme.components.Timeline specifies the line, size and background of the node, and the distance between events. In the example, all six tokens are changed. Inline styles clarify local design.
| Token | Purpose |
|---|---|
tailColor | Line color. |
tailWidth | Line thickness. |
dotBorderWidth | Thickness of the node outline. |
dotSize | Knot size. |
dotBg | Node background. |
itemPaddingBottom | Interval between events. |
| Token | Meaning |
|---|---|
colorPrimary | #2f54eb |
colorError | #ff4d4f |
colorSuccess | #52c41a |
colorText | rgba(0,0,0,0.88) |
colorTextDisabled | rgba(0,0,0,0.25) |
fontSize | 14 |
lineHeight | 1.5714285714285714 |
paddingXS | 8 |
FAQ
How to show waiting?
Pass loading to the desired event. The addition and removal of this event is controlled by the application.
How to place a button in an event?
Pass snippet to content and use a native button. Its handlers remain part of the application.
What is the difference between Event and Timeline styles?
General slots are called itemTitle/itemContent/itemRail, local slots are called title/content/rail. Local values clarify the general ones.
What does titleSpan mean?
Number is the fraction of the 24-column grid, line is the CSS length. In alternate, the numeric value is not used.