Skip to Content
React Flow 13 is here! Read the announcement →
ReferenceTypes

SelectionStore

Source on GitHub 

The selection store returned by the useSelectionStore() hook provides information about the current selection box drawn by the user. You might use this to display the dimensions of the selection box to the user in real-time.

import { useSelectionStore, type SelectionStore } from '@xyflow/react'; const inspectorTransformSelector = ({ userSelectionRect }: SelectionStore) => `transform(${userSelectionRect.startX}px, ${userSelectionRect.startY - 10}px)`; export function SelectionBoxInspector() { const transform = useSelectionStore(inspectorTransformSelector); const selectionWidth = useSelectionStore(state => state.userSelectionRect.width); const selectionHeight = useSelectionStore(state => state.userSelectionRect.height); return ( <p style={{ transform }}> {selectionWidth} x {selectionHeight} </p> ); }
NameTypeDefault
userSelectionRectSelectionRect | null