Browse components
Ballpit
Glossy colored balls tumble in with gravity, collide and pile up; sweep the cursor through to shove them around. Canvas 2D.
Ballpit
Installation
npx shadcn@latest add @glint-ui/ballpitFirst time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glint-ui-seven.vercel.app/r/ballpit.json
Usage
import { Ballpit } from "@/components/ui/ballpit";
<div className="relative h-96">
<Ballpit count={60} />
</div>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| count | number | 60 | Number of balls. |
| colors | string[] | ["#c6ff3d","#22d3ee","#a78bfa","#f472b6","#fbbf24"] | Ball colors. |
| size | number | 1 | Ball size multiplier. |
| gravity | number | 1 | Gravity multiplier; 0 floats. |
| bounce | number | 0.7 | Bounciness. |
| interactive | boolean | true | The cursor shoves the balls. |
| cursorRadius | number | 90 | Px radius of the cursor's push. |
| className | string | — | Extra classes for the root element. |