@carbon/utilities
Version:
Utilities and helpers to drive consistency across software products using the Carbon Design System
39 lines (38 loc) • 1.14 kB
TypeScript
/**
* Copyright IBM Corp. 2025, 2025
*
* 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
*/
export declare const makeDraggable: ({ el, dragHandle, focusableDragHandle, dragStep, shiftDragStep, }: DraggableProps) => {
cleanup: () => void;
};
export {};