Skip to content

    Browse components

    Gravity

    Drops any elements into a real physics box where they tumble, stack, and can be grabbed and thrown.

    Open
    Customize

    Installation

    npx shadcn@latest add @glint-ui/gravity

    First time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/gravity.json

    Usage

    import { Gravity } from "@/components/ui/gravity";
    
    <Gravity className="h-96">
      <span className="rounded-full bg-lime-300 px-5 py-2">React</span>
      <span className="rounded-full bg-cyan-300 px-5 py-2">Physics</span>
    </Gravity>

    Props

    PropTypeDefaultDescription
    childrenReactNode—Each direct child becomes a physics body.
    gravitynumber1Downward gravity; negative floats things up.
    bouncenumber0.35Restitution, 0 = dead stop, 1 = superball.
    frictionnumber0.2Surface friction between bodies.
    startOnViewbooleantrueWait until the container scrolls into view before dropping.
    classNamestring—Extra classes for the root element.