Interface GridRefProps

interface GridRefProps {
    allowOverlaysOverflow?: boolean;
    cellInsets?: Rectangle;
    cellLayout?: CellLayout;
    cellRenderer?: ((props) => ReactNode);
    clipCells?: boolean;
    columnCount: number;
    cursor?: string;
    defaultColumnWidth?: number;
    defaultRowHeight?: number;
    enableMouseWheel?: boolean;
    freezeLeft?: number | FrozenEdge;
    freezeLeftProps?: Partial<LineProps>;
    freezeTop?: number | FrozenEdge;
    freezeTopProps?: Partial<LineProps>;
    getColumnWidth?: ItemSizer;
    getRowHeight?: ItemSizer;
    getVisibleCells?: ((view) => (CellCoords | {
        coords: CellCoords;
        range?: CellRangeCoords;
        value?: any;
    })[]);
    gridLineColor?: string;
    gridLineColumnsProps?: SVGProps<SVGPathElement>;
    gridLineRowsProps?: SVGProps<SVGPathElement>;
    height?: number;
    hiddenCellAt?: ((coords) => boolean);
    hiddenColumnsAt?: ((colIndex, forward) => number);
    hiddenRowsAt?: ((rowIndex, forward) => number);
    mergedRanges?: CellRangeLookup | CellRangeCoords[];
    onFirstRender?: ((grid) => void);
    onImmediateScroll?: ((scrollPoint) => void);
    onViewportChange?: ((viewport) => void);
    onViewportScroll?: ((scrollPoint) => void);
    onWheelScroll?: ((event) => boolean | void);
    overlays?: ((view) => ReactNode)[];
    overlaysProps?: HTMLAttributes<HTMLDivElement>;
    ref?: Ref<HTMLDivElement>;
    rowCount: number;
    scrollPoint?: Partial<TopLeft>;
    showGridLines?: boolean | DirectionOptions;
    stageProps?: HTMLAttributes<HTMLDivElement>;
    stageWrapper?: ((children) => ReactNode);
    width?: number;
    zoom?: number;
}

Hierarchy (view full)

Properties

allowOverlaysOverflow?: boolean

Overlays are generally clipped to fit in the viewport but this allows for the properties to be overridden.

cellInsets?: Rectangle

Allow for cells to be inset. This is a way to account for borders. By default this is 1, 1, 1,x

cellLayout?: CellLayout
cellRenderer?: ((props) => ReactNode)

Return the actual element to render

Type declaration

Remarks

There can be many cells so care should be taken to ensure these are as performant as possible. By default the pointerEvents are set to none. To enable interaction this should be overwritten.

clipCells?: boolean

Clip overflow of cells unless explicitly provided

columnCount: number

Number of columns in the grid

cursor?: string

Cursor used for grid

defaultColumnWidth?: number

Passed through to

See

useCellLayoutHook. If cellLayout property is provided this is ignored

defaultRowHeight?: number

Passed through to

See

useCellLayoutHook. If cellLayout property is provided this is ignored

enableMouseWheel?: boolean

Enable dragging active cell and selections

freezeLeft?: number | FrozenEdge

Number of frozen left

freezeLeftProps?: Partial<LineProps>

Allow for customization of freezeTopDivider

freezeTop?: number | FrozenEdge

Number of frozen top

freezeTopProps?: Partial<LineProps>

Allow for customization of freezeTopDivider

getColumnWidth?: ItemSizer

Passed through to

See

useCellLayoutHook. If cellLayout property is provided this is ignored

getRowHeight?: ItemSizer

Passed through to

See

useCellLayoutHook. If cellLayout property is provided this is ignored

getVisibleCells?: ((view) => (CellCoords | {
    coords: CellCoords;
    range?: CellRangeCoords;
    value?: any;
})[])

Allows for optimization of rendering. This will allow for quick skipping of cells that have nothing to render. If this is not specified then all cells within the visible range will be iterated and if hiddenCellAt does not return false a then cell renderer will be called.

Type declaration

Returns

either a CellCoord that should be rendered or an object with a coord and value. Note - the value is passed to the cell renderer

gridLineColor?: string

Customize grid line color

Remarks

This is overwritten by gridlinePropsVertical and gridlinePropsHorizontal

gridLineColumnsProps?: SVGProps<SVGPathElement>

Gridline props for columns

gridLineRowsProps?: SVGProps<SVGPathElement>

Gridline props for rows

height?: number

Height of the grid container

hiddenCellAt?: ((coords) => boolean)

This will skip rendering. Note - This is superseded by hiddenRowsAt and hiddenColumnsAt. This is typically used for cells that have nothing to render

Type declaration

    • (coords): boolean
    • Parameters

      Returns boolean

hiddenColumnsAt?: ((colIndex, forward) => number)

Will skip rendering for this columns and the adjacent columns in the given direction.

Type declaration

    • (colIndex, forward): number
    • Parameters

      • colIndex: number
      • forward: boolean

      Returns number

hiddenRowsAt?: ((rowIndex, forward) => number)

Will skip rendering for this row and the adjacent rows in the given direction.

Type declaration

    • (rowIndex, forward): number
    • Parameters

      • rowIndex: number
      • forward: boolean

      Returns number

mergedRanges?: CellRangeLookup | CellRangeCoords[]

Is either an array of merged cells or a CellRangeLookup

onFirstRender?: ((grid) => void)

Call only once when the renders for the first time.

Type declaration

onImmediateScroll?: ((scrollPoint) => void)

Called immediately on scroll. Used for programmatic changes. Called even on load

Type declaration

    • (scrollPoint): void
    • Parameters

      Returns void

onViewportChange?: ((viewport) => void)

Fired when the view port changes. This is in pixel coordinates and is slightly different than viewable cells because off screen location range could change

Type declaration

onViewportScroll?: ((scrollPoint) => void)

Called on scroll, subject to debouncing. Used for programmatic changes. Called even on load

Type declaration

    • (scrollPoint): void
    • Parameters

      Returns void

onWheelScroll?: ((event) => boolean | void)

When wheel mouse is called. If return false then wheelMouse will not be processed

Type declaration

    • (event): boolean | void
    • Parameters

      • event: WheelEvent

      Returns boolean | void

overlays?: ((view) => ReactNode)[]

Render elements for the view. This will be called whenever the viewport changes

Type declaration

overlaysProps?: HTMLAttributes<HTMLDivElement>

Props called to overlays

ref?: Ref<HTMLDivElement>
rowCount: number

Number of rows in the grid

scrollPoint?: Partial<TopLeft>

The location of the top left scroll corner

showGridLines?: boolean | DirectionOptions

Show grid lines. Useful for spreadsheets NOTE - should we just allow gridline renderers to be null?

stageProps?: HTMLAttributes<HTMLDivElement>

Props that can be injected to stage

stageWrapper?: ((children) => ReactNode)

Allows users to Wrap stage children in Top level Context

Type declaration

    • (children): ReactNode
    • Parameters

      • children: ReactNode

      Returns ReactNode

width?: number

Width of the grid container

zoom?: number

Zoom. 1 means no zoom

Default Value

1 or none.