NK

Search

Search pages, posts, and components

All components

Stacked Progress

Data Display

A stacked bar whose coloured segments grow in one after another.

DesignBuildQA

Installation

Add it with the shadcn CLI:

$pnpm dlx shadcn@latest add https://nawalkattel.com.np/r/stacked-progress.json
Or install manually
  1. 1. Install dependencies

    pnpm add motion clsx tailwind-merge
  2. 2. Copy the component source into components/library/stacked-progress.tsx

Props

PropTypeDefaultDescription
segments{ label: string; value: number; color: string }[] - Segments to stack, in order.

Accessibility

  • Every segment has a labelled legend swatch, so colour is not the only cue.
  • Widths are computed from the total, so values need not sum to 100.
  • Legend wraps rather than overflowing on narrow screens.

Dependencies

motionclsxtailwind-merge