useDroppableCollectionState

Manages state for a droppable collection.

installyarn add react-stately
version3.33.0
usageimport {useDroppableCollectionState} from 'react-stately'

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.
isDisabledbooleanWhether drop events are disabled.

Methods

MethodDescription
setTarget( (target: DropTargetnull )): 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.