Modern Progress
bucharitesh/modern-progressFreeComponent
A modern progress component for Next.js apps with next-themes and Tailwind CSS, supporting system, light, and dark modes.
Install it
npx shadcn@latest add https://bucharitesh.in/r/modern-progress.jsonSource
1import { cn } from '@/lib/utils';2import { type VariantProps, cva } from 'class-variance-authority';3import * as React from 'react';45const progressVariants = cva(6 'relative flex w-full items-center justify-center overflow-hidden',7 {8 variants: {9 variant: {10 default: 'border-4 border-primary bg-neutral-950',11 secondary: 'border-4 border-secondary bg-neutral-900',12 destructive: 'border-4 border-destructive bg-neutral-950',13 },14 radius: {15 default: 'rounded-3xl',16 full: 'rounded-full',17 none: 'rounded-none',18 },19 },20 defaultVariants: {21 variant: 'default',22 radius: 'default',23 },24 }25);2627const indicatorVariants = cva(28 'absolute bottom-0 left-0 z-20 w-full transition-[height,background-color] duration-300',29 {30 variants: {31 variant: {32 default: 'bg-primary',33 secondary: 'bg-secondary',34 destructive: 'bg-destructive',35 },36 striped: {37 true: '[&>div]:bg-[linear-gradient(45deg,rgba(255,255,255,.15)_25%,transparent_25%,transparent_50%,rgba(255,255,255,.15)_50%,rgba(255,255,255,.15)_75%,transparent_75%,transparent)] [&>div]:bg-size-1',38 false: '',39 },40 },41 defaultVariants: {42 variant: 'default',43 striped: true,44 },45 }46);4748export interface ProgressProps49 extends React.HTMLAttributes<HTMLDivElement>,50 VariantProps<typeof progressVariants> {51 value?: number;52 max?: number;53 striped?: boolean;54 indicatorClassName?: string;55 showText?: boolean;56}5758const Progress = React.forwardRef<HTMLDivElement, ProgressProps>(59 (60 {61 className,62 value = 0,63 max = 100,64 variant,65 radius,66 striped = true,67 indicatorClassName,68 showText,69 ...props70 },71 ref72 ) => {73 const percentage = Math.min(Math.max((value / max) * 100, 0), 100);7475 return (76 <div77 ref={ref}78 role="progressbar"79 aria-valuemin={0}80 aria-valuemax={max}81 aria-valuenow={value}82 className={cn(progressVariants({ variant, radius }), className)}83 {...props}84 >85 <div className="relative aspect-video w-full">86 <div87 className={cn(88 indicatorVariants({ variant, striped }),89 indicatorClassName90 )}91 style={{92 height: `${percentage}%`,93 }}94 >95 <div96 data-pattern="stripes"97// … truncated
What it pulls in
npm packages
Files it writes
More from bucharitesh
All 26 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Bookbook | bucharitesh | Components | Free | 1 dep · 2 files | |
| Game of Lifegame-of-life | bucharitesh | Components | Free | no deps | |
| Magical Mousemagical-mouse | bucharitesh | Components | Free | 1 dep | |
| Metallic Buttonmetallic-button | bucharitesh | Components | Free | 2 deps | |
| Pixel Iconpixel-icon | bucharitesh | Components | Free | no deps | |
| Split Text Effectsplit-text-effect | bucharitesh | Components | Free | 1 dep | |
| Text Highlighttext-highlight | bucharitesh | Components | Free | 1 dep | |
| View Magnifierview-magnifier | bucharitesh | Components | Free | 1 dep |
