Progress
Displays an indicator showing the completion progress of a task, typically displayed as a progress bar.
'use client'
import Progress from '@dinui/react/progress'import * as React from 'react'
export default function ProgressDemo() { const [progress, setProgress] = React.useState(13)
React.useEffect(() => { const timer = setTimeout(() => setProgress(66), 500) return () => clearTimeout(timer) }, [])
return <Progress value={progress} className="w-[60%]" />}Installation
-
Follow Installation Guide
To enable DinUI functionality in your project, you will need to properly set up Tailwind and install the necessary dependencies. -
All done
You now can start using this component in your project.
-
Follow Installation Guide
To enable DinUI functionality in your project, you will need to properly set up Tailwind and install the necessary dependencies. -
Run the following command in your project
Terminal window npx @dinui/cli@latest add progressTerminal window yarn dlx @dinui/cli@latest add progressTerminal window pnpm dlx @dinui/cli@latest add progressTerminal window bunx @dinui/cli@latest add progress -
Update the import paths to match your project setup
-
All done
You now can start using this component in your project.
-
Follow Installation Guide
To enable DinUI functionality in your project, you will need to properly set up Tailwind and install the necessary dependencies. -
Install dependencies
Terminal window npm install @radix-ui/react-progress tailwind-variants type-festTerminal window yarn add @radix-ui/react-progress tailwind-variants type-festTerminal window pnpm add @radix-ui/react-progress tailwind-variants type-festTerminal window bun add @radix-ui/react-progress tailwind-variants type-fest -
Copy and paste the following code into your project
'use client'import * as ProgressPrimitive from '@radix-ui/react-progress'import { forwardRef } from 'react'import { tv } from 'tailwind-variants'import type { Merge } from 'type-fest'const progress = tv({slots: {root: 'relative overflow-hidden h-2 rounded-full bg-bg--muted',indicator: 'transition-all h-full bg-fg-brand rounded-full',},})const Progress = forwardRef<React.ElementRef<typeof ProgressPrimitive.Root>,Merge<React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>,{indicatorProps?: React.ComponentProps<typeof ProgressPrimitive.Indicator>}>>(({ indicatorProps, value, ...props }, ref) => {const { root, indicator } = progress()return (<ProgressPrimitive.Root{...props}ref={ref}value={value}className={root({ className: props.className })}><ProgressPrimitive.Indicator{...indicatorProps}className={indicator({ className: indicatorProps?.className })}style={{...indicatorProps?.style,transform: `translateX(-${100 - (value || 0)}%)`,}}/></ProgressPrimitive.Root>)})Progress.displayName = ProgressPrimitive.Root.displayNameexport default Progressexport { progress, ProgressPrimitive } -
Update the import paths to match your project setup
-
All done
You now can start using this component in your project.