home / skills / ancoleman / ai-design-components / displaying-timelines

displaying-timelines skill

/skills/displaying-timelines

This skill helps you design and implement timelines and activity components with accessible, real-time, responsive patterns for calendars, feeds, and Gantt

npx playbooks add skill ancoleman/ai-design-components --skill displaying-timelines

Review the files below or copy the command above to add this skill to your agents.

Files (33)
SKILL.md
10.7 KB
---
name: displaying-timelines
description: Displays chronological events and activity through timelines, activity feeds, Gantt charts, and calendar interfaces. Use when showing historical events, project schedules, social feeds, notifications, audit logs, or time-based data. Provides implementation patterns for vertical/horizontal timelines, interactive visualizations, real-time updates, and responsive designs with accessibility (WCAG/ARIA).
---

# Displaying Timelines & Activity Components

## Purpose

This skill enables systematic creation of timeline and activity components, from simple vertical timelines to complex interactive Gantt charts. It provides clear decision frameworks based on use case and data characteristics, ensuring optimal performance, real-time updates, and accessible implementations.

## When to Use

Activate this skill when:
- Creating activity feeds (social, notifications, audit logs)
- Displaying timelines (vertical, horizontal, interactive)
- Building Gantt charts or project schedules
- Implementing calendar interfaces (month, week, day views)
- Showing chronological events or historical data
- Handling real-time activity updates
- Requiring timestamp formatting (relative, absolute)
- Ensuring timeline accessibility or responsive behavior

## Quick Decision Framework

Select component type based on use case:

```
Social Activity        → Activity Feed (infinite scroll, reactions)
System Events          → Audit Log (searchable, exportable, precise timestamps)
User Notifications     → Notification Feed (read/unread, grouped by date)
Historical Events      → Vertical Timeline (milestones, alternating sides)
Project Planning       → Gantt Chart (dependencies, drag-to-reschedule)
Scheduling             → Calendar Interface (month/week/day views)
Interactive Roadmap    → Horizontal Timeline (zoom, pan, filter)
```

For detailed selection criteria, reference `references/component-selection.md`.

## Core Implementation Patterns

### Activity Feeds

**Social Feed Pattern:**
- User avatar + name + action description
- Relative timestamps ("2 hours ago")
- Reactions and comments
- Infinite scroll with pagination
- Real-time updates via WebSocket
- Reference `references/activity-feeds.md`

**Notification Feed Pattern:**
- Grouped by date sections
- Read/unread states with indicators
- Mark all as read functionality
- Filter by notification type
- Action buttons (view, dismiss)
- Reference `references/notification-feeds.md`

**Audit Log Pattern:**
- System events with precise timestamps
- User action tracking
- Searchable with advanced filters
- Exportable (CSV, JSON)
- Security-focused display
- Reference `references/audit-logs.md`

Example: `examples/social-activity-feed.tsx`

### Timeline Visualizations

**Vertical Timeline:**
- Events stacked chronologically
- Connecting line with marker dots
- Date markers and event cards
- Optional alternating sides
- Best for: Historical events, project milestones
- Reference `references/vertical-timelines.md`

**Horizontal Timeline:**
- Events along horizontal axis
- Scroll or zoom to navigate
- Density varies by zoom level
- Best for: Project timelines, roadmaps
- Reference `references/horizontal-timelines.md`

**Interactive Timeline:**
- Click events for detail view
- Filter by category/type
- Zoom in/out controls
- Pan and scroll navigation
- Best for: Data exploration, rich interactivity
- Reference `references/interactive-timelines.md`

Example: `examples/milestone-timeline.tsx`

### Gantt Charts

**Project Planning Features:**
- Tasks as horizontal bars
- Dependencies with arrows
- Critical path highlighting
- Drag to reschedule
- Progress indicators
- Milestone markers (diamonds)
- Resource allocation
- Today marker line
- Zoom levels (day/week/month/year)

To generate Gantt chart data:
```bash
python scripts/generate_gantt_data.py --tasks 50 --dependencies auto
```

Reference `references/gantt-patterns.md` for implementation details.

Example: `examples/project-gantt.tsx`

### Calendar Interfaces

**Month View:**
- Traditional calendar grid
- Events in date cells
- Click to create/edit
- Color-coded categories
- Multi-calendar overlay

**Week View:**
- Time slots (hourly)
- Events as draggable blocks
- Resize to change duration
- Multiple calendars overlay

