# adazzle/react-data-grid architecture

> Architecture diagram of the GitHub repository adazzle/react-data-grid, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adazzle/react-data-grid
- Repository: https://github.com/adazzle/react-data-grid

## Overview

##### Project type and purpose
- This is a React component library (“react‑data‑grid”) providing a high‑performance, feature‑rich data grid for React applications.
- It also ships a documentation/demo website under `website/` showcasing usage examples and live playgrounds.

##### File structure
- Top‑level configuration & metadata: `.github/`, `package.json`, `tsconfig.*`, `babel.config.json`, `rolldown.config.js`, `vite.config.ts`, `api-extractor.json`, CI workflows.
- Core source code (`src/`):
- React components (`*.tsx`): DataGrid, TreeDataGrid, Cell, Row, Header, Summary, DragHandle, etc.
- Subdirectories for custom cell renderers (`src/cellRenderers/`), editors (`src/editors/`), hooks (`src/hooks/`), styles (`src/style/`), types (`src/types.ts`), utilities (`src/utils/`).
- Entry point: `src/index.ts` exports public API.
- Test suites (`test/`):
- Browser tests (`test/browser/…`) covering rendering, events, virtualization.
- Node/SSR tests (`test/node/`).
- Documentation/demo site (`website/`):
- React app with routes for each feature example (`website/routes/`), navigation (`Nav.tsx`), custom renderers, styling, context.
- Build & packaging tools:
- Rollup/Vite configs to produce ESM bundles for both library and website.
- API extractor for generating type docs.
- Linting, formatting, and CI (GitHub Actions, codecov).

##### Insights from README
- Library supports virtualization, theming (light/dark), frozen columns, sorting, grouping, editing, copy/paste, RTL, SSR.
- Exposes two main components: `<DataGrid />` and `<TreeDataGrid />`, plus a set of hooks and utilities.
- Documentation site as a separate but integrated consumer.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Library Modules
    subgraph "Core Library Modules"
        direction TB
        subgraph "Components"
            direction TB
            DataGridCore["Entry: src/index.ts"]:::core
            DataGrid["DataGrid"]:::core
            TreeDataGrid["TreeDataGrid"]:::core
            Row["Row"]:::core
            Cell["Cell"]:::core
            HeaderRow["HeaderRow"]:::core
            HeaderCell["HeaderCell"]:::core
            SummaryRow["SummaryRow"]:::core
            SummaryCell["SummaryCell"]:::core
            GroupRow["GroupRow"]:::core
            GroupCell["GroupCell"]:::core
            GroupedColumnHeaderRow["GroupedColumnHeaderRow"]:::core
            GroupedColumnHeaderCell["GroupedColumnHeaderCell"]:::core
            DragHandle["DragHandle"]:::core
            ScrollToCell["ScrollToCell"]:::core
            EditCell["EditCell"]:::core
            Columns["Columns Definition"]:::core
        end
        subgraph "Renderers & Editors"
            direction TB
            DefaultRenderers["Default Renderers Context"]:::core
            CellRenderers["Cell Renderers Directory"]:::core
            TextEditor["Text Editor"]:::core
        end
        subgraph "Hooks"
            direction TB
            HooksIndex["Hooks Index"]:::core
            useViewportRows["useViewportRows"]:::core
            useViewportColumns["useViewportColumns"]:::core
            useCalculatedColumns["useCalculatedColumns"]:::core
            useColumnWidths["useColumnWidths"]:::core
            useGridDimensions["useGridDimensions"]:::core
            useLatestFunc["useLatestFunc"]:::core
            useRovingTabIndex["useRovingTabIndex"]:::core
            useRowSelection["useRowSelection"]:::core
        end
        subgraph "Utilities & Styles"
            direction TB
            Utils["Utilities Directory"]:::core
            Styles["Styles Directory"]:::core
        end
    end

    %% Build & CI
    subgraph "Build & CI Pipeline"
        direction TB
        BundlerConfig["Rollup/Vite Config"]:::build
        APIExtractor["API Extractor Config"]:::build
        CIWorkflow["CI Workflow"]:::build
        Dependabot["Dependabot Config"]:::service
    end

    %% Tests
    subgraph "Test Suites"
        direction TB
        BrowserTests["Browser Tests Suite"]:::test
        NodeTests["Node/SSR Tests Suite"]:::test
        Codecov["Codecov"]:::service
    end

    %% Consumers
    subgraph "Consumers"
        direction TB
        DocsSite["Documentation Site"]:::consumer
        ExternalApp["External React Apps"]:::consumer
    end

    %% Registry
    NpmRegistry["npm Registry"]:::service

    %% External Services
    subgraph "External Services"
        direction TB
        GitHub["GitHub"]:::service
    end

    %% Relationships
    DataGridCore --> BundlerConfig
    BundlerConfig --> NpmRegistry
    DocsSite -->|imports Core Module| DataGridCore
    ExternalApp -->|installs package| NpmRegistry

    CIWorkflow --> BrowserTests
    CIWorkflow --> NodeTests
    BrowserTests --> Codecov
    NodeTests --> Codecov
    CIWorkflow --> NpmRegistry

    CIWorkflow -->|triggered by| GitHub
    Dependabot --> GitHub

    %% Click Events
    click DataGridCore "https://github.com/adazzle/react-data-grid/blob/main/src/index.ts"
    click DataGrid "https://github.com/adazzle/react-data-grid/blob/main/src/DataGrid.tsx"
    click TreeDataGrid "https://github.com/adazzle/react-data-grid/blob/main/src/TreeDataGrid.tsx"
    click Row "https://github.com/adazzle/react-data-grid/blob/main/src/Row.tsx"
    click Cell "https://github.com/adazzle/react-data-grid/blob/main/src/Cell.tsx"
    click HeaderRow "https://github.com/adazzle/react-data-grid/blob/main/src/HeaderRow.tsx"
    click HeaderCell "https://github.com/adazzle/react-data-grid/blob/main/src/HeaderCell.tsx"
    click SummaryRow "https://github.com/adazzle/react-data-grid/blob/main/src/SummaryRow.tsx"
    click SummaryCell "https://github.com/adazzle/react-data-grid/blob/main/src/SummaryCell.tsx"
    click GroupRow "https://github.com/adazzle/react-data-grid/blob/main/src/GroupRow.tsx"
    click GroupCell "https://github.com/adazzle/react-data-grid/blob/main/src/GroupCell.tsx"
    click GroupedColumnHeaderRow "https://github.com/adazzle/react-data-grid/blob/main/src/GroupedColumnHeaderRow.tsx"
    click GroupedColumnHeaderCell "https://github.com/adazzle/react-data-grid/blob/main/src/GroupedColumnHeaderCell.tsx"
    click DragHandle "https://github.com/adazzle/react-data-grid/blob/main/src/DragHandle.tsx"
    click ScrollToCell "https://github.com/adazzle/react-data-grid/blob/main/src/ScrollToCell.tsx"
    click EditCell "https://github.com/adazzle/react-data-grid/blob/main/src/EditCell.tsx"
    click Columns "https://github.com/adazzle/react-data-grid/blob/main/src/Columns.tsx"
    click DefaultRenderers "https://github.com/adazzle/react-data-grid/blob/main/src/DataGridDefaultRenderersContext.ts"
    click CellRenderers "https://github.com/adazzle/react-data-grid/tree/main/src/cellRenderers/"
    click TextEditor "https://github.com/adazzle/react-data-grid/blob/main/src/editors/textEditor.tsx"
    click HooksIndex "https://github.com/adazzle/react-data-grid/blob/main/src/hooks/index.ts"
    click useViewportRows "https://github.com/adazzle/react-data-grid/blob/main/src/hooks/useViewportRows.ts"
    click useViewportColumns "https://github.com/adazzle/react-data-grid/blob/main/src/hooks/useViewportColumns.ts"
    click useCalculatedColumns "https://github.com/adazzle/react-data-grid/blob/main/src/hooks/useCalculatedColumns.ts"
    click useColumnWidths "https://github.com/adazzle/react-data-grid/blob/main/src/hooks/useColumnWidths.ts"
    click useGridDimensions "https://github.com/adazzle/react-data-grid/blob/main/src/hooks/useGridDimensions.ts"
    click useLatestFunc "https://github.com/adazzle/react-data-grid/blob/main/src/hooks/useLatestFunc.ts"
    click useRovingTabIndex "https://github.com/adazzle/react-data-grid/blob/main/src/hooks/useRovingTabIndex.ts"
    click useRowSelection "https://github.com/adazzle/react-data-grid/blob/main/src/hooks/useRowSelection.ts"
    click Utils "https://github.com/adazzle/react-data-grid/tree/main/src/utils/"
    click Styles "https://github.com/adazzle/react-data-grid/tree/main/src/style/"
    click DocsSite "https://github.com/adazzle/react-data-grid/blob/main/website/root.tsx"
    click GitHub "https://github.com/adazzle/react-data-grid/blob/main/.github/workflows/ci.yml"
    click BundlerConfig "https://github.com/adazzle/react-data-grid/blob/main/rollup.config.js"
    click BundlerConfig "https://github.com/adazzle/react-data-grid/blob/main/vite.config.ts"
    click APIExtractor "https://github.com/adazzle/react-data-grid/blob/main/api-extractor.json"
    click CIWorkflow "https://github.com/adazzle/react-data-grid/blob/main/.github/workflows/ci.yml"
    click Dependabot "https://github.com/adazzle/react-data-grid/blob/main/.github/dependabot.yml"
    click BrowserTests "https://github.com/adazzle/react-data-grid/tree/main/test/browser/"
    click NodeTests "https://github.com/adazzle/react-data-grid/tree/main/test/node/"

    %% Styles
    classDef core fill:#bbdefb,stroke:#0d47a1,stroke-width:1px
    classDef build fill:#c8e6c9,stroke:#1b5e20,stroke-width:1px
    classDef consumer fill:#ffe0b2,stroke:#e65100,stroke-width:1px
    classDef test fill:#fff9c4,stroke:#f57f17,stroke-width:1px
    classDef service fill:#cfd8dc,stroke:#455a64,stroke-width:1px
```
