Skip to content

React Integration

The @sci-grid/react package provides a first-class React component wrapper around the core SciGrid library.

Installation

bash
pnpm add @sci-grid/react @sci-grid/core

Usage

Use the SciGridReact component in your application.

tsx
import { SciGridReact } from '@sci-grid/react';
import { useMemo } from 'react';

const MyGrid = () => {
  const provider = useMemo(() => ({
    getRowCount: () => 1000,
    getColumnCount: () => 20,
    getCellData: (r, c) => `Value ${r},${c}`,
    getHeader: (c) => ({ name: `Col ${c}` })
  }), []);

  return (
    <div style={{ height: '500px', width: '100%' }}>
      <SciGridReact 
        provider={provider}
        config={{
            rowHeight: 30,
            showRowNumbers: true
        }}
      />
    </div>
  );
};

Props

PropTypeDescription
providerIDataGridProviderThe data provider for the grid.
configPartial<GridConfig>Optional configuration overrides.
classNamestringAdditional CSS classes for the container.
styleCSSPropertiesInline styles for the container.

Integrated under the Sci DNA / VeloSci Ecosystem