rc

useDroppableCollectionState

Manages state for a droppable collection.

installyarn add @react-stately/dnd
version3.0.0-rc.0
usageimport {useDroppableCollectionState} from '@react-stately/dnd'

API#


useDroppableCollectionState( (props: DroppableCollectionStateOptions )): DroppableCollectionState

Interface#


Properties

NameTypeDescription
collectionCollection<Node<unknown>>A collection of items.
selectionManagerMultipleSelectionManagerAn interface for reading and updating multiple selection state.
targetDropTargetnullThe current drop target.

Methods

MethodDescription
setTarget( (target: DropTarget )): voidSets the current drop target.
isDropTarget( (target: DropTarget )): booleanReturns whether the given target is equivalent to the current drop target.
getDropOperation( (e: DropOperationEvent )): DropOperationReturns the drop operation for the given parameters.

Example#


See the docs for useDroppableCollection in react-aria for an example of useDroppableCollectionState.