Timeline

Special

Vertical and horizontal timelines with milestones, checkpoints, and progress tracking.

Import

import { PixelTimeline, PixelTimelineCheckpoint } from "@/components/ui/pixel/pixel-timeline"

Usage

🚀
Jan 2024

Project Started

Initial planning phase completed.

Feb 2024

Development

Building core features.

🔍
Mar 2024

Testing

QA scheduled for next month.

Component Source

Copy and paste the following code into your project at /src/components/ui/pixel/pixel-timeline.tsx

"use client";

import { cva, type VariantProps } from "class-variance-authority";
import type * as React from "react";

const timelineVariants = cva("relative", {
  variants: {
    orientation: {
      vertical: "flex flex-col",
      horizontal: "flex flex-row overflow-x-auto pb-4",
    },
  },
  defaultVariants: {
    orientation: "vertical",
  },
});

const timelineItemVariants = cva("relative flex gap-4", {
  variants: {
    orientation: {
      vertical: "flex-row pb-8 last:pb-0",
      horizontal: "flex-col items-center min-w-[200px]",
    },
  },
  defaultVariants: {
    orientation: "vertical",
  },
});

const timelineMarkerVariants = cva(
  "relative flex-shrink-0 border-4 border-black shadow-[4px_4px_0px_0px_rgba(0,0,0,1)]",
  {
    variants: {
      variant: {
        default: "bg-pixel-secondary",
        success: "bg-pixel-success",
        warning: "bg-pixel-warning",
        error: "bg-pixel-error",
        primary: "bg-pixel-primary",
      },
      size: {
        sm: "w-8 h-8",
        md: "w-12 h-12",
        lg: "w-16 h-16",
      },
      shape: {
        square: "",
        circle: "rounded-full",
        diamond: "rotate-45",
      },

// ... (more code below)

Props

PropTypeDefaultDescription
itemsTimelineItemType[]-Timeline items array
orientation"vertical" | "horizontal""vertical"Timeline direction
markerSize"sm" | "md" | "lg""md"Marker size
markerShape"square" | "circle" | "diamond""square"Marker shape
showConnectorbooleantrueShow connecting lines
checkpointsArray<{ label: string, completed?: boolean, active?: boolean }>-Checkpoint items for progress tracking

Examples

Project Timeline

Vertical timeline with milestones

🚀
Jan 2024

Project Started

Initial planning phase completed.

Feb 2024

Development

Building core features.

🔍
Mar 2024

Testing

QA scheduled for next month.

Checkpoint Progress

Step-by-step progress tracker

🚀
Jan 2024

Project Started

Initial planning phase completed.

Feb 2024

Development

Building core features.

🔍
Mar 2024

Testing

QA scheduled for next month.

Horizontal Timeline

Horizontal layout for wide displays

🚀
Jan 2024

Project Started

Initial planning phase completed.

Feb 2024

Development

Building core features.

🔍
Mar 2024

Testing

QA scheduled for next month.

Accessibility

This component is built with accessibility in mind, including proper ARIA attributes, keyboard navigation, and focus management.