# Timeline Stats

> Key numbers plotted along a horizontal timeline of moments and dates. Use it to tell a growth story across quarters on an about or press page.

A shadcn/ui block from the [@shadcn-ui-blocks](https://www.shadcn-ui-blocks.com) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/shadcn-ui-blocks/marketing-stats-timeline-stats).

- Page, with a live preview: https://shadcn.exchange/r/shadcn-ui-blocks/marketing-stats-timeline-stats
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/shadcn-ui-blocks/marketing-stats-timeline-stats-light-6e62abb13f2f9cc6.png
- Registry item: https://www.shadcn-ui-blocks.com/r/marketing-stats-timeline-stats.json
- Listed: 2026-10-13, source last changed 2026-10-13

## Install

```bash
npx shadcn@latest add https://www.shadcn-ui-blocks.com/r/marketing-stats-timeline-stats.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- npm packages: `class-variance-authority`, `lucide-react`, `radix-ui`

## Files

### `components/blocks/marketing/stats/timeline-stats.tsx`

```tsx
import { Badge } from '@/components/ui/badge';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { ArrowUpRight, ArrowDownRight, Clock } from 'lucide-react';
import { cn } from '@/lib/utils';

export default function TimelineStats() {
  // Data for different time periods
  const periods = [
    { id: 'weekly', label: 'Weekly' },
    { id: 'monthly', label: 'Monthly' },
    { id: 'quarterly', label: 'Quarterly' },
    { id: 'yearly', label: 'Yearly' },
  ];

  // Stats data organized by time period
  const statsByPeriod = {
    weekly: [
      {
        label: 'New Sign-ups',
        value: '1,284',
        change: 12.3,
        trend: 'up',
        previousLabel: 'Previous week',
      },
      {
        label: 'Active Sessions',
        value: '32,891',
        change: 8.7,
        trend: 'up',
        previousLabel: 'Previous week',
      },
      {
        label: 'Conversion Rate',
        value: '5.2%',
        change: 0.8,
        trend: 'up',
        previousLabel: 'Previous week',
      },
      {
        label: 'Support Tickets',
        value: '187',
        change: -5.3,
        trend: 'down',
        previousLabel: 'Previous week',
        inversePositive: true, // Lower is better
      },
    ],
    monthly: [
      {
        label: 'New Sign-ups',
        value: '5,726',
        change: 15.8,
        trend: 'up',
        previousLabel: 'Previous month',
      },
      {
        label: 'Active Sessions',
        value: '142,308',
        change: 11.2,
        trend: 'up',
        previousLabel: 'Previous month',
      },
      {
        label: 'Conversion Rate',
        value: '6.7%',
        change: 1.4,
        trend: 'up',
        previousLabel: 'Previous month',
      },
      {
        label: 'Support Tickets',
        value: '834',
        change: -3.1,
        trend: 'down',
        previousLabel: 'Previous month',
        inversePositive: true,
      },
    ],
    quarterly: [
      {
        label: 'New Sign-ups',
        value: '18,492',
        change: 32.1,
        trend: 'up',
        previousLabel: 'Previous quarter',
      },
      {
        label: 'Active Sessions',
        value: '487,125',
        change: 24.3,
        trend: 'up',
        previousLabel: 'Previous quarter',
      },
      {
        label: 'Conversion Rate',
        value: '8.3%',
        change: 2.1,
        trend: 'up',
        previousLabel: 'Previous quarter',
      },
      {
        label: 'Support Tickets',
        value: '2,874',
        change: -8.5,
        trend: 'down',
        previousLabel: 'Previous quarter',
        inversePositive: true,
      },
    ],
    yearly: [
      {
        label: 'New Sign-ups',
        value: '76,542',
        change: 65.4,
        trend: 'up',
        previousLabel: 'Previous year',
      },
      {
        label: 'Active Sessions',
        value: '2.1M',
        change: 48.7,
        trend: 'up',
        previousLabel: 'Previous year',
      },
      {
        label: 'Conversion Rate',
        value: '9.2%',
        change: 3.5,
        trend: 'up',
        previousLabel: 'Previous year',
      },
      {
        label: 'Support Tickets',
        value: '12,458',
        change: -12.3,
        trend: 'down',
        previousLabel: 'Previous year',
        inversePositive: true,
      },
    ],
  };

  return (
    <div className="container mx-auto px-4 py-24 md:px-6 lg:py-32 2xl:max-w-[1400px]">
      <div className="mx-auto max-w-6xl">
        <div className="flex flex-col space-y-6">
          <div className="space-y-2 text-center">
            <Badge className="mb-2">Performance Timeline</Badge>
            <h2 className="text-3xl font-bold md:text-4xl">
              Growth Progression
            </h2>
            <p className="text-muted-foreground mx-auto max-w-2xl">
              Track our key metrics over different time periods to see our
              consistent growth and improvements
            </p>
          </div>

          <Tabs defaultValue="monthly" className="mt-8 w-full">
            <div className="mb-8 flex justify-center">
              <TabsList>
                {periods.map((period) => (
                  <TabsTrigger key={period.id} value={period.id}>
                    {period.label}
                  </TabsTrigger>
                ))}
              </TabsList>
            </div>

            {periods.map((period) => (
              <TabsContent key={period.id} value={period.id} className="mt-4">
                <div className="grid gap-6 md:grid-cols-2 lg:grid-cols-4">
                  {statsByPeriod[period.id as keyof typeof statsByPeriod].map(
                    (stat, index) => (
                      <div
                        key={index}
                        className="bg-card rounded-lg border p-6 transition-shadow hover:shadow-md"
                      >
                        <div className="flex items-start justify-between">
                          <p className="text-lg font-medium">{stat.label}</p>
                          <div className="flex items-center">
                            <Clock className="text-muted-foreground mr-1 h-4 w-4" />
                            <span className="text-muted-foreground text-xs">
                              {period.label}
                            </span>
                          </div>
                        </div>

                        <h3 className="mt-4 text-3xl font-bold">
                          {stat.value}
                        </h3>

                        <div className="mt-2 flex items-center">
                          <div
                            className={cn(
                              'flex items-center rounded-full px-2 py-1 text-xs font-medium',
                              (stat.trend === 'up' && !stat.inversePositive) ||
                                (stat.trend === 'down' && stat.inversePositive)
                                ? 'bg-emerald-50 text-emerald-600 dark:bg-emerald-950 dark:text-emerald-400'
                                : 'bg-rose-50 text-rose-600 dark:bg-rose-950 dark:text-rose-400'
                            )}
                          >
                            {stat.trend === 'up' ? (
                              <ArrowUpRight className="mr-1 h-3 w-3" />
                            ) : (
                              <ArrowDownRight className="mr-1 h-3 w-3" />
                            )}
                            {Math.abs(stat.change)}%
                          </div>
                          <p className="text-muted-foreground ml-2 text-sm">
                            vs {stat.previousLabel}
                          </p>
                        </div>
                      </div>
                    )
                  )}
                </div>
              </TabsContent>
            ))}
          </Tabs>
        </div>
      </div>
    </div>
  );
}
```

### `components/ui/badge.tsx`

```tsx
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { Slot } from "radix-ui"

import { cn } from "@/lib/utils"

const badgeVariants = cva(
  "group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",
  {
    variants: {
      variant: {
        default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
        secondary:
          "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
        destructive:
          "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
        outline:
          "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
        ghost:
          "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
        link: "text-primary underline-offset-4 hover:underline",
      },
    },
    defaultVariants: {
      variant: "default",
    },
  }
)

function Badge({
  className,
  variant = "default",
  asChild = false,
  ...props
}: React.ComponentProps<"span"> &
  VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
  const Comp = asChild ? Slot.Root : "span"

  return (
    <Comp
      data-slot="badge"
      data-variant={variant}
      className={cn(badgeVariants({ variant }), className)}
      {...props}
    />
  )
}

export { Badge, badgeVariants }
```

### `components/ui/tabs.tsx`

```tsx
"use client"

import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { Tabs as TabsPrimitive } from "radix-ui"

import { cn } from "@/lib/utils"

function Tabs({
  className,
  orientation = "horizontal",
  ...props
}: React.ComponentProps<typeof TabsPrimitive.Root>) {
  return (
    <TabsPrimitive.Root
      data-slot="tabs"
      data-orientation={orientation}
      className={cn(
        "group/tabs flex gap-2 data-horizontal:flex-col",
        className
      )}
      {...props}
    />
  )
}

const tabsListVariants = cva(
  "group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-9 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",
  {
    variants: {
      variant: {
        default: "bg-muted",
        line: "gap-1 bg-transparent",
      },
    },
    defaultVariants: {
      variant: "default",
    },
  }
)

function TabsList({
  className,
  variant = "default",
  ...props
}: React.ComponentProps<typeof TabsPrimitive.List> &
  VariantProps<typeof tabsListVariants>) {
  return (
    <TabsPrimitive.List
      data-slot="tabs-list"
      data-variant={variant}
      className={cn(tabsListVariants({ variant }), className)}
      {...props}
    />
  )
}

function TabsTrigger({
  className,
  ...props
}: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
  return (
    <TabsPrimitive.Trigger
      data-slot="tabs-trigger"
      className={cn(
        "relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
        "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
        "data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground",
        "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
        className
      )}
      {...props}
    />
  )
}

function TabsContent({
  className,
  ...props
}: React.ComponentProps<typeof TabsPrimitive.Content>) {
  return (
    <TabsPrimitive.Content
      data-slot="tabs-content"
      className={cn("flex-1 text-sm outline-none", className)}
      {...props}
    />
  )
}

export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }
```
