react-countup
Advanced tools
Comparing version 6.0.0-2 to 6.0.0
{ | ||
"name": "react-countup", | ||
"version": "6.0.0-2", | ||
"version": "6.0.0", | ||
"description": "A React component wrapper around CountUp.js", | ||
@@ -5,0 +5,0 @@ "author": "Glenn Reyes <glenn@glennreyes.com> (https://twitter.com/glnnrys)", |
@@ -61,2 +61,5 @@ # [React CountUp](https://tr8tk.csb.app/) | ||
- [Protips](#protips) | ||
- [Trigger of transition](#trigger-of-transition) | ||
- [Run if in focus](#run-if-in-focus) | ||
- [Set accessibility properties for occupation period](#set-accessibility-properties-for-occupation-period) | ||
- [License](#license) | ||
@@ -366,4 +369,43 @@ | ||
### Set accessibility properties for occupation period | ||
You can use callback properties to control accessibility: | ||
```js | ||
import React from "react"; | ||
import CountUp, { useCountUp } from "react-countup"; | ||
export default function App() { | ||
useCountUp({ ref: "counter", end: 10, duration: 2 }); | ||
const [loading, setLoading] = React.useState(false); | ||
const onStart = () => { | ||
setLoading(true); | ||
}; | ||
const onEnd = () => { | ||
setLoading(false); | ||
}; | ||
const containerProps = { | ||
"aria-busy": loading | ||
}; | ||
return ( | ||
<> | ||
<CountUp | ||
end={123457} | ||
duration="3" | ||
onStart={onStart} | ||
onEnd={onEnd} | ||
containerProps={containerProps} | ||
/> | ||
<div id="counter" aria-busy={loading} /> | ||
</> | ||
); | ||
} | ||
``` | ||
## License | ||
MIT |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
28885
1
410