@carbon/utilities
Version:
Utilities and helpers to drive consistency across software products using the Carbon Design System
47 lines • 1.19 kB
TypeScript
//#region src/makeDraggable/makeDraggable.d.ts
/**
* Copyright IBM Corp. 2025, 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
interface DraggableProps {
/**
* HTML element to move.
*/
el: HTMLElement;
/**
* HTML element to initiate the drag (e.g., header).
*/
dragHandle?: HTMLElement;
/**
* HTML element to focus on drag for keyboard interaction (e.g., Drag Icon).
*/
focusableDragHandle?: HTMLElement;
/**
* Pixel value that defines the distance to move when dragging with arrow
* keys.
*/
dragStep?: number;
/**
* Pixel value that defines the distance to move when dragging with
* shift+arrow keys.
*/
shiftDragStep?: number;
}
/**
* Makes a given element draggable using a handle element.
*@param draggable - object which accepts el and optional attributes handle,focusableInHandle,dragStep and shiftDragStep
*/
declare const makeDraggable: ({
el,
dragHandle,
focusableDragHandle,
dragStep,
shiftDragStep
}: DraggableProps) => {
cleanup: () => void;
init: () => void;
};
//#endregion
export { makeDraggable };