Progress
blacksite/progressFreeComponent
Linear progress / integrity bar with tactical tone variants.
Install it
npx shadcn@latest add https://blacksite.sh/r/progress.jsonSource
1"use client";23import * as React from "react";4import * as ProgressPrimitive from "@radix-ui/react-progress";5import { cva, type VariantProps } from "class-variance-authority";67import { cn } from "@/lib/utils";89const progressVariants = cva("relative h-1 w-full overflow-hidden rounded-[2px] bg-secondary", {10 variants: {11 size: {12 xs: "h-0.5",13 sm: "h-1",14 md: "h-1.5",15 lg: "h-2",16 },17 },18 defaultVariants: {19 size: "sm",20 },21});2223const indicatorVariants = cva("h-full transition-[width,background] duration-300 ease-out", {24 variants: {25 tone: {26 primary: "bg-primary",27 success: "bg-success",28 warning: "bg-warning",29 danger: "bg-danger",30 info: "bg-info",31 gold: "bg-gold",32 neutral: "bg-foreground/70",33 },34 },35 defaultVariants: {36 tone: "primary",37 },38});3940export interface ProgressProps41 extends42 React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>,43 VariantProps<typeof progressVariants>,44 VariantProps<typeof indicatorVariants> {45 value?: number;46}4748const Progress = React.memo(49 React.forwardRef<React.ElementRef<typeof ProgressPrimitive.Root>, ProgressProps>(50 ({ className, value = 0, tone, size, ...props }, ref) => (51 <ProgressPrimitive.Root52 ref={ref}53 className={cn(progressVariants({ size }), className)}54 {...props}55 >56 <ProgressPrimitive.Indicator57 className={cn(indicatorVariants({ tone }))}58 style={{ width: `${Math.max(0, Math.min(100, value))}%` }}59 />60 </ProgressPrimitive.Root>61 ),62 ),63);64Progress.displayName = "Progress";6566export { Progress, progressVariants };
More from blacksite
All 25 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| App headerapp-header | blacksite | Components | Free | no deps | |
| Badgebadge | blacksite | Components | Free | no deps | |
| Bar chartbar-chart | blacksite | Components | Free | no deps | |
| Buttonbutton | blacksite | Components | Free | no deps | |
| Cardcard | blacksite | Components | Free | no deps | |
| Chart tooltipchart-tooltip | blacksite | Components | Free | no deps | |
| Data listdata-list | blacksite | Components | Free | no deps | |
| Gantt timelinegantt-timeline | blacksite | Components | Free | no deps |