**Day/Agenda View:**
- Detailed daily schedule
- List format with time duration
- Location and attendees
- Scrollable timeline

Reference `references/calendar-patterns.md` for all views.

Example: `examples/calendar-scheduler.tsx`

## Timestamp Formatting

Essential timestamp patterns:

**Relative (Recent Events):**
- "Just now" (<1 min)
- "5 minutes ago"
- "3 hours ago"
- "Yesterday at 3:42 PM"

**Absolute (Older Events):**
- "Jan 15, 2025"
- "January 15, 2025 at 3:42 PM"
- ISO 8601 for APIs

**Implementation Considerations:**
- Timezone handling (display user's local time)
- Locale-aware formatting
- Hover for precise timestamp
- Auto-update relative times

To format timestamps consistently:
```bash
node scripts/format_timestamps.js --locale en-US --timezone auto
```

Reference `references/timestamp-formatting.md` for complete patterns.

## Real-Time Updates

**Live Activity Feed:**
- WebSocket or SSE for new events
- Smooth insertion animation
- "X new items" notification banner
- Click to load new items
- Optimistic updates for user actions

**Implementation Pattern:**
1. Show user action immediately
2. Update timestamp to "Just now"
3. Send to server in background
4. Rollback if error occurs

Reference `references/real-time-updates.md` for WebSocket patterns.

Example: `examples/realtime-activity.tsx`

## Performance Optimization

Critical performance thresholds:

```
<100 events       → Client-side rendering, no virtualization
100-1,000 events  → Virtual scrolling recommended
1,000+ events     → Virtual scrolling + server pagination
Real-time         → Debounce updates, batch insertions
```

**Optimization Strategies:**
- Memoize timeline item components
- Lazy load event details
- Virtual scrolling for long timelines
- Debounce real-time updates (batch every 500ms)
- Optimize timestamp calculations

To benchmark performance:
```bash
node scripts/benchmark_timeline.js --events 10000
```

Reference `references/performance-optimization.md` for details.

## Accessibility Requirements

Essential WCAG compliance:

**Semantic HTML:**
- Use `<ol>` or `<ul>` for timelines
- Proper heading hierarchy
- Semantic time elements

**ARIA Patterns:**
- `role="feed"` for activity feeds
- `role="article"` for timeline items
- `aria-label` for timestamps
- `aria-busy` during loading

**Keyboard Navigation:**
- Tab through interactive items
- Arrow keys for timeline navigation
- Enter/Space to expand items
- Skip to latest/oldest controls

**Screen Reader Support:**
- Announce new items in feeds
- Descriptive timestamp labels
- Progress updates for Gantt charts

To validate accessibility:
```bash
node scripts/validate_timeline_accessibility.js
```

Reference `references/accessibility-patterns.md` for complete requirements.

## Responsive Design

Three proven strategies:

**1. Stack Vertically (Mobile)**
- Convert horizontal to vertical
- Maintain chronological order
- Adjust spacing and font sizes

**2. Simplify Display**
- Show essential info only
- Expand for details
- Reduce visual complexity

**3. Horizontal Scroll**
- Keep layout intact
- Enable touch scrolling
- Add scroll indicators

Reference `references/responsive-strategies.md` for implementations.

Example: `examples/responsive-timeline.tsx`

## Library Recommendations

### Timeline: react-chrono (Flexible)

Best for timeline visualizations with rich content:
- Horizontal, vertical, alternating layouts
- Image and video support
- Custom item rendering
- TypeScript support
- Responsive out of the box

```bash
npm install react-chrono
```

See `examples/react-chrono-timeline.tsx` for setup.

**Alternative: react-vertical-timeline-component**
- Simple, clean vertical timelines
- Lightweight (~10KB)
- Icon support
- Good for basic timelines

### Gantt Charts: SVAR React Gantt

Best for project management:
- Modern, dependency-free
- Drag-and-drop tasks
- Dependencies and milestones
- Customizable appearance
- TypeScript ready

```bash
npm install @svar/gantt
```

**Enterprise Alternative: Bryntum Gantt**
- Feature-complete solution
- Commercial license required
- Handles complex projects
- Advanced resource management

### Calendar: react-big-calendar

Best for scheduling interfaces:
- Month, week, day, agenda views
- Drag-and-drop events
- Customizable styling
- Large community support

```bash
npm install react-big-calendar
```

**Alternative: FullCalendar**
- Premium features available
- Excellent documentation
- Multiple framework support

For detailed comparison, reference `references/library-comparison.md`.

## Design Token Integration

Timelines use the design-tokens skill for consistent theming:

**Timeline-Specific Tokens:**
- `--timeline-line-color` - Connecting line color
- `--timeline-dot-color` - Event marker color
- `--timeline-dot-active-color` - Current/active event
- `--event-card-bg` - Event card background
- `--timestamp-color` - Timestamp text

**Standard Token Categories:**
- Color tokens for backgrounds and states
- Spacing tokens for gaps and padding
- Typography tokens for text hierarchy
- Shadow tokens for card elevation
- Motion tokens for animations

Supports light, dark, high-contrast, and custom themes.
Reference the design-tokens skill for theme switching.

## Working Examples

Start with the example matching the requirements:

```
social-activity-feed.tsx       # Social feed with reactions
notification-center.tsx        # Notification system with filters
audit-log-viewer.tsx           # System audit log
milestone-timeline.tsx         # Vertical timeline with milestones
project-gantt.tsx              # Gantt chart with dependencies
calendar-scheduler.tsx         # Full calendar with all views
realtime-activity.tsx          # Live updates via WebSocket
responsive-timeline.tsx        # Mobile-optimized timeline
```

## Testing Tools

Generate mock timeline data:
```bash
python scripts/generate_timeline_data.py --events 500 --realtime
```

Test real-time updates:
```bash
node scripts/simulate_realtime.js --rate 5/sec --duration 60s
```

Validate accessibility:
```bash
node scripts/validate_timeline_accessibility.js
```

Benchmark performance:
```bash
node scripts/benchmark_timeline.js --events 10000 --virtual
```

## Next Steps

1. Identify the timeline use case (activity, events, schedule)
2. Select the appropriate component type
3. Choose a library or build custom with tokens
4. Start with the matching example file
5. Implement core functionality
6. Add real-time updates if needed
7. Test performance with large datasets
8. Validate accessibility compliance
9. Apply responsive strategy for mobile

Overview

This skill provides patterns and implementation guidance for displaying chronological events and activity using timelines, activity feeds, Gantt charts, and calendar interfaces. It focuses on practical component selection, accessibility (WCAG/ARIA), responsive behavior, real-time updates, and performance for time-based data. Use it to design and implement robust, user-friendly temporal UIs across web and mobile.

How this skill works

The skill describes component types (vertical/horizontal timelines, activity feeds, Gantt charts, calendar views) and maps use cases to best-fit patterns. It explains core implementation details: timestamp formatting, real-time update patterns (WebSocket/SSE and optimistic updates), virtualization and batching for performance, and accessibility roles/ARIA and keyboard interactions. It also recommends libraries, design tokens, and example files to jump-start development.

When to use it

  • Building social activity feeds, notifications, or audit logs
  • Displaying historical events or milestone timelines
  • Creating project schedules or interactive Gantt charts
  • Implementing calendar interfaces (month/week/day/agenda)
  • Handling real-time activity streams or live notifications
  • When accessibility, localization, and responsive behavior are required

Best practices

  • Choose component type based on user goal (feed vs audit log vs Gantt vs calendar)
  • Format timestamps by recency (relative for recent, absolute for older) and show full timestamp on hover
  • Optimize rendering: virtualize lists for 100+ items and batch real-time inserts
  • Follow semantic HTML and ARIA roles (role="feed", <ol>/<ul>, role="article") and keyboard navigation
  • Design mobile-first: stack horizontal layouts, simplify details, or allow horizontal scrolling
  • Use design tokens for consistent theming across light/dark/high-contrast modes

Example use cases

  • Social activity feed with infinite scroll, reactions, and live updates
  • Audit log viewer with precise timestamps, search, and export
  • Project Gantt chart with dependencies, drag-to-reschedule, and critical path
  • Calendar scheduler offering month/week/day views and drag-resize events
  • Interactive milestone timeline with zoom, pan, and detail drill-down

FAQ

How many events require virtualization?

Virtualization is recommended at around 100-1,000 events; combine with server pagination for 1,000+ items.

Which timestamp format should I use?

Use relative times for recent events and absolute (locale-aware) timestamps for older items; expose ISO 8601 in APIs.

What real-time strategy is best?

Use WebSocket or SSE for live feeds, debounce/batch inserts (e.g., 500ms) and provide a "X new items" banner for controlled insertion.