Chevron Steps
shadcn-extras/chevron-stepsFreeComponent
Arrowed step progress bar with clickable segments.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/NayanDevLab/shadcn-extras/dev/public/c/chevron-steps.jsonSource
1'use client';23import * as React from 'react';4import { cn } from '@/lib/utils';56export type ChevronStep = {7 id?: string | number;8 label: string;9 /** Optional accessible description (shown via title attr). */10 description?: string;11 /** Optional custom classes per step. */12 className?: string;13 /** Disable click for this step. */14 disabled?: boolean;15};1617export type ChevronStepsProps = {18 /** Steps in order. */19 steps: ChevronStep[];2021 /** Zero-based current step index. */22 current?: number;2324 /** Called when a (non-disabled) step is clicked. */25 onStepClick?: (index: number, step: ChevronStep) => void;2627 /** Sizes & look */28 size?: 'sm' | 'md' | 'lg';29 variant?: 'brand' | 'neutral';3031 /** Tail (arrow) width in px (CSS variable) */32 tailWidth?: number;3334 /** Roundness on the bar */35 radius?: 'md' | 'lg' | 'xl' | '2xl';3637 /** Allow horizontal scroll on small screens */38 scrollable?: boolean;3940 /** Root class */41 className?: string;4243 /** Slot overrides */44 stepClassName?: string;45 stepActiveClassName?: string;46 stepCompletedClassName?: string;47 stepUpcomingClassName?: string;48};4950/**51 * ChevronSteps: horizontally joined chevron items with a configurable arrow tail,52 * a11y-friendly (list+buttons), and simple API.53 */54export default function ChevronSteps({55 steps,56 current = 0,57 onStepClick,58 size = 'md',59 variant = 'brand',60 tailWidth = 18,61 radius = '2xl',62 scrollable = true,63 className,64 stepClassName,65 stepActiveClassName,66 stepCompletedClassName,67 stepUpcomingClassName,68}: ChevronStepsProps) {69 const h =70 size === 'sm'71 ? 'h-8 text-xs'72 : size === 'lg'73 ? 'h-14 text-base'74 : 'h-11 text-sm';75 const pad = size === 'sm' ? 'px-4' : size === 'lg' ? 'px-7' : 'px-6';76 const r =77 radius === 'md'78 ? 'rounded-md'79 : radius === 'lg'80 ? 'rounded-lg'81 : radius === 'xl'82 ? 'rounded-xl'83 : 'rounded-2xl';8485 // The chevron shape uses a clip-path polygon with --twc-tail custom property86 // to create the arrow head. We mask the first/last to give rounded ends.87 const baseStep =88 'relative isolate flex grow select-none items-center justify-center whitespace-nowrap font-medium transition-colors';8990 const theme =91 variant === 'brand'92 ? {93 active: 'bg-blue-700 text-white',94 completed:95 'bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-200',96 upcoming:97// … truncated
Files it writes
More from shadcn-extras
All 33 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Image Gridanimated-image-grid | shadcn-extras | Components | Free | no deps · 3 files | |
| Blog Card Fourblog-card-four | shadcn-extras | Components | Free | 1 dep | |
| Blog Card Oneblog-card-one | shadcn-extras | Components | Free | no deps | |
| Blog Card Threeblog-card-three | shadcn-extras | Components | Free | 1 dep | |
| Blog Card Twoblog-card-two | shadcn-extras | Components | Free | 1 dep | |
| Bulb Iconbulb-icon | shadcn-extras | Components | Free | 2 deps | |
| Circular Gallerycircular-gallery | shadcn-extras | Components | Free | no deps · 3 files | |
| Clock Iconclock-icon | shadcn-extras | Components | Free | 2 deps |
