CarsXE

Search docs

Search pages, components, and skills.

Timeline

An ordered list of events on a rail. Content, the opposite side, the marker, and the connector are all render props receiving the item and its index, so events can be as plain as a line of text or as rich as a card. The rail runs vertically or horizontally, and content can sit on either side or alternate so the rail centres itself.
  1. Report ordered

    VIN 1HGCM82633A004352 submitted.

  2. VIN decoded

    2003 Honda Accord EX matched.

  3. History retrieved

    Two previous owners, no accidents.

  4. Report ready

    Delivered to the requesting account.

Installation

Import from the package. Do not run shadcn add in your app.

tsx
import { Timeline } from "@carsxe/design-system/components/timeline"

Usage

tsx
import { Timeline } from "@carsxe/design-system/components/timeline"

<Timeline
  items={events}
  content={(event) => <p className="font-medium">{event.title}</p>}
/>

Opposite content

  1. 09:14

    Report ordered

  2. 09:15

    VIN decoded

  3. 09:16

    History retrieved

  4. 09:17

    Report ready

Alternating

  1. 09:14

    Report ordered

    VIN 1HGCM82633A004352 submitted.

  2. 09:15

    VIN decoded

    2003 Honda Accord EX matched.

  3. 09:16

    History retrieved

    Two previous owners, no accidents.

  4. 09:17

    Report ready

    Delivered to the requesting account.

Content on the other side

  1. Report ordered

  2. VIN decoded

  3. History retrieved

  4. Report ready

Custom markers and cards

  1. Report ordered09:14
  2. VIN decoded09:15
  3. History retrieved09:16
  4. Report ready09:17

Horizontal

  1. 09:14

    Report ordered

  2. 09:15

    VIN decoded

  3. 09:16

    History retrieved

  4. 09:17

    Report ready

API Reference

PropTypeDefault
itemsreadonly T[]—
orientation"vertical" | "horizontal""vertical"
align"start" | "end" | "alternate""start"
content(item: T, index: number) => ReactNode—
opposite(item: T, index: number) => ReactNode—
marker(item: T, index: number) => ReactNode—
connector(item: T, index: number) => ReactNode—
getKey(item: T, index: number) => Keyitem.id ?? index