Feedback

Animated number.

Locale-aware metric changes with one committed accessible value.

LIVE PREVIEWTry it. It works.

Install the source

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/animated-number.json

Registry setup · Examples · API and behavior · Open the playground

COMPLETE EXAMPLES

Use it in context.

Each example includes its imports, data and state. The preview runs that same source. Include the stylesheet once in your application.

A metric with a stable accessible value

Locale-aware numbers animate visually while assistive technology receives the committed value once.

Keyboard

  • Tab reaches the value controls.

States covered

  • positive and negative values
  • rapid updates
  • locale formatting
  • reduced motion

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-motion-number-metric.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useState} from 'react';
import {AnimatedNumber,Button} from '@bld8/ui';
export default function Metric(){const [value,setValue]=useState(2400);return <section><h3>Illustrative balance</h3><p style={{fontSize:36}}><AnimatedNumber label="Balance" value={value} format={{style:'currency',currency:'AUD',maximumFractionDigits:0}}/></p><div className="actions"><Button onClick={()=>setValue(previous=>previous+125)}>Add 125</Button><Button variant="secondary" onClick={()=>setValue(previous=>previous-250)}>Subtract 250</Button></div><p className="bui-hint">A local example value, with no account or payment connection.</p></section>;}

Finite extremes without invalid intermediate values

A scientific-format metric settles directly when the interpolation range would overflow.

Keyboard

  • The sign button keeps focus as the value updates.

States covered

  • finite extremes
  • scientific formatting
  • safe fallback
  • reduced motion

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-motion-number-finite-range.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useState} from 'react';
import {AnimatedNumber,Button} from '@bld8/ui';
export default function FiniteRange(){const [positive,setPositive]=useState(false);return <section><h3>A finite numerical range</h3><p><AnimatedNumber label="Scientific value" value={positive?Number.MAX_VALUE:-Number.MAX_VALUE} format={{notation:'scientific',maximumFractionDigits:3}}/></p><Button onClick={()=>setPositive(value=>!value)}>Change sign</Button><p className="bui-hint">Finite endpoints can have an overflowing difference. This case settles without invalid intermediate values.</p></section>;}

Quick reference

React / TypeScript
<AnimatedNumber value={balance} label="Balance" format={{style:"currency",currency:"AUD"}} />

In the workspace or ZIP starter, import components from @bld8/ui and include @bld8/ui/styles.css once. Registry installations use your local bld8/ source path. Wrap overlays in UIProvider.

API & behaviour

Visual numbers interpolate with interruptible easing. The accessible text holds the committed target and is not a live region. Invalid numbers display an em dash. Formatting supports Intl.NumberFormat; reduced motion and offscreen updates settle directly.

AnimatedNumber

AnimatedNumber public properties
PropTypeDefault
valueRequirednumber—
classNamestring | undefined—
durationnumber | undefined.45
formatIntl.NumberFormatOptions | undefined—
labelstring | undefined—
localestring | undefined—

Tables come from the public TypeScript declarations. Related types and function parameters are shown alongside their component. A dash means no default is declared at the public function boundary.

Related controls

Notes to self

Test this component with real content, keyboard input and both themes. The example is a starting point; labels, error handling and behaviour still need to fit the application.