base-progress

PreviousNext
Docs
reuiui

Preview

Loading preview…
registry/default/ui/base-progress.tsx
import * as React from 'react';
import { cn } from '@/registry/default/lib/utils';
import { Progress as BaseProgress } from '@base-ui-components/react/progress';

function Progress({ className, children, ...props }: React.ComponentProps<typeof BaseProgress.Root>) {
  return (
    <BaseProgress.Root data-slot="progress" className="relative" {...props}>
      <BaseProgress.Track
        data-slot="progress-track"
        className={cn('bg-secondary block h-1.5 w-full overflow-hidden rounded-full', className)}
      >
        <BaseProgress.Indicator
          data-slot="progress-indicator"
          className="bg-primary block h-full w-full transition-all"
        />
      </BaseProgress.Track>
      {children}
    </BaseProgress.Root>
  );
}

function ProgressValue({ className, ...props }: React.ComponentProps<typeof BaseProgress.Value>) {
  return (
    <BaseProgress.Value
      data-slot="progress-value"
      className={cn('text-foreground mt-1.5 flex justify-end text-sm font-medium', className)}
      {...props}
    />
  );
}

export { Progress, ProgressValue };

Installation

npx shadcn@latest add @reui/base-progress

Usage

import { BaseProgress } from "@/components/ui/base-progress"
<BaseProgress />