5.0
API
Hooks
useCellContext

useCellContext

The useCellContext hook provides access to the context of a specific cell within the ReactGrid component. This hook is essential for obtaining detailed information about a cell's position, selection state, focus state, and styling. It allows you to interact with and manipulate individual cells programmatically.

import { useCellContext } from '@silevis/reactgrid'
 
const ctx = useCellContext();

Properties

NameTypeDescription
realRowIndexnumberNumerical cell's row index representation in relation to the whole grid.
realColumnIndexnumberNumerical cell's column index representation in relation to the whole grid.
rowSpannumber | undefinedRepresents how many rows the cell should occupy.
colSpan number | undefinedRepresents how many columns the cell should occupy.
containerStyleReact.CSSPropertiesProvides the cell container's style.
isSelectedbooleanChecks if the cell is selected.
isFocusedbooleanChecks if the cell is focused.