# Funnel Stats

> A stepped funnel showing how many visitors move from view to signup to paid. Use it to explain conversion and where users drop off in your flow.

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-funnel-stats).

- Page, with a live preview: https://shadcn.exchange/r/shadcn-ui-blocks/marketing-stats-funnel-stats
- Screenshot: https://abzjhwgwpdpz7ua5.public.blob.vercel-storage.com/shots/shadcn-ui-blocks/marketing-stats-funnel-stats-light-a7dcfb91662575f3.png
- Registry item: https://www.shadcn-ui-blocks.com/r/marketing-stats-funnel-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-funnel-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`, `radix-ui`

## Files

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

```tsx
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { cn } from '@/lib/utils';
import { useState } from 'react';

type FunnelStage = {
  id: string;
  name: string;
  color: string;
  value: number;
  formatted: string;
  dropoff: number;
  dropoffFormatted: string;
};

type FunnelType = 'marketing' | 'onboarding' | 'checkout';

type FunnelData = {
  [key in FunnelType]: {
    title: string;
    description: string;
    stages: FunnelStage[];
    metrics: {
      conversionRate: string;
      dropoffPoint: string;
      totalOpportunity: string;
    };
  };
};

export default function FunnelStats() {
  const [funnelType, setFunnelType] = useState<FunnelType>('marketing');

  // Sample data for different funnel types
  const funnelData: FunnelData = {
    marketing: {
      title: 'Marketing Funnel',
      description: 'How visitors convert through our marketing pipeline',
      stages: [
        {
          id: 'visitors',
          name: 'Website Visitors',
          color: 'bg-blue-500',
          value: 124862,
          formatted: '124,862',
          dropoff: 0,
          dropoffFormatted: '0%',
        },
        {
          id: 'leads',
          name: 'Lead Capture',
          color: 'bg-indigo-500',
          value: 32845,
          formatted: '32,845',
          dropoff: 73.7,
          dropoffFormatted: '73.7%',
        },
        {
          id: 'mql',
          name: 'Marketing Qualified',
          color: 'bg-violet-500',
          value: 12462,
          formatted: '12,462',
          dropoff: 62.1,
          dropoffFormatted: '62.1%',
        },
        {
          id: 'sql',
          name: 'Sales Qualified',
          color: 'bg-purple-500',
          value: 4628,
          formatted: '4,628',
          dropoff: 62.9,
          dropoffFormatted: '62.9%',
        },
        {
          id: 'opportunities',
          name: 'Opportunities',
          color: 'bg-fuchsia-500',
          value: 1842,
          formatted: '1,842',
          dropoff: 60.2,
          dropoffFormatted: '60.2%',
        },
        {
          id: 'customers',
          name: 'Customers',
          color: 'bg-pink-500',
          value: 684,
          formatted: '684',
          dropoff: 62.9,
          dropoffFormatted: '62.9%',
        },
      ],
      metrics: {
        conversionRate: '0.55%',
        dropoffPoint: 'Lead Capture (73.7%)',
        totalOpportunity: '$1.24M',
      },
    },
    onboarding: {
      title: 'User Onboarding',
      description: 'How new users complete the onboarding process',
      stages: [
        {
          id: 'signups',
          name: 'New Sign-ups',
          color: 'bg-emerald-500',
          value: 8426,
          formatted: '8,426',
          dropoff: 0,
          dropoffFormatted: '0%',
        },
        {
          id: 'profile',
          name: 'Profile Completion',
          color: 'bg-green-500',
          value: 6842,
          formatted: '6,842',
          dropoff: 18.8,
          dropoffFormatted: '18.8%',
        },
        {
          id: 'education',
          name: 'Education Steps',
          color: 'bg-lime-500',
          value: 5124,
          formatted: '5,124',
          dropoff: 25.1,
          dropoffFormatted: '25.1%',
        },
        {
          id: 'integration',
          name: 'Integration Setup',
          color: 'bg-yellow-500',
          value: 3845,
          formatted: '3,845',
          dropoff: 25.0,
          dropoffFormatted: '25.0%',
        },
        {
          id: 'teammates',
          name: 'Team Invites',
          color: 'bg-amber-500',
          value: 2546,
          formatted: '2,546',
          dropoff: 33.8,
          dropoffFormatted: '33.8%',
        },
        {
          id: 'activated',
          name: 'Fully Activated',
          color: 'bg-orange-500',
          value: 1982,
          formatted: '1,982',
          dropoff: 22.2,
          dropoffFormatted: '22.2%',
        },
      ],
      metrics: {
        conversionRate: '23.5%',
        dropoffPoint: 'Team Invites (33.8%)',
        totalOpportunity: '6,444 users',
      },
    },
    checkout: {
      title: 'Checkout Process',
      description: 'How users navigate through our checkout flow',
      stages: [
        {
          id: 'cart',
          name: 'Add to Cart',
          color: 'bg-cyan-500',
          value: 15842,
          formatted: '15,842',
          dropoff: 0,
          dropoffFormatted: '0%',
        },
        {
          id: 'checkout',
          name: 'Begin Checkout',
          color: 'bg-sky-500',
          value: 8426,
          formatted: '8,426',
          dropoff: 46.8,
          dropoffFormatted: '46.8%',
        },
        {
          id: 'shipping',
          name: 'Shipping Info',
          color: 'bg-blue-500',
          value: 6284,
          formatted: '6,284',
          dropoff: 25.4,
          dropoffFormatted: '25.4%',
        },
        {
          id: 'payment',
          name: 'Payment Info',
          color: 'bg-indigo-500',
          value: 4624,
          formatted: '4,624',
          dropoff: 26.4,
          dropoffFormatted: '26.4%',
        },
        {
          id: 'review',
          name: 'Order Review',
          color: 'bg-violet-500',
          value: 3946,
          formatted: '3,946',
          dropoff: 14.7,
          dropoffFormatted: '14.7%',
        },
        {
          id: 'purchase',
          name: 'Purchase Complete',
          color: 'bg-purple-500',
          value: 3248,
          formatted: '3,248',
          dropoff: 17.7,
          dropoffFormatted: '17.7%',
        },
      ],
      metrics: {
        conversionRate: '20.5%',
        dropoffPoint: 'Begin Checkout (46.8%)',
        totalOpportunity: '$394,850',
      },
    },
  };

  const currentFunnel = funnelData[funnelType];

  // Calculate the max value for scaling
  const maxValue = Math.max(
    ...currentFunnel.stages.map((stage) => stage.value)
  );

  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-5xl">
        <div className="mb-12 text-center">
          <Badge className="mb-2">Analytics</Badge>
          <h2 className="text-3xl font-bold md:text-4xl">Conversion Funnel</h2>
          <p className="text-muted-foreground mx-auto mt-3 max-w-2xl">
            Visualize how users progress through key business processes
          </p>
        </div>

        {/* Funnel Type Selector */}
        <div className="mb-10 flex justify-center">
          <Tabs
            defaultValue="marketing"
            value={funnelType}
            onValueChange={(value) => setFunnelType(value as FunnelType)}
            className="w-full max-w-md"
          >
            <TabsList className="grid w-full grid-cols-3">
              <TabsTrigger value="marketing">Marketing</TabsTrigger>
              <TabsTrigger value="onboarding">Onboarding</TabsTrigger>
              <TabsTrigger value="checkout">Checkout</TabsTrigger>
            </TabsList>
          </Tabs>
        </div>

        {/* Funnel Visualization */}
        <div className="mb-8">
          <Card>
            <CardHeader>
              <CardTitle>{currentFunnel.title}</CardTitle>
              <p className="text-muted-foreground text-sm">
                {currentFunnel.description}
              </p>
            </CardHeader>
            <CardContent>
              <div className="flex flex-col items-center space-y-2">
                {currentFunnel.stages.map((stage, index) => (
                  <div key={stage.id} className="w-full">
                    <div className="mb-1 flex items-center justify-between">
                      <span className="text-sm font-medium">{stage.name}</span>
                      <div className="text-sm tabular-nums">
                        <span className="font-medium">{stage.formatted}</span>
                        {index > 0 && (
                          <span className="text-muted-foreground ml-2 text-xs">
                            (-{stage.dropoffFormatted})
                          </span>
                        )}
                      </div>
                    </div>

                    {/* Funnel Bar */}
                    <div className="bg-muted h-8 w-full overflow-hidden rounded-md">
                      <div
                        className={cn('h-full rounded-md', stage.color)}
                        style={{
                          width: `${Math.max(
                            (stage.value / maxValue) * 100,
                            5
                          )}%`,
                          transition: 'width 0.5s ease-out',
                        }}
                      />
                    </div>

                    {/* Dropoff Arrow */}
                    {index < currentFunnel.stages.length - 1 && (
                      <div className="my-1 flex justify-center">
                        <svg
                          width="24"
                          height="14"
                          viewBox="0 0 24 14"
                          fill="none"
                          xmlns="http://www.w3.org/2000/svg"
                          className="text-muted-foreground"
                        >
                          <path
                            d="M12 14L23.1244 0.5H0.875645L12 14Z"
                            fill="currentColor"
                          />
                        </svg>
                      </div>
                    )}
                  </div>
                ))}
              </div>
            </CardContent>
          </Card>
        </div>

        {/* Metrics Summary */}
        <div className="grid grid-cols-1 gap-4 md:grid-cols-3">
          <Card className="gap-0">
            <CardHeader className="">
              <CardTitle className="text-muted-foreground text-sm font-medium">
                Conversion Rate
              </CardTitle>
            </CardHeader>
            <CardContent>
              <div className="text-2xl font-bold">
                {currentFunnel.metrics.conversionRate}
              </div>
              <p className="text-muted-foreground mt-1 text-xs">
                End-to-end conversion
              </p>
            </CardContent>
          </Card>

          <Card className="gap-0">
            <CardHeader className="">
              <CardTitle className="text-muted-foreground text-sm font-medium">
                Biggest Dropoff
              </CardTitle>
            </CardHeader>
            <CardContent>
              <div className="text-2xl font-bold">
                {currentFunnel.metrics.dropoffPoint}
              </div>
              <p className="text-muted-foreground mt-1 text-xs">
                Stage with highest abandonment
              </p>
            </CardContent>
          </Card>

          <Card className="gap-0">
            <CardHeader className="">
              <CardTitle className="text-muted-foreground text-sm font-medium">
                Improvement Opportunity
              </CardTitle>
            </CardHeader>
            <CardContent>
              <div className="text-2xl font-bold">
                {currentFunnel.metrics.totalOpportunity}
              </div>
              <p className="text-muted-foreground mt-1 text-xs">
                Potential value from improvement
              </p>
            </CardContent>
          </Card>
        </div>

        {/* Action Button */}
        <div className="mt-8 flex justify-center">
          <Button>Analyze Funnel Performance</Button>
        </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/button.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 buttonVariants = cva(
  "group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
  {
    variants: {
      variant: {
        default: "bg-primary text-primary-foreground hover:bg-primary/80",
        outline:
          "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
        secondary:
          "bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
        ghost:
          "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
        destructive:
          "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
        link: "text-primary underline-offset-4 hover:underline",
      },
      size: {
        default:
          "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
        xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
        sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
        lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
        icon: "size-9",
        "icon-xs":
          "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
        "icon-sm":
          "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
        "icon-lg": "size-10",
      },
    },
    defaultVariants: {
      variant: "default",
      size: "default",
    },
  }
)

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

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

export { Button, buttonVariants }
```

### `components/ui/card.tsx`

```tsx
import * as React from "react"

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

function Card({
  className,
  size = "default",
  ...props
}: React.ComponentProps<"div"> & { size?: "default" | "sm" }) {
  return (
    <div
      data-slot="card"
      data-size={size}
      className={cn(
        "group/card flex flex-col gap-6 overflow-hidden rounded-xl bg-card py-6 text-sm text-card-foreground shadow-xs ring-1 ring-foreground/10 has-[>img:first-child]:pt-0 data-[size=sm]:gap-4 data-[size=sm]:py-4 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",
        className
      )}
      {...props}
    />
  )
}

function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="card-header"
      className={cn(
        "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-6 group-data-[size=sm]/card:px-4 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-6 group-data-[size=sm]/card:[.border-b]:pb-4",
        className
      )}
      {...props}
    />
  )
}

function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="card-title"
      className={cn(
        "font-heading text-base leading-normal font-medium group-data-[size=sm]/card:text-sm",
        className
      )}
      {...props}
    />
  )
}

function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="card-description"
      className={cn("text-sm text-muted-foreground", className)}
      {...props}
    />
  )
}

function CardAction({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="card-action"
      className={cn(
        "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
        className
      )}
      {...props}
    />
  )
}

function CardContent({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="card-content"
      className={cn("px-6 group-data-[size=sm]/card:px-4", className)}
      {...props}
    />
  )
}

function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
  return (
    <div
      data-slot="card-footer"
      className={cn(
        "flex items-center rounded-b-xl px-6 group-data-[size=sm]/card:px-4 [.border-t]:pt-6 group-data-[size=sm]/card:[.border-t]:pt-4",
        className
      )}
      {...props}
    />
  )
}

export {
  Card,
  CardHeader,
  CardFooter,
  CardTitle,
  CardAction,
  CardDescription,
  CardContent,
}
```

### `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 }
```
