Back to Reui

Timeline

content/docs/components/radix/timeline.mdx

2.0.05.1 KB
Original Source

<ComponentPreview styleName="radix-nova" name="c-timeline-1" className="**:[.preview]:h-auto" />

Examples

With Left-Aligned Dates

<ComponentPreview styleName="radix-nova" name="c-timeline-2" className="**:[.preview]:h-auto" />

With Custom Indicators

<ComponentPreview styleName="radix-nova" name="c-timeline-3" className="**:[.preview]:h-auto" />

With Icons

<ComponentPreview styleName="radix-nova" name="c-timeline-4" className="**:[.preview]:h-auto" />

Alternating Layout

<ComponentPreview styleName="radix-nova" name="c-timeline-5" className="**:[.preview]:h-auto" />

Pipeline Steps

<ComponentPreview styleName="radix-nova" name="c-timeline-6" className="**:[.preview]:h-auto" />

Dot Indicators

<ComponentPreview styleName="radix-nova" name="c-timeline-7" className="**:[.preview]:h-auto" />

Horizontal Orientation

<ComponentPreview styleName="radix-nova" name="c-timeline-8" className="**:[.preview]:h-auto" />

Horizontal with Top Indicators

<ComponentPreview styleName="radix-nova" name="c-timeline-9" className="**:[.preview]:h-auto" />

Installation

<CodeTabs> <TabsList> <TabsTrigger value="cli">CLI</TabsTrigger> <TabsTrigger value="manual">Manual</TabsTrigger> </TabsList> <TabsContent value="cli">
bash
npx shadcn@latest add @reui/r-timeline
</TabsContent> <TabsContent value="manual"> <Steps>

<Step>Install the following dependencies:</Step>

bash
npm install radix-ui

<Step>Copy and paste the following code into your project.</Step>

<ComponentSource styleName="radix-nova" name="timeline" title="components/reui/timeline.tsx" />

</Steps> </TabsContent> </CodeTabs>

Usage

tsx
import {
  Timeline,
  TimelineContent,
  TimelineDate,
  TimelineHeader,
  TimelineIndicator,
  TimelineItem,
  TimelineSeparator,
  TimelineTitle,
} from "@/components/reui/r-timeline"
tsx
<Timeline>
  <TimelineItem step={1}>
    <TimelineHeader>
      <TimelineDate>March 2024</TimelineDate>
      <TimelineTitle>Project Initialized</TimelineTitle>
    </TimelineHeader>
    <TimelineIndicator />
    <TimelineSeparator />
    <TimelineContent>
      Successfully set up the project repository and initial architecture.
    </TimelineContent>
  </TimelineItem>
</Timeline>

API Reference

Timeline

The root component for the timeline.

PropTypeDefaultDescription
defaultValuenumber1The initial active step.
valuenumber-The current active step (controlled).
onValueChange(value: number) => void-Callback fired when the active step changes.
orientation"horizontal" | "vertical""vertical"The layout orientation of the timeline.

TimelineItem

A single item in the timeline.

PropTypeDefaultDescription
stepnumber-Required. The step number for this item.

TimelineDate

The date or time label for a timeline item.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for the date label.

TimelineTitle

The title for a timeline item.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for the title.

TimelineIndicator

The visual indicator (usually a dot) for a timeline item.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for the indicator.

TimelineSeparator

The line connecting timeline indicators.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for the separator line.

TimelineHeader

A container for the date and title.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for the header container.

TimelineContent

The main descriptive content for a timeline item.

PropTypeDefaultDescription
classNamestring-Additional CSS classes for the content container.