11# [ React Number Easing] ( http://javierbyte.github.io/react-number-easing/ )
2- [ ![ Rate on Openbase] ( https://badges.openbase.com/js/rating/che-react-number-easing.svg )] ( https://openbase.com/js/che-react-number-easing?utm_source=embedded&utm_medium=badge&utm_campaign=rate-badge )
32
43React component for fancy number transitions.
54
65[ Live demo] ( https://che-wf.github.io/react-number-easing/ )
76
87[ ![ react-number-easing screenshot] ( assets/number-easing-infinite.gif )] ( https://che-wf.github.io/react-number-easing/ )
98
10-
119## Installation
1210
1311``` js
1412npm i - S che- react- number- easing
1513```
1614
17- ## Usage.
15+
16+ ## Accessibility
17+
18+ ` NumberEasing ` uses the semantic ` <output aria-live="polite"> ` element to display animated numbers. This ensures that screen readers announce changes to the value automatically.
19+
20+ You can pass custom ARIA attributes (e.g., ` aria-label ` ) to further improve accessibility for your use case:
21+
22+ ``` jsx
23+ < NumberEasing value= {1234 } aria- label= " Total sales" / >
24+ ```
25+
26+ ## Usage
1827
1928``` jsx
20- const NumberEasing = require ( ' che-react-number-easing' ) ;
29+ import { NumberEasing } from " che-react-number-easing" ;
2130
2231< NumberEasing
2332 ease= " quintInOut"
@@ -26,41 +35,55 @@ const NumberEasing = require('che-react-number-easing');
2635 trail= {true }
2736 useLocaleString= {true }
2837 value= {15 }
29- / >
38+ / > ;
3039```
3140
3241### Props
3342
34- * ` [ease] ` : The easing equation for the animation.
35- * Default: ` quintInOut ` (You can choose from [ mattdesl/eases] ( https://github.com/mattdesl/eases/blob/master/index.js ) .)
36- * Type: ` string `
37- * ` [precision] ` : How many decimal places you want to show?
38- * Default: ` 2 `
39- * Type: ` number `
40- * ` [speed] ` : How fast do you want to finish the animation?
41- * Default:` 500 ` (ms)
42- * Type: ` number `
43- * ` [trail] ` : Do you want trailing zeroes?
44- * Default: ` false `
45- * Type: ` boolean `
46- * ` [useLocaleString] ` : Use number formatting based on locale?
47- * Default: ` false `
48- * Type: ` boolean `
49- * ` [value] ` : The value that you want to display at the end of the animation.
50- * ` Required `
51- * Type: ` number `
52-
53- # Build
54-
55- If you want to build this from source, you will need babel and less.
56-
57- ``` js
43+ - ` [ease] ` : The easing equation for the animation.
44+ - Default: ` quintInOut ` (You can choose from [ mattdesl/eases] ( https://github.com/mattdesl/eases/blob/master/index.js ) .)
45+ - Type: ` string `
46+ - ` [precision] ` : How many decimal places you want to show?
47+ - Default: ` 2 `
48+ - Type: ` number `
49+ - ` [speed] ` : How fast do you want to finish the animation?
50+ - Default:` 500 ` (ms)
51+ - Type: ` number `
52+ - ` [trail] ` : Do you want trailing zeroes?
53+ - Default: ` false `
54+ - Type: ` boolean `
55+ - ` [useLocaleString] ` : Use number formatting based on locale?
56+ - Default: ` false `
57+ - Type: ` boolean `
58+ - ` [value] ` : The value that you want to display at the end of the animation.
59+ - ` Required `
60+ - Type: ` number `
61+
62+ ## Requirements
63+
64+ - React 18 or newer
65+
66+ ## Build
67+
68+ To build from source:
69+
70+ ``` sh
5871npm install
72+ npm run build
5973```
6074
61- And run the pre publish script
75+ ## Test
6276
63- ``` js
64- npm run prepare
77+ To run tests:
78+
79+ ``` sh
80+ npm test
6581```
82+
6683[ ![ HitCount] ( http://hits.dwyl.com/{username}/che-wf/react-number-easing.svg )] ( http://hits.dwyl.com/{username}/che-wf/react-number-easing )
84+
85+ ## Project Structure
86+
87+ - Main component: ` src/components/NumberEasing.jsx `
88+ - All components are exported from ` src/index.jsx `
89+ [ ![ HitCount] ( http://hits.dwyl.com/{username}/che-wf/react-number-easing.svg )] ( http://hits.dwyl.com/{username}/che-wf/react-number-easing )
0 commit comments