@mitcsutt/kiln-dnd
Version:
Kiln drag and drop: sortable lists, boards, drop zones and grid layouts with one keyboard model and one announcer, rendered through kiln-ui
30 lines (29 loc) • 1.36 kB
TypeScript
import { type HTMLAttributes } from 'react';
export interface DraggableProps extends Omit<HTMLAttributes<HTMLDivElement>, 'id'> {
/** Unique within the `Dnd` scope. */
id: string;
/** The item's name, as announcements and its handle say it ("Invoice 1042"). */
label: string;
/** Anything you want back in `onDragEnd` and `DropZone`'s `onDrop`. */
data?: unknown;
/** Stops the item being picked up. */
disabled?: boolean;
/**
* Drag by a `DragHandle` inside it instead of by the whole item. Use one whenever the
* item holds links, buttons or fields of its own.
*/
handle?: boolean;
}
/**
* Something you can pick up and drop onto a `DropZone`.
*
* @remarks
* `Draggable` and `DropZone` go inside one `Dnd`. Without `handle`, the whole item is
* the handle: it takes focus, and Space or Enter picks it up. The arrow keys then move it
* from zone to zone, in the order they appear on the page, and Space or Enter drops it.
*
* A pointer drag lifts the item and leaves a faded copy where it was; touch needs a short
* press first, so a swipe still scrolls the page. `Draggable` adds no chrome of its own:
* put a `Card` or any other content inside.
*/
export declare const Draggable: import("react").ForwardRefExoticComponent<DraggableProps & import("react").RefAttributes<HTMLDivElement>>;