Skip to content
Nacre
Color palette
中文

Timeline

experimentalTimelineOpen in playground
Timeline
Runs the real component in your browser.

A column of nodes in time order: ticket activity, the stages of a call. It only draws the dots and connectors (none after the last item, a ring around the current node); the caller supplies the content and the order (newest first or last).

Status: experimental · Components: Timeline

import { Timeline } from 'nacre'

Give each item an id, a time (pre-formatted, on the line above the content) and content; mark the newest with marker=“strong” and history with subtle. The dot sits on the middle of the first line, and no connector is drawn below the last item.

import { View } from 'nsh'
import { Timeline } from 'nacre'
export function TimelineUsage() {
return (
<View class="w-[320px] max-w-full">
<Timeline
testID="timeline-usage"
items={[
{
id: '3',
time: '2026-11-05 14:20',
marker: 'strong',
content: 'Jiayi Lin marked the ticket as finished',
testID: 'timeline-usage-first',
},
{ id: '2', time: '2026-11-05 10:02', marker: 'subtle', content: 'Siyuan Chen took over' },
{ id: '1', time: '2026-11-04 18:45', marker: 'subtle', content: 'Customer created the ticket', testID: 'timeline-usage-last' },
]}
/>
</View>
)
}

Use marker’s status colors for stages that carry meaning, like a call’s; mark the stage in progress current, which adds a same-color ring around the dot and reports the current step. Text such as “Current” goes in content. md suits detail panels, with one step more spacing.

import { Text, View } from 'nsh'
import { Timeline, TEXT_SIZE } from 'nacre'
export function TimelineCurrent() {
return (
<View class="w-[320px] max-w-full">
<Timeline
testID="timeline-current"
size="md"
items={[
{ id: 'ivr', marker: 'default', content: 'Entered IVR' },
{ id: 'queue', marker: 'muted', content: 'Queued · 32s' },
{
id: 'talk',
marker: 'success',
current: true,
testID: 'timeline-current-node',
content: (
<View class="flex-row items-baseline gap-1.5">
<Text class={`${TEXT_SIZE.small} text-foreground`}>On call</Text>
<Text class={`${TEXT_SIZE.caption} text-success-text`}>Current</Text>
</View>
),
},
]}
/>
</View>
)
}

content can combine several lines and tags; the connector stretches with it and the dot stays on the first line.

import { Text, View } from 'nsh'
import { Tag, Timeline, TEXT_SIZE } from 'nacre'
export function TimelineRich() {
return (
<View class="w-[280px] max-w-full">
<Timeline
testID="timeline-rich"
items={[
{
id: 'b',
time: '2026-11-05 09:30',
marker: 'warning',
testID: 'timeline-rich-long',
content: (
<View class="gap-0.5">
<Text class={`${TEXT_SIZE.small} text-foreground`}>
Ticket returned: the resolution lacks a screenshot of the customer’s confirmation. Add it and resubmit.
</Text>
<View class="flex-row items-center gap-1.5">
<Text class={`${TEXT_SIZE.caption} text-muted-foreground`}>Min Wang</Text>
<Tag label="QA" />
</View>
</View>
),
},
{ id: 'a', time: '2026-11-04 16:12', marker: 'subtle', content: 'Resolution submitted' },
]}
/>
</View>
)
}
  • The container is a list; screen readers read each item’s time and content in order.
  • The current node reports current (step); when color alone conveys status, say it in the content too.

Do

  • Use text-small for the first line of content so it lines up with the dot
  • Write the status in the content when status colors carry meaning
  • Collapse beyond 5 items in the caller and offer “View all”

Don’t

  • Use it as a stepper or wizard
  • Give every item an accent color
  • Put editable forms in a Timeline

Property descriptions follow the Chinese source comments.

Prop Type Default Description
items * readonly TimelineItem[] — 从上到下的顺序由调用方排(最新在顶或在底)
size 'sm' | 'md' — sm(默认):右栏,圆点与正文间 8、节点间 10;md:详情面板,间 12、节点间 12
testID string —

* required