Built on Vercel’s UI SDK 0.1.0-beta.2. Its API may change.
Timeline
A timeline on Vercel's UI SDK for activity, order progress and agent steps, vertical or horizontal, with statuses, timestamps, icon markers and a feed mode.
- Data display components
- 7 parts
- 8 examples
@ui-sdk/core@ui-sdk/reactclass-variance-authority
pnpm dlx shadcn@latest add https://hextaui.com/r/ui-sdk-timeline.jsonAdds the component, the HextaUI theme tokens and any HextaUI components it depends on.
Add the theme tokens to your global CSS, if you haven’t yet.
Install the dependencies.
pnpm add @ui-sdk/react@0.1.0-beta.2 @ui-sdk/core@0.1.0-beta.2 class-variance-authority cnCopy and paste the following code into your project.
components/ui/ui-sdk-timeline.tsx Update the import paths to match your project setup.
UI SDK adds a little CSS of its own in a cascade layer named ui-sdk. Declare that layer at the top of your global stylesheet, above the Tailwind import, so your classes win over it.
A timeline lists things that happened, or will, like an activity feed, an order’s progress or an agent’s steps. It’s a list for screen readers with one tab stop, and the arrow keys move between events. Pass dateTime to TimelineTime so the date is machine readable while the text stays friendly. UI SDK marks it experimental in 0.1.0-beta.2.
Every part inside an item is optional. The marker sits in its own column and the connector runs from it to the next event, hidden after the last one. Anything else you put in an item, like a button or a collapsible, lines up with the title.
Give each item a status of complete, current or upcoming. The current event gets aria-current="step" and the tab stop, and a controller focuses an event by its value. Say the status in the title too, since the marker only shows it.
An icon in TimelineMarker turns it into a small circle. Put a spinner in the current step while an agent works, and a duration like PT5S in dateTime.
The marker’s variant is success, warning, destructive or info, for an empty dot or an icon.
orientation="horizontal" lays the events in a row, like a roadmap. Left and Right move between them, and loop={false} stops at the ends.
Links and buttons inside an event stay in the tab order. Tab moves from the event to them, and the arrow keys still move between events.
feed turns the list into a feed of articles for timelines that grow, and Page Down and Page Up move between them. Set busy while more load.
The markers and the line move to the right side.
| Key | Action |
|---|---|
| ↓↑ | Move between events in a vertical timeline. |
| →← | Move between events in a horizontal timeline. They swap in right-to-left text. |
| HomeEnd | Focus the first or last event. |
| PageDownPageUp | In a feed, focus the next or previous article, from anywhere inside one. |
| Tab | Enters on the current event, else the first, then moves to the links and buttons inside it. |
A timeline is a list named with aria-label, or a feed of articles with their positions. Each event is named by its title and described by its time and description, and the markers and connectors are hidden from screen readers.
The focused event shows a ring with room around it. Marker colors fade between statuses only when motion is allowed, and in forced colors the dots and lines draw in the text color.
Each part wraps the UI SDK part of the same name and accepts all of its props, including render and a className that can be a function of the part’s state.
| Prop | Type | Default |
|---|---|---|
orientation | "vertical" | "horizontal" | "vertical" |
loop | boolean | true |
feed | boolean | false |
busySets aria-busy on a feed while it loads. | boolean | false |
controllerFrom createTimelineController(). | TimelineController | – |
render | ReactElement | (props, state) => ReactElement | – |
| Attribute | Description |
|---|---|
data-slot="timeline" | Target the timeline in CSS. |
data-orientation | vertical or horizontal. |
data-busy | Present while a feed is busy. |
--timeline-count | How many events are in the page. |
| Prop | Type | Default |
|---|---|---|
valueNames the event for the controller’s focus(). | string | – |
status | "complete" | "current" | "upcoming" | – |
render | ReactElement | (props, state) => ReactElement | – |
| Attribute | Description |
|---|---|
data-slot="timeline-item" | Target an event in CSS. |
data-complete | Present when the event’s status is complete. |
data-current | Present when the event’s status is current. |
data-upcoming | Present when the event’s status is upcoming. |
data-first | Present on the first event once it’s in the page. |
data-last | Present on the last event once it’s in the page. |
--timeline-index | The event’s place from 0. |
| Prop | Type | Default |
|---|---|---|
variant | "default" | "success" | "warning" | "destructive" | "info" | "default" |
childrenAn icon or image. Empty draws a dot. | ReactNode | – |
render | ReactElement | (props, state) => ReactElement | – |
| Attribute | Description |
|---|---|
data-slot="timeline-marker" | Target the marker in CSS. |
data-variant | The marker’s variant. |
data-complete | Present when the event’s status is complete. |
data-current | Present when the event’s status is current. |
data-upcoming | Present when the event’s status is upcoming. |
The line from the marker to the next event. It’s solid under a complete event and hidden after the last.
Names its event. Render it as a heading with render={<h3 />} so people can move between events by heading.
| Prop | Type | Default |
|---|---|---|
dateTimeA machine-readable date, time or duration. It describes the event. | string | – |
More about its event. It describes the event.
- AvatarUser photos with an initials fallback, status badges and stacked groups that collapse into a count.
- BadgeStatus labels with colored dots, removable tags that slide closed and counts that roll to their new value.
- CardA surface for grouping content, with three variants, edge-to-edge media, concentric radii and whole-card links.
- ChartRecharts charts with themed colors, a tooltip and legend that read labels from one config, and keyboard navigation with a visible focus ring.
- Data tableA table for real data, with sorting, search, row selection, pinned columns, a sticky header and pagination.
- ItemA row of media, text and actions for lists, settings and pickers, with a grouped surface and a hover highlight that glides between rows.