Function

useTimelineClipDrag

Headless clip body drag behavior shared by canvas and custom timeline UIs.

Usage notes

Use this when building a custom interaction layer around canvas-painted clips. The hook handles drag lifecycle, snapping preparation, cross-track drop policy, transient drop feedback, and commit/settle behavior. Package consumers using the standard DOM chrome can render `Timeline.ClipInteractionLayer` instead.

Signature

Type Definition
useTimelineClipDrag(options: UseTimelineClipDragOptions<TrackKind> = {}): UseTimelineClipDragResult

Type parameters

NameConstraintDefaultDescription
TrackKindNonestringApp-defined track kind values carried by target tracks.

Parameters

NameTypeDescription
optionsUseTimelineClipDragOptions<TrackKind>Drag geometry, vertical snap sensitivity, and optional drop policy.

Returns

Clip drag state and commands for pointer-driven body moves.

Examples

tsx Example
import { useTimelineClipDrag } from '#react/hooks';
export function CustomClipDragHandle({ clipId }: { clipId: string }) {
const drag = useTimelineClipDrag();
return (
<button
type="button"
aria-pressed={drag.dragging}
onPointerDown={(event) => {
drag.startClipDrag({
clipId,
clientX: event.clientX,
viewportY: event.nativeEvent.offsetY,
});
}}
>
Move clip
</button>
);
}