Timeline
Present events in chronological order.
- Ben Carter created the project
- Sofia Nguyen invited 3 members
- Brand guidelines.pdf was uploaded
- Ben Carter moved the project to review
Installation
pnpm dlx shadcn@4.18.0 add @siteplane/timelineComplete the one-time setup first. Registry JSON lists source files and dependencies.
For this page’s examples, also install:
pnpm dlx shadcn@4.18.0 add @siteplane/buttonUsage
import {
Timeline,
TimelineItem,
TimelineTitle,
TimelineDescription,
} from "@/siteplane/components/timeline";
<Timeline>
<TimelineItem>
<TimelineTitle>Project created</TimelineTitle>
<TimelineDescription>Sep 14, 09:12</TimelineDescription>
</TimelineItem>
</Timeline>;Composition
Timeline
├── TimelineItem
│ ├── TimelineTitle
│ └── TimelineDescription
└── TimelineNow (optional)Status colors
Set tone on a TimelineItem to color its marker: neutral (the default), accent, info, success, warning or error. Include status in text; color alone should not carry the event meaning.
- Release 2.4.0 created
- Deployment queued
- Build started
- Checks passed
- Approval requested for production
- Deployment to production failed
Custom markers
Pass an icon as marker for recognizable event types. Without markerLabel the marker is decorative; add a label when the marker conveys something the text does not.
- Draft submitted for review
- Sofia Nguyen commented on the layout
- Design review by Ben Carter
Now marker
Place TimelineNow between two events to mark the present, such as the next appointment of the day. It is a row of the timeline with the accent dot of an event, the label "Now" in the accent and a line in the accent across the rest of the row. Pass label to show the word in the page's language, or to add the time, as in label="Now, 10:42 AM". The marker is a list item with aria-current="time", so assistive technologies read it in its place among the events. Give it a stable key, as the events have: when the present moves past an event, the marker glides to its new place.
- Haircut with Mara Ellis
- Coloring with Ben Carter
- Now
- Beard trim with Sofia Nguyen
- Consultation with Jonas Weber
Adding and removing events
Events that are added, removed or reordered animate on their own. A new event expands and fades in, and a removed one fades out and collapses while the events around it glide to their new place. The connector and the space to the next event open and close with the event after it, so the timeline never ends in a stub. Give every TimelineItem a stable key, such as an id, and never the index, because the key tells the timeline which event has left.
- Build started09:03
- Checks passed09:06
- Approval requested for production09:09
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
Timeline | neutral | accent | info | success | warning | error | neutral | Marker color, with at least 3:1 contrast against the page in light and dark themes. |
Timeline | default | accent | info | success | warning | error | unset | Deprecated: the earlier name of tone, where default is neutral. tone wins when both are set. |
Timeline | TimelineMarkerShape: bar | diamond | dot | ring | dot | Marker geometry; ring draws the tone color as an outline. |
Timeline | ReactNode | unset | Custom marker content, such as an icon, in a larger marker. Icons use a color that contrasts with the marker. |
Timeline | string | unset | Accessible marker label; unlabeled markers are hidden from assistive technology. |
Timeline | string | "Now" | Text of the now marker beside its dot, read by assistive technology; pass the word in the page's language. |
Timeline renders ol with role list. TimelineItemProps extends native li props
without the four animation handlers Motion owns (onAnimationStart, onDrag,
onDragStart and onDragEnd); TimelineItem must be rendered inside Timeline.
TimelineNowProps takes the same li props without children and the marker props;
TimelineNow renders an li with aria-current="time" and must be rendered inside
Timeline too. TimelineTitle and TimelineDescription accept native div props. All
parts accept refs, children and string className. TimelineTone and
TimelineMarkerShape are exported; TimelineItemVariant is the deprecated type of
variant. There is no sorting, pagination or date parsing; the application
supplies ordered events and timestamps, and added or removed events animate on
their own. Durations and easings come from the shared motion tokens, and every
change is instant when the system asks for reduced motion, when html carries
data-motion-reduce="true", or inside SiteplaneMotionProvider preset="reduced".
Usage notes
Use native time elements with machine-readable dateTime values where timestamps matter. Empty/loading/error behavior for an event feed belongs to the application.
Events must be direct children of Timeline, not wrapped in a fragment: a fragment around several events counts as one. A leaving event is inert and hidden from assistive technology while it fades, so focus inside it is lost when it leaves. Move focus to a neighboring event before removing one, as the example does.