Numbers and statuses
ValueCut: only the digits that changed roll, and the value gives a small punch so the eye catches it.
with <Cuts />
1,284
Status: Pending
When a stock number changes, it just changes, and nobody notices. ValueCut rolls only the digits that changed, in the direction of the change, and gives the value a small punch. Text, like an order status, crossfades instead.
Install
npx shadcn add @keyframery/value-cutIf your project doesn't know @keyframery yet, do the Quick start first.
Use
Put ValueCut where the value is rendered:
import { ValueCut } from "@/components/keyframery/value-cut"
<ValueCut value={visitors} format={{ notation: "compact" }} />
<ValueCut value={price} format={{ style: "currency", currency: "USD" }} locale="en-US" />
<ValueCut value={order.status} announce />You should see
When the value changes, only the digits that changed roll up or down, and the whole value briefly grows and settles. A status crossfades with a small slide.
Options
Prop
Type
Good to know
- Numbers use tabular figures, so the digits don't shift sideways.
- The punch scales the value to 1.06 and back over 300 ms. Text crossfades with a 6px slide.
- The first render never animates, and with reduced motion the value swaps instantly.
In film, a quick push toward the subject is a punch-in.