Skip to content

    Browse components

    Slingshot

    Pull the button back on rubber bands and let go: past the threshold it fires and whips home with overshoot. A normal click works too.

    Open
    Customize

    Installation

    npx shadcn@latest add @glint-ui/slingshot

    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/slingshot.json

    Usage

    import { Slingshot } from "@/components/ui/slingshot";
    
    <Slingshot threshold={50} onClick={() => fire()}>Launch</Slingshot>

    Props

    PropTypeDefaultDescription
    childrenReactNode—Button label.
    thresholdnumber50Px the button must be pulled back to fire on release.
    elasticitynumber0.5How far the button follows the pointer while pulled.
    classNamestring—Extra classes for the root element.