Keyframery

Animated Meter for UI SDK

The bar springs to its value, changes colour at thresholds and the digits roll.

Part of Keyframery, the open-source animated components for UI SDK

The demo plays by itself. Point at it or press Tab to take over.

Installation

npx shadcn@latest add @keyframery/meter

This adds components/keyframery/meter.tsx and its primitive, components/keyframery/primitives/meter.tsx, to your project, and installs @ui-sdk/react. The motion tokens are added to your global CSS the first time you install a component.

Usage

import {
  Meter,
  MeterIndicator,
  MeterLabel,
  MeterTrack,
  MeterValue,
} from "@/components/keyframery/meter"

The parts and props are the same as UI SDK's Meter. For every prop, see the UI SDK meter reference.

What moves

MoveWhat you see
SpringThe bar springs to its value; the track clips the overshoot.
RollThe reading rolls to the new number.
FadeThe bar changes colour as it crosses a threshold.

Timing and springiness follow the motion style you set, so this component moves like the rest of your app.

Swap the import

Already using UI SDK's meter with your own styles? Keep your markup and change one line. The primitive adds motion and nothing else.

// Before
import { … } from "@ui-sdk/react/meter"

// After: same parts, same props, now animated
import { … } from "@/components/keyframery/primitives/meter"

Parts

The finished component exports 5 parts:

Meter, MeterIndicator, MeterLabel, MeterTrack, MeterValue

Accessibility

Keyboard, focus and screen-reader behaviour come from UI SDK and are not changed. With reduced motion turned on, nothing in the meter moves: changes happen at once or with a short fade. More in Accessibility.

Source

The code that lands in your project. It is yours to change.

Questions

How does the animated Meter for UI SDK move?

Spring: The bar springs to its value; the track clips the overshoot. Roll: The reading rolls to the new number. Fade: The bar changes colour as it crosses a threshold.

Do I need Motion or Framer Motion for the animated Meter?

No. Every move is plain CSS, so there is nothing to install besides the component and UI SDK.

Can I keep my own styling and only take the motion?

Yes. Import from @/components/keyframery/primitives/meter instead. It has the same parts and props as @ui-sdk/react/meter and adds motion only.

What happens to the Meter when someone turns on reduced motion?

Nothing moves. State changes happen at once, or with a short fade.

On this page