https://github.com/tsparticles/inferno
Inferno.js tsParticles official component
https://github.com/tsparticles/inferno
hacktoberfest inferno javascript tsparticles typescript
Last synced: 5 months ago
JSON representation
Inferno.js tsParticles official component
- Host: GitHub
- URL: https://github.com/tsparticles/inferno
- Owner: tsparticles
- License: mit
- Created: 2022-11-11T00:46:41.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-26T23:28:32.000Z (10 months ago)
- Last Synced: 2025-04-19T10:28:22.683Z (6 months ago)
- Topics: hacktoberfest, inferno, javascript, tsparticles, typescript
- Language: TypeScript
- Homepage:
- Size: 816 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://particles.js.org)
# inferno-particles
[](https://www.npmjs.com/package/inferno-particles) [](https://www.npmjs.com/package/inferno-particles) [](https://github.com/sponsors/matteobruni)
Official [tsParticles](https://github.com/matteobruni/tsparticles) Inferno component
[](https://discord.gg/hACwv45Hme) [](https://t.me/tsparticles)
[](https://www.producthunt.com/posts/tsparticles?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-tsparticles")
## Installation
```shell
npm install inferno-particles
```or
```shell
yarn add inferno-particles
```## How to use
### Code
Examples:
_Remote url_
```javascript
import Particles from "inferno-particles";
import { loadFull } from "tsparticles";class App extends Component {
constructor(props) {
super(props);this.particlesInit = this.particlesInit.bind(this);
this.particlesLoaded = this.particlesLoaded.bind(this);
}particlesInit(main) {
console.log(main);// you can initialize the tsParticles instance (main) here, adding custom shapes or presets
// this loads the tsparticles package bundle, it's the easiest method for getting everything ready
// starting from v2 you can add only the features you need reducing the bundle size
loadFull(main);
}particlesLoaded(container) {
console.log(container);
}render() {
return (
);
}
}
```_Options object_
```javascript
import Particles from "inferno-particles";
import { loadFull } from "tsparticles";class App extends Component {
constructor(props) {
super(props);this.particlesInit = this.particlesInit.bind(this);
this.particlesLoaded = this.particlesLoaded.bind(this);
}particlesInit(main) {
console.log(main);// you can initialize the tsParticles instance (main) here, adding custom shapes or presets
// this loads the tsparticles package bundle, it's the easiest method for getting everything ready
// starting from v2 you can add only the features you need reducing the bundle size
loadFull(main);
}particlesLoaded(container) {
console.log(container);
}render() {
return (
);
}
}
```### Props
| Prop | Type | Definition |
| --------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| id | string | The id of the element. |
| width | string | The width of the canvas. |
| height | string | The height of the canvas. |
| options | object | The options of the particles instance. |
| url | string | The remote options url, called using an AJAX request |
| style | object | The style of the canvas element. |
| className | string | The class name of the canvas wrapper. |
| canvasClassName | string | the class name of the canvas. |
| container | object | The instance of the [particles container](https://particles.js.org/docs/modules/Core_Container.html) |
| init | function | This function is called after the tsParticles instance initialization, the instance is the parameter and you can load custom presets or shapes here |
| loaded | function | This function is called when particles are correctly loaded in canvas, the current container is the parameter and you can customize it here |Find your parameters configuration [here](https://particles.js.org).
## Demos
The demo website is [here](https://particles.js.org)
There's also a CodePen collection actively maintained and updated [here](https://codepen.io/collection/DPOage)