SelectionArea

February 11, 2026 · View on GitHub

A component that enables mouse-driven rectangular selection of items within a container. Tracks selected and deselected elements as the user drags to create a selection rectangle, supporting both row and tile view layouts.

Usage

import { SelectionArea } from "@docspace/ui-kit/components/selection-area";

<SelectionArea
  containerClass="files-container"
  selectableClass="file-item"
  scrollClass="scroll-wrapper"
  itemsContainerClass="items-wrapper"
  itemClass="item"
  viewAs="row"
  onMove={({ added, removed, clear }) => {
    // Update selection state
  }}
/>

Features

  • Rectangular selection: Click-and-drag to select multiple items
  • Add/remove tracking: Reports newly added and removed elements on each move
  • View-aware: Adapts selection logic for row and tile layouts
  • Scroll support: Works within scrollable containers
  • Configurable geometry: Supports custom item heights, row gaps, and tile counts

Properties

PropTypeDefaultDescription
containerClassstringCSS class of the outer container element
selectableClassstringCSS class of selectable child elements
onMove({ added, removed, clear }) => voidCallback fired as the selection rectangle changes
scrollClassstringCSS class of the scrollable container
viewAsTViewAsCurrent view mode ("row" or "tile")
itemsContainerClassstringCSS class of the items wrapper element
itemClassstringCSS class of individual item elements
isRoomsbooleanWhether the selection area is used for rooms
folderHeaderHeightnumberHeight of the folder header in pixels
arrayTypesTArrayTypes[]Item type configuration (height, row gap, etc.)
countTilesInRownumberNumber of tiles per row in tile view
defaultHeaderHeightnumberDefault header height in pixels
onMouseDown(event: MouseEvent) => voidOptional mouse down event callback