Skip to content
VenusUI
Get started

Bar Loader

A thin indeterminate progress bar for pages and cards that are loading.

Preview

Installation

npx shadcn@latest add @venusui/bar-loader

Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.

Files added to your project

Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.

  • @/components/ui/bar-loader.tsx

Usage

The code behind the preview above.

bar-loader-demo.tsx

import { BarLoader } from "@/components/ui/bar-loader"

export default function BarLoaderDemo() {
  return (
    <div className="w-full max-w-sm overflow-hidden rounded-xl border bg-card">
      <BarLoader label="Loading results" className="rounded-none" />
      <div className="space-y-2 p-4">
        <div className="h-3 w-2/3 rounded bg-muted" />
        <div className="h-3 w-1/2 rounded bg-muted" />
      </div>
    </div>
  )
}

API reference

PropTypeDefaultDescription
labelstring"Loading"Accessible name, e.g. “Loading results”.

All <div> props except children.

Requirements

  • Tailwind CSS v4. The CLI adds the bar-loader keyframes and --animate-bar-loader to your CSS. Works in Server Components.

Customization

  • Pin it to the top of the page with className="fixed inset-x-0 top-0 z-50 rounded-none".
  • The bar uses your theme’s primary color; edit bg-primary in the file to change it.

Accessibility

  • Uses role="progressbar" without a value, which screen readers announce as busy or indeterminate.
  • With reduced motion the bar fills the track and pulses instead of sliding.

Troubleshooting

The bar doesn’t move.
Check that the bar-loader keyframes are in your CSS (the CLI adds them).
Unknown registry "@venusui"
Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.
No components.json found
Run npx shadcn@latest init in your project first.
Loading preview

Three dots that rise and fall in turn, for typing or inline loading states.

Loading preview

A CSS-only cube with six content faces that tumbles slowly and pauses on hover.

Loading preview

A tilted wall of vertically scrolling columns, for screenshots and showcases.