oxyn

Bar Transfer: a loader for upload and download

A ring of thin bars fills to a progress with a pulsing leading bar. A React loader for uploads and downloads. Install with shadcn.

Installation

Install with the shadcn CLI, or copy the component file. It only needs React.

npx shadcn@latest add https://oxyn.space/r/bar-transfer.json

Usage

Updates live with the parameters you set.

import { BarTransfer } from "@/components/bar-transfer";

export function Thinking() {
  return (
    <BarTransfer />
  );
}

Props

PropTypeDefaultDescription
barsnumber36Number of bars around the ring.
barHeightnumber12Resting height of each bar in px, pointing away from the center.
barWidthnumber2Thickness of each bar in px. Capped so neighbors never overlap.
radiusnumber1Corner radius of each bar in px.
extendnumber10How far a transferred bar grows in px.
durationnumber0.16Seconds one bar takes to grow; the leading bar pulses every four of these.
staggernumber0.04Seconds between one bar filling and the next while looping.
direction"out"|"in""out"Which way the push carries a bar: away from the center, or toward it.
progressnumber0.6How much has transferred. Leave the prop out in code to fill and drain on a loop.
sizenumber160Width and height of the orb in px.
minOpacitynumber0.35Opacity of resting bars. Bars at the peak of the wave are always fully opaque.
colorstring"#e4e4e7"Bar color.
pausedbooleanfalseCoast to a stop on the current frame without unmounting. Turning it off eases back up to speed.
labelstring"Thinking"Accessible name; the wrapper is role="status".
className / style——Spread onto the wrapper div, along with any other div props.

Switch states

Bar Transfer is one of the animations in Bar Ring. Use the group when the agent's state changes, and it morphs between them.

More states

Also for this state