Brickslab.

@brickslab/ui-web

Canvas-based confetti animation effect with customizable particles, colors, physics, and shapes. Perfect for celebrations, milestones, and success states.

Aperçu

Default Confetti (Center burst)

Props Table

PropTypeDéfautRequisDescription
particleCountnumber50Number of particles to generate.
anglenumber90Launch angle in degrees.
spreadnumber45Spread range in degrees.
startVelocitynumber45Initial particle velocity.
decaynumber0.9Velocity decay factor per frame.
gravitynumber1Gravitational pull per frame.
colorsstring[]["#CC4A48", "#4ADE80", "#FBFBFB"]Array of particle colors.
ticksnumber200Total animation duration in ticks.

Usage

tsx
import { Confetti } from "@brickslab/ui-web";
import { useState } from "react";

export function MyComponent() {
  const [isActive, setIsActive] = useState(false);

  return (
    <>
      {isActive && <Confetti particleCount={100} angle={90} spread={60} />}
      <button onClick={() => setIsActive(true)}>
        Trigger Confetti
      </button>
    </>
  );
}