Skip to content

    Browse components

    Draggable Avatar

    An avatar you can drag and fling around its container; it springs to the nearest corner with the throw's momentum.

    Open
    Customize

    top-left
    top-right
    bottom-left
    bottom-right
    circle
    rounded

    Installation

    npx shadcn@latest add @glint-ui/draggable-avatar

    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/draggable-avatar.json

    Usage

    import { DraggableAvatar } from "@/components/ui/draggable-avatar";
    
    <div className="relative h-96 overflow-hidden rounded-3xl">
      <DraggableAvatar src="/me.jpg" alt="Your camera" corner="bottom-right" />
    </div>

    Props

    PropTypeDefaultDescription
    srcstring—Image URL.
    altstring"Avatar"Accessible name.
    sizenumber88Avatar size in px.
    corner"top-left" | "top-right" | "bottom-left" | "bottom-right""bottom-right"Corner it starts in.
    paddingnumber16Gap to the container edge in px.
    shape"circle" | "rounded""circle"Circle or rounded square.
    stiffnessnumber380Spring stiffness of the snap.
    dampingnumber26Spring damping. Lower is bouncier.
    statusbooleantrueGreen presence dot.
    classNamestring—Extra classes for the root element.