oxyn

Square Fill: a loading animation

A square grid of dots that fills ring by ring, then empties. A React loader for AI agent loading states. Install with the shadcn CLI.

Installation

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

npx shadcn@latest add https://oxyn.space/r/square-fill.json

Usage

Updates live with the parameters you set.

import { SquareFill } from "@/components/square-fill";

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

Props

PropTypeDefaultDescription
dotShape"round"|"square""round"Shape of each dot.
dotSizenumber2.5Resting dot size in px.
scalenumber1.5How many times larger a dot grows at the peak of the animation.
densitynumber11Dots across the width of the sheet.
sizenumber160Width and height of the orb in px.
durationnumber1.2Seconds for the ring to cross the sheet once. It crosses twice per loop: once to fill, once to empty.
gapnumber0.3Seconds to rest between loops.
ringWidthnumber0.35Thickness of the ring where dots are growing or shrinking, as a fraction of the sheet radius.
direction"out"|"in""out""out" fills and empties from the center to the edge; "in" from the edge to the center.
minOpacitynumber0.25Opacity of resting dots. Dots at full size are always fully opaque.
colorstring"#e4e4e7"Dot 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

Square Fill is one of the animations in Dot Square. Use the group when the agent's state changes, and it morphs between them.

More states

Also for this state