Overview

WebGrid supports row selection via row numbers, cell range selection via click+drag or shift+click, column selection via header clicks, and select all via Ctrl+A or clicking the # header. All modes support keyboard shortcuts for batch operations, copying to clipboard, and pasting from Excel.

Row Selection

RS01 Basic Row Selection

Click row numbers to select rows. Use Ctrl+Click to toggle, Shift+Click for range selection, or drag to select multiple rows.

Selection: Click row numbers to select rows...
Selection Controls
  • Click row number - Select single row (clears others)
  • Ctrl+Click - Toggle row in selection
  • Shift+Click - Select range from last selected
  • Click+Drag - Select range while dragging
  • Escape - Clear selection
Row Selection API
 

RS02 Row Selection with Shortcuts

Select rows and press Ctrl+C to copy, or Delete to remove them.

Action: Select rows and use shortcuts...
Range Shortcuts for Rows
 

Cell Range Selection

CS01 Click+Drag Mode

Click and drag on cells to select a rectangular range. Press Delete to clear selected cells.

Selection: Click and drag on cells to select a range...
Cell Selection API
 

CS02 Shift+Click Mode

Use cellSelectionMode: 'shift' when editTrigger: 'click' to avoid conflicts. Hold Shift and click two cells to define a range.

Selection: Hold Shift and click two cells to select range...
Shift Mode Configuration
 

Copy to Clipboard

Excel-Compatible Copy

Copy selected rows or cell ranges to clipboard in TSV format (tab-separated values). Paste directly into Excel, Google Sheets, or any spreadsheet application.

Result: Select rows or cells, then press Ctrl+C...
Try It
  1. Select rows (click row numbers) or cells (click+drag on cells)
  2. Press Ctrl+C
  3. Open Excel/Google Sheets and paste
  4. Toggle "Include column headers" and try again
Copy to Clipboard
 
Output Format (TSV)
Clipboard Format
 

API Reference

Properties

PropertyTypeDescription
Row Selection
selectedRowsnumber[]Array of selected row indices (read-only, sorted ascending)
Cell Selection
cellSelectionMode'disabled' | 'click' | 'shift'Cell selection mode (default: 'click')
selectedCellRangeCellRange | nullCurrent cell range selection (read-only)
Copy
shouldCopyWithHeadersbooleanInclude column headers when copying (default: false)
Shortcuts
rangeShortcutsRangeShortcut[]Keyboard shortcuts for selected rows/cells

Methods

MethodDescription
Row Selection
selectRow(index, mode)Select a row. Mode: 'replace', 'toggle', or 'range'
selectRowRange(from, to)Select a range of rows
clearSelection()Clear all selected rows
isRowSelected(index)Check if a row is selected
getSelectedRowsData()Get the data objects for selected rows
Cell Selection
selectCellRange(range)Select a cell range programmatically
clearCellSelection()Clear cell range selection
getSelectedCells()Get array of selected cell info objects
Copy
copyCellSelectionToClipboard()Copy cell range as TSV. Returns Promise<boolean>
copySelectedRowsToClipboard()Copy selected rows as TSV. Returns Promise<boolean>

TypeScript Types

Types
 

CSS Variables

VariableDefaultDescription
Row Selection
--wg-selection-bgcolor-mix(in srgb, var(--wg-accent-color) 15%, transparent)Background color of selected rows
--wg-selection-row-number-bgvar(--wg-accent-color)Background of selected row number cell
--wg-selection-row-number-colorwhiteText color of selected row number
--wg-selection-border-width2pxBorder width around selected row block
--wg-selection-border-colorvar(--wg-accent-color)Border color around selected row block
Cell Selection
--wg-cell-selection-bgcolor-mix(in srgb, var(--wg-accent-color) 10%, transparent)Background of selected cells
--wg-cell-selection-bordervar(--wg-accent-color)Border color of selection range
--wg-cell-selection-border-width2pxBorder width of selection range

Column Selection

Click column headers to select entire columns. Use Ctrl+Click for multi-column and Shift+Click for range selection.

Column Selection API
 

Select All

Click the row number header (#) or use Ctrl+A to select all cells.

Select All
 

Paste from Clipboard

Paste TSV data from clipboard (e.g., copied from Excel) with Ctrl+V. The grid parses tab-separated values and applies them to the selected cell range.

Paste Configuration
 

Paste Configuration Properties

PropertyTypeDefaultDescription
pasteMode'skip-non-editable' | 'all-columns' | 'editable-only''skip-non-editable'How to handle non-editable cells during paste
shouldValidateOnPastebooleantrueRun column validation on pasted values
createRowCallback(pastedData, rowIndex) => T-Callback to create new rows when pasting beyond existing data
Note: Paste respects row locking — locked rows are automatically skipped during paste operations.

Row Focus / Master-Detail

Track which row is focused for master/detail patterns:

Row Focus