UNPKG

react-confetti-explosion

Version:

A lightweight css-animation based confetti exploder for React

26 lines (25 loc) 1.36 kB
import * as React from 'react'; export interface ConfettiProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'ref'> { /** Number of confetti particles to render. @default 100 */ particleCount?: number; /** Duration of the animation in milliseconds. @default 2200 */ duration?: number; /** Array of colors to use for the confetti particles. @default ['#FFC700', '#FF0000', '#2E3191', '#41BBC7'] */ colors?: string[]; /** Size of each particle in pixels. @default 12 */ particleSize?: number; /** Force of the explosion (0-1). Higher values make particles shoot higher. @default 0.5 */ force?: number; /** Height of the confetti explosion area. Can be a number (pixels) or string (e.g. "120vh"). @default "120vh" */ height?: number | string; /** Width of the confetti explosion area in pixels. @default 1000 */ width?: number; /** Whether to render the confetti in a portal (attached to document.body). @default true */ portal?: boolean; /** z-index of the confetti container. Useful for controlling stacking context. */ zIndex?: number; /** Callback function that is called when the animation completes. */ onComplete?: () => void; } declare const ConfettiExplosion: (props: ConfettiProps) => React.JSX.Element | null; export { ConfettiExplosion };