Skip to content
Get Kosh Pro
← All components
Motion

ComponentsFill Ring

Fill Ring

Progress that earns its finish.

  • Spring layer
  • Implemented
  • Free to install · MIT

onGoal has fired 0 times.

motion prop

onSettle has fired 0 times. The prop can only calm this component further. The switch at the top of the page and your system setting still apply.

Why it moves this way

A progress ring that fills at a steady rate looks the same at 10% and at 100%. The overshoot gives every update a little weight, and saving the burst for the goal keeps it meaningful. Losing progress is not celebrated: the arc comes back the same way, with no burst.

Use it

PowerShell / install
npx shadcn@latest add https://kosh-hazel.vercel.app/r/fill-ring.json
React / TypeScript
import { FillRing } from "@/kosh/fill-ring/fill-ring";

<FillRing
  data={{ value: 42, goal: 60 }}
  label="minutes"
  onGoal={() => console.log("goal reached")}
/>

Add the @kosh registry entry to components.json first, so the CLI can fetch motion-core as well. Then wrap your app in KoshProvider once, and import tokens.css and motion.css in your global stylesheet. Read the setup guide ↗ Read the source ↗

At each motion level

full
The arc springs from its current angle to the new one with about 11% overshoot, keeping its velocity if a new value arrives mid-flight. On reaching the goal the ring pops by 6% and a signal ring leaves outward.
reduced
The arc and its round caps jump to the new angle. On reaching the goal the signal ring fades where it stands.
none
New angle, new number. onGoal still fires: it is an event, not an animation.

Props

Fill Ring props
PropTypeDefaultWhat it does
data{ value: number; goal: number }requiredProgress and its target.
sizenumber120Diameter in px. The component reserves size × size.
thicknessnumber10Ring thickness in px.
labelstringnoneShown under the number, and used as the accessible name.
onGoal() => voidnoneFires once each time the value reaches the goal from below, at every motion level.
caps"round" | "square""round"The ends of the arc.
enterbooleanfalseIf the ring is off screen at load, the arc sweeps up from zero as it scrolls into view.
Shared by every Kosh component
PropTypeDefaultWhat it does
motion"auto" | "full" | "reduced" | "none""auto"Motion for this component only. The calmest of this prop, the provider and the operating system wins.
tone"ink" | "signal" | "muted""ink"Which colour carries the data.
onSettle() => voidnoneCalled once the component has come to rest after an update.
classNamestringnoneAdded to the root element.

Theme with CSS variables on any ancestor: --k-ring-track, --k-tone.

Accessibility

  • It is a real progressbar, with the value, the goal and text such as “42 of 60”.
  • Reaching the goal is also said in words (“Goal reached.”), not only shown by the burst.
  • The burst plays once per arrival and never loops.

Limits and differences

  • The spec lists this as a Motion component. It uses a small spring of its own (useSpringValue) instead, because one spring has to turn several elements and report when it comes to rest.