GooseUI

Components

Paint Roller Loader

New

A paint roller rolls across a stripe and leaves color behind it, then the paint fades and the stroke starts over. Pure CSS, no animation library. The paint takes the primary token and can be changed with a CSS variable.

Browser Support

color-mix()

Mixes paint and highlight colors

Your browser:

Preview

Preparing your workspace

Installation

npx shadcn@latest add @gooseui/paint-roller-loader
pnpm dlx shadcn@latest add @gooseui/paint-roller-loader
yarn dlx shadcn@latest add @gooseui/paint-roller-loader
bunx --bun shadcn@latest add @gooseui/paint-roller-loader

Usage

import { PaintRollerLoader } from "@/components/ui/paint-roller-loader"

export default function Example() {
  return <PaintRollerLoader size={220} label="Preparing your workspace" />
}

Examples

Size and speed

size sets the width in px, everything else scales with it. duration is one stroke in ms.

Loading
Loading
Loading
<PaintRollerLoader size={80} />
<PaintRollerLoader size={140} duration={1800} />
<PaintRollerLoader size={200} duration={3200} />

Colors

Override --paint-roller-color for the paint, --paint-roller-frame for the handle and --paint-roller-track for the unpainted stripe.

Loading
Applying the new theme
<PaintRollerLoader
  style={{ "--paint-roller-color": "var(--chart-1)" } as React.CSSProperties}
/>

// or with Tailwind
<PaintRollerLoader className="[--paint-roller-color:var(--chart-2)]" />

Props

PropTypeDefaultDescription
sizenumber160Width of the illustration in px
durationnumber2400One stroke cycle, ms
labelReactNode-Visible caption under the roller
srLabelstring"Loading"Screen reader text when there is no caption
classNamestring-Additional CSS classes
styleCSSProperties-Inline styles, a place for the CSS variables

CSS variables

VariableDefaultDescription
--paint-roller-colorvar(--primary)Paint color
--paint-roller-framevar(--foreground)Handle and roller outline
--paint-roller-trackvar(--muted)Unpainted stripe

Features

  • Pure CSS: three keyframes, no JavaScript and no motion
  • Scales: geometry is in em, one font-size resizes the drawing
  • Accessible: role="status", the caption or srLabel is announced
  • Reduced motion: the roller stops halfway along a painted stripe