Animate, Format, and Localize Numbers with Number Flow

Transition, format, and localize numbers with smooth animations in your web app using Number-flow. This lightweight library supports React, Vue, and Svelte.

Number-flow is a lightweight, cross-framework component that enables you to transition, format, and localize numbers in your web applications. Compatible with Svelte, React, and Vue.

This component handles the intricate details of number formatting and localization. You can define how numbers appear, including the locale, currency, and animation timings. Use it for displaying financial data, statistical updates, counters, or any dynamic numerical content where smooth transitions improve user engagement.

Features

🌍 Localization Support: Uses the Intl.NumberFormat API for locale-aware number formatting.

⏱️ Fine-grained Animation Control: Adjust animation duration, easing, and direction for a polished look.

Accessibility: Designed with accessibility in mind, respecting user preferences for reduced motion.

🎨 Customizable Formatting: Control the appearance of numbers with options for currency, styling, and custom prefixes/suffixes.

🎚️ Trend Indication: Specify whether numbers should trend upwards, downwards, or dynamically based on value changes.

Installation

You can install Number-flow using your preferred package manager:

For Svelte:

npm install @number-flow/svelte

For React:

npm install @number-flow/react

For Vue:

npm install @number-flow/vue

Usage

Svelte:

<NumberFlow value={12345} />

React:

import NumberFlow from '@number-flow/react'
<NumberFlow value={12345} />

Vue:

<script setup>
  import NumberFlow from '@number-flow/vue'
</script>
<template>
   <NumberFlow :value="12345" />
</template>

Related Resources

  1. Intl.NumberFormat MDN Documentation: Learn more about number formatting standards in JavaScript
  2. Easing Functions Generator: Explore advanced animation timing and easing techniques
  3. Web Animation API: Understand core web animation principles

Preview

animate-format-localize-numbers
Maxwell Barvian

Maxwell Barvian

Leave a Reply

Your email address will not be published. Required fields are marked *