### Install react-canvas-confetti via npm Source: https://github.com/ulitcos/react-canvas-confetti/blob/master/README.md This command installs the `react-canvas-confetti` package using npm. It is expected that React is already installed as a peer dependency. ```bash npm i react-canvas-confetti ``` -------------------------------- ### Use Fireworks preset with autorun in React Source: https://github.com/ulitcos/react-canvas-confetti/blob/master/README.md This example demonstrates the minimum code required to use a pre-configured confetti animation preset, `Fireworks`, within a React component. It automatically runs the animation with a specified speed. ```typescript import Fireworks from "react-canvas-confetti/dist/presets/fireworks"; function Example() { return ; } export default Example; ``` -------------------------------- ### Conductor Instance API for controlling presets Source: https://github.com/ulitcos/react-canvas-confetti/blob/master/README.md This API documentation defines the `TConductorInstance` type, which provides methods to manually control preset animations. It includes functions to run, shoot, pause, and stop animations, along with parameters for `run`. ```APIDOC type TRunAnimationParams = { speed: number; duration?: number; delay?: number; }; type TConductorInstance = { run: (params: TRunAnimationParams) => void; shoot: () => void; pause: () => void; stop: () => void; }; ``` -------------------------------- ### Advanced API Settings for React Canvas Confetti Presets Source: https://github.com/ulitcos/react-canvas-confetti/blob/master/README.md Documents advanced configuration options available for presets in the react-canvas-confetti library, allowing for automatic animation control, customization of animation settings, and access to instance objects for manual creation and animation control. ```APIDOC Advanced API: autorun: Type: { speed: number; duration?: number; delay?: number; } Description: if it is passed, it automatically starts the animation when mounting the component on the page decorateOptions: Type: (options: TOptions) => TOptions Description: the callback allows you to customize the animation settings and is called for each step of the animation onInit: Type: (params: { confetti: TCanvasConfettiInstance; conductor: TConductorInstance }) => void Description: the callback is called when the component is mounted on the page and allows you to access objects for manual creation and animation control ``` -------------------------------- ### Base API Properties for React Canvas Confetti Component Source: https://github.com/ulitcos/react-canvas-confetti/blob/master/README.md This section details the common properties available for configuring the 'react-canvas-confetti' component. These properties control aspects like canvas dimensions, CSS styling, global animation settings, and provide a callback for accessing the confetti instance upon component initialization. ```APIDOC Base API Properties: width: Type: string | number Description: Value is responsible for the width of the canvas. Alternative ways to control canvas sizes are className and style props. height: Type: string | number Description: Value is responsible for the height of the canvas. Alternative ways to control canvas sizes are className and style props. className: Type: string Description: Value to set className to canvas element. style: Type: CSSProperties Description: Value to set style to canvas element. If `style` and `className` are not passed, the default styles will be set. globalOptions: Type: TGlobalOptions (link: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/canvas-confetti/index.d.ts#L126) Description: Global animation settings that cannot be changed after initialization (details: https://github.com/catdad/canvas-confetti?tab=readme-ov-file#confetticreatecanvas-globaloptions--function). onInit: Type: (params: {confetti: TCanvasConfettiInstance}) => void Description: The callback is called when the component is mounted on the page and allows you to access confetti instance (details: https://github.com/catdad/canvas-confetti?tab=readme-ov-file#confettioptions-object--promisenull) for manual animation creation. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.