Animate Number

Utility component for smoothly animating numbers

Installation

Dependency:

npm install motion

Snippet:

npx @seed-design/cli@latest add breeze:animate-number

Configuration

The animate-number component uses motion's m. components. You must configure MotionProvider in your project for lazy loading.

For more details, see the Motion Lazy Motion documentation.

MotionProvider.tsx
"use client";

import { LazyMotion } from "motion/react";
import type { ReactNode } from "react";

const loadFeatures = () => import("motion/react").then((res) => res.domAnimation);

export function MotionProvider({ children }: { children: ReactNode }) {
  return <LazyMotion features={loadFeatures}>{children}</LazyMotion>;
}
index.tsx
import { createRoot } from 'react-dom/client'
import App from './App.tsx'
import { MotionProvider } from './MotionProvider.tsx'

createRoot(document.getElementById('root')!).render(
  <MotionProvider>
    <App />
  </MotionProvider>
)

Props

Prop

Type

Examples

Comma

Gradient

Custom Style

Table of contents