Timeline
TheTimeline component provides a clean, accessible way to display events in chronological order. Supports both vertical and horizontal layouts with customizable markers, titles, and descriptions.
Installation
Import
Usage
Components
Timeline (Root)
React.ReactNode
required
Timeline items to display.
'vertical' | 'horizontal'
default:"'vertical'"
Layout orientation of the timeline.
string
Additional CSS classes for the timeline container.
string
default:"'Timeline'"
Accessible label for screen readers.
TimelineItem
React.ReactNode
required
Timeline item content (marker and content components).
string
Additional CSS classes for the item.
TimelineMarker
'empty' | 'fill'
default:"'empty'"
Visual style of the marker.
string
Additional CSS classes for custom marker styling.
TimelineContent
React.ReactNode
required
Content to display for this timeline item.
string
Additional CSS classes.
TimelineTitle
React.ReactNode
required
Title text for the timeline item.
string
Additional CSS classes.
TimelineDescription
React.ReactNode
required
Description text for the timeline item.
string
Additional CSS classes.
Styling Details
Connecting Line
The timeline automatically renders a connecting line:- Vertical: Left-aligned, full height (
left-1.5 top-0 w-px h-full) - Horizontal: Top-aligned, full width (
top-1.5 left-0 h-px w-full)
Marker Variants
Markers use
relative z-10 to appear above the connecting line.Examples
Product Roadmap
Order Tracking
Career History
Project Phases (Horizontal)
Hook: useTimeline
Access timeline context from child components:Best Practices
- Use filled markers for completed items, empty for upcoming
- Keep descriptions concise (1-2 lines)
- Include timestamps or dates for clarity
- Use consistent marker styling for similar states
- Limit vertical timelines to 6-8 items for readability
- For horizontal layouts, ensure responsive behavior on mobile
Accessibility
- Uses semantic
<ul>and<li>elements - Includes
aria-labelfor screen readers - Markers use
aria-hidden="true"as they’re decorative - Proper heading hierarchy with
<h3>for titles - High contrast text colors for readability