title: How-To: Programmatic Selection description: Select cells, rows, and ranges via GridCommand, and read selection state back.
This guide covers how to drive selection from application code — selecting cells on mount, reacting to selection changes, and reading selected row data.
Select a cell programmatically
Use GridCommand::SelectCell to move the selection to a specific cell:
Select a range (anchor + extend)
Select entire rows
Move selection with keyboard-like delta
Read selected row indices
Inside on_selection_changed or anywhere after a mutation:
selected_row_indices() returns logical row indices (after sort/filter),
not physical positions in the data source.
Read a cell value from the selected row
Clear the selection
Enable / disable selection globally
Or use the GridCanvas shorthand:
Copy selection as TSV
In a browser context the Canvas renderer handles clipboard writes automatically when the user presses Ctrl+C.

