Object Handle

Drag/reposition affordance for spatial objects that need a calm grab target. Install Object Handle from the VLLNT UI registry with the shadcn CLI.

Report a bug

Drag/reposition affordance for spatial objects that need a calm grab target. Part of the utility family in VLLNT UI, it ships as a machine-readable registry entry — copy the source directly into your app with the shadcn CLI and own it, no runtime dependency on a component library.

Preview

Switch between light and dark to inspect the embedded Storybook preview.

Installation

Add Object Handle to your project with the shadcn CLI. The source lands in your codebase, ready to adapt:

pnpm dlx shadcn@latest add https://ui.vllnt.ai/r/object-handle.json

Source

import type { ReactNode } from "react"; import { cn } from "../../lib/utils"; export type ObjectHandleProps = Omit< React.ComponentPropsWithoutRef<"button">, "type" > & { hint?: ReactNode; label?: ReactNode; }; const ObjectHandle = ({ className, hint, label = "Move", ref, ...props }: ObjectHandleProps & { ref?: React.Ref<HTMLButtonElement> }) => ( <button className={cn( "inline-flex items-center gap-2 rounded-full border border-border/60 bg-background/85 px-3 py-1.5 text-xs font-medium text-muted-foreground shadow-sm transition-colors hover:border-border hover:text-foreground", className, )} ref={ref} type="button" {...props} > <span aria-hidden="true" className="grid grid-cols-2 gap-0.5 text-[8px] leading-none" > <span></span> <span></span> <span></span> <span></span> </span> <span>{label}</span> {hint ? <span className="text-muted-foreground/80">{hint}</span> : null} </button> ); ObjectHandle.displayName = "ObjectHandle"; export { ObjectHandle };

Stories

Explore every variant and state in the interactive Storybook:

Preview

Switch between light and dark to inspect the embedded Storybook preview.

Dependencies

  • @vllnt/ui@^0.3.0