### Initialize the development environment Source: https://github.com/alaarab/ogrid/blob/main/CONTRIBUTING.md Clone the repository and install dependencies using Bun. Running the build command is required before starting documentation or development work. ```bash # Prerequisites: Bun >= 1.3 (https://bun.com/docs/installation), Node >= 18 git clone https://github.com/alaarab/ogrid.git cd ogrid bun install bun run build # build all packages once (required before docs/dev work) ``` -------------------------------- ### Install Browser Bundle Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/features/xlsx-import.mdx Install the browser-ready package via npm. ```bash npm i @alaarab/ogrid-react-xlsx-browser ``` -------------------------------- ### Install @alaarab/ogrid-react Source: https://github.com/alaarab/ogrid/blob/main/packages/react/README.md Install the package using npm. ```bash npm install @alaarab/ogrid-react ``` -------------------------------- ### Quick Example: Implementing Column Chooser in React Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/features/column-chooser.mdx Basic setup for OGrid with column definitions including required and default visibility settings. ```tsx import { OGrid } from '@alaarab/ogrid-react-radix'; import type { IColumnDef } from '@alaarab/ogrid-react-radix'; interface Person { id: number; name: string; email: string; age: number; department: string; salary: number; startDate: string; } const columns: IColumnDef[] = [ { columnId: 'name', name: 'Name', required: true }, { columnId: 'email', name: 'Email' }, { columnId: 'age', name: 'Age', type: 'numeric', defaultVisible: false }, { columnId: 'department', name: 'Department' }, { columnId: 'salary', name: 'Salary', type: 'numeric', valueFormatter: (v) => `$${Number(v).toLocaleString()}`, }, { columnId: 'startDate', name: 'Start Date', defaultVisible: false }, ]; function App() { return ( p.id} defaultPageSize={10} /> ); } ``` -------------------------------- ### Install @alaarab/ogrid-react-fluent Source: https://github.com/alaarab/ogrid/blob/main/packages/react-fluent/README.md Use npm to install the package in your project. ```bash npm install @alaarab/ogrid-react-fluent ``` -------------------------------- ### Verify installation with a minimal grid Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/getting-started/installation.mdx Render a basic grid to confirm the installation is working correctly. ```tsx import { OGrid, type IColumnDef } from '@alaarab/ogrid-react-radix'; type Row = { id: number; name: string }; const columns: IColumnDef[] = [{ columnId: 'name', name: 'Name' }]; function App() { return columns={columns} data={[{ id: 1, name: 'Test' }]} getRowId={(row) => row.id} />; } ``` -------------------------------- ### Install React Premium Inputs Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/features/premium-inputs.mdx Command to install the premium inputs package for React-based OGrid implementations. ```bash npm install @alaarab/ogrid-react-inputs ``` -------------------------------- ### Install OGrid UI Packages Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/getting-started/quick-start.mdx Install the required package based on the chosen React UI library. ```bash npm install @alaarab/ogrid-react-radix ``` ```bash npm install @alaarab/ogrid-react-fluent @fluentui/react-components ``` -------------------------------- ### Install ogrid-react-radix Source: https://github.com/alaarab/ogrid/blob/main/README.md Install the Radix UI adapter for the ogrid React component. ```bash npm install @alaarab/ogrid-react-radix ``` -------------------------------- ### Build and run OGrid examples Source: https://github.com/alaarab/ogrid/blob/main/packages/examples/README.md Commands to build the monorepo packages and launch the development servers for specific UI implementations. ```bash # From the monorepo root - build packages first npm run build # Then start any example dev server npm run dev:react-radix npm run dev:react-fluent ``` -------------------------------- ### Complete Column Definition Example Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/api/column-def.mdx A comprehensive example demonstrating column grouping, custom editors, value formatters, and cell styling. ```typescript import { IColumnDef, IColumnGroupDef } from '@alaarab/ogrid-react-radix'; interface Employee { id: number; name: string; department: string; salary: number; startDate: string; manager: { displayName: string; email: string }; } const columns: (IColumnDef | IColumnGroupDef)[] = [ { columnId: 'name', name: 'Employee Name', sortable: true, required: true, pinned: 'left', minWidth: 150, filterable: { type: 'text' }, editable: true, cellEditor: 'text', }, { headerName: 'Details', children: [ { columnId: 'department', name: 'Department', filterable: { type: 'multiSelect', optionsSource: 'static', options: ['Engineering', 'Marketing', 'Sales', 'HR'], }, editable: true, cellEditor: 'richSelect', cellEditorParams: { values: ['Engineering', 'Marketing', 'Sales', 'HR'] }, }, { columnId: 'salary', name: 'Salary', type: 'numeric', valueFormatter: (value) => `$${Number(value).toLocaleString()}`, valueParser: ({ newValue }) => Number(String(newValue).replace(/[$,]/g, '')), editable: true, cellStyle: (item) => ({ color: item.salary > 100000 ? 'green' : undefined, }), }, ], }, { columnId: 'startDate', name: 'Start Date', defaultVisible: false, valueFormatter: (value) => new Date(value as string).toLocaleDateString(), }, { columnId: 'manager', name: 'Manager', filterable: { type: 'people' }, valueGetter: (item) => item.manager, renderCell: (item) => {item.manager.displayName}, valueFormatter: (value) => (value as Employee['manager']).displayName, editable: false, }, ]; ``` -------------------------------- ### Install XLSX package Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/features/xlsx-import.mdx Install the required package for React applications using a bundler. ```bash npm i @alaarab/ogrid-react-xlsx ``` -------------------------------- ### Full React Implementation with Worker Sorting Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/features/performance.mdx A complete example showing the OGrid component setup with worker sorting enabled. ```tsx import { OGrid } from '@alaarab/ogrid-react-radix'; import type { IColumnDef } from '@alaarab/ogrid-react-radix'; interface Row { id: number; name: string; revenue: number; region: string; } const columns: IColumnDef[] = [ { columnId: 'id', name: 'ID', type: 'numeric' }, { columnId: 'name', name: 'Name', sortable: true }, { columnId: 'revenue', name: 'Revenue', type: 'numeric', sortable: true }, { columnId: 'region', name: 'Region', sortable: true }, ]; function App() { return ( r.id} workerSort={true} statusBar /> ); } ``` -------------------------------- ### MCP Tool Usage Examples Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/guides/mcp.mdx Examples of how the editor automatically invokes MCP tools to retrieve documentation and project information. ```text search_docs query="server-side data" framework="react" ``` ```text list_docs category="features" ``` ```text get_docs path="features/filtering" ``` ```text get_code_example path="features/editing" framework="react" ``` ```text detect_version path="/path/to/project" ``` -------------------------------- ### Install @alaarab/ogrid-core Source: https://github.com/alaarab/ogrid/blob/main/packages/core/README.md Use npm to add the core package to your project dependencies. ```bash npm install @alaarab/ogrid-core ``` -------------------------------- ### Install OGrid dependencies Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/guides/migration-from-ag-grid.mdx Commands to remove AG Grid packages and install the preferred OGrid UI implementation. ```bash # Remove AG Grid npm uninstall ag-grid-react ag-grid-community ag-grid-enterprise # Install OGrid (pick your UI implementation) npm install @alaarab/ogrid-react-radix # Radix (lightweight, no framework dep) npm install @alaarab/ogrid-react-fluent # Fluent UI v9 ``` -------------------------------- ### Example MCP Queries Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/guides/mcp.mdx Sample natural language queries to use within your editor once the MCP server is connected. ```text How do I set up server-side pagination? How do I pin columns? What's the difference between multiSelect and text filters? Show me how to use the formula engine. Help me migrate from AG Grid to OGrid. ``` -------------------------------- ### Basic DataGridTable Implementation Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/api/components-datagrid-table.mdx A minimal example showing how to define columns and data to render a basic table. ```tsx import { DataGridTable } from '@alaarab/ogrid-react-radix'; import type { IColumnDef } from '@alaarab/ogrid-react-radix'; interface Product { id: number; name: string; price: number; } const columns: IColumnDef[] = [ { columnId: 'name', name: 'Product Name', type: 'text' }, { columnId: 'price', name: 'Price', type: 'numeric' }, ]; const data: Product[] = [ { id: 1, name: 'Widget', price: 29.99 }, { id: 2, name: 'Gadget', price: 49.99 }, ]; function MyGrid() { return ( item.id} aria-label="Product catalog" /> ); } ``` -------------------------------- ### Formula Syntax Examples Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/features/formulas.mdx Common formula patterns supported by the OGrid engine. ```text =A1+B1 → adds two cells =SUM(A1:A5) → sum of a range =IF(B2>1000,"High","Low") → conditional logic =VLOOKUP(A1,C1:D10,2) → lookup ``` -------------------------------- ### Example testing session with bridge Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/guides/mcp-live-testing.mdx A demonstration of how an editor interacts with the grid state and sends update commands during a live debugging session. ```text Me: The salary column seems wrong. Can you check? Editor: Let me look at the current grid state. [calls get_grid_state gridId="employees" includeData=true maxRows=10] The grid shows salary values like "120" instead of "120000". It looks like the values are being divided by 1000 somewhere. Let me update a cell to verify: [calls send_grid_command type="update_cell" payload={rowIndex:0, columnId:"salary", value:120000}] ✅ Done. Now let me re-read to confirm: [calls get_grid_state] The update worked. Row 0 now shows 120000. The issue is in your valueGetter - it's dividing by 1000. Here's the fix: ... ``` -------------------------------- ### Start MCP Server with Live Bridge Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/guides/mcp.mdx Commands to launch the MCP server with the live testing bridge enabled, optionally specifying a custom port. ```bash npx @alaarab/ogrid-mcp --bridge # Custom port if needed OGRID_BRIDGE_PORT=7890 npx @alaarab/ogrid-mcp ``` -------------------------------- ### Run MCP Server via CLI Source: https://github.com/alaarab/ogrid/blob/main/packages/mcp/README.md Commands to start the documentation server or the live testing bridge directly from the terminal. ```bash npx @alaarab/ogrid-mcp # docs server (stdio) npx @alaarab/ogrid-mcp --bridge # docs server + live testing bridge on port 7890 npx @alaarab/ogrid-mcp --version # print version ``` -------------------------------- ### Configure OGrid MCP Server Source: https://github.com/alaarab/ogrid/blob/main/README.md Setup instructions for integrating the OGrid MCP server into an editor, either via one-time execution or persistent configuration. ```bash # One-time setup (any MCP-compatible editor) npx -y @alaarab/ogrid-mcp # Or add to your editor's MCP config { "mcpServers": { "ogrid": { "command": "npx", "args": ["-y", "@alaarab/ogrid-mcp"] } } } ``` -------------------------------- ### Implement Virtualized Grid Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/features/virtual-scrolling.mdx A complete example showing column definition and OGrid component usage with virtual scrolling enabled. ```tsx import { OGrid } from '@alaarab/ogrid-react-radix'; import type { IColumnDef } from '@alaarab/ogrid-react-radix'; interface Row { id: number; [key: string]: number | string; } // Generate 50 columns const columns: IColumnDef[] = [ { columnId: 'id', name: 'ID', type: 'numeric', pinned: 'left', defaultWidth: 80 }, ...Array.from({ length: 49 }, (_, i) => ({ columnId: `col${i}`, name: `Column ${i + 1}`, type: 'numeric' as const, })), ]; function App() { return ( r.id} virtualScroll={{ enabled: true, rowHeight: 36, columns: true, columnOverscan: 2 }} /> ); } ``` -------------------------------- ### Implement column grouping Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/api/column-def.mdx Example configuration showing nested column groups and individual columns. ```typescript const columns = [ { columnId: 'name', name: 'Name' }, { headerName: 'Contact Info', children: [ { columnId: 'email', name: 'Email' }, { columnId: 'phone', name: 'Phone' }, ], }, { headerName: 'Address', children: [ { columnId: 'city', name: 'City' }, { columnId: 'state', name: 'State' }, { columnId: 'zip', name: 'ZIP' }, ], }, ]; ``` -------------------------------- ### Basic ColumnChooser Implementation Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/api/components-column-chooser.mdx Demonstrates the basic setup of the ColumnChooser component with a list of columns and state management for visibility. ```tsx import { ColumnChooser } from '@alaarab/ogrid-react-radix'; import type { IColumnDefinition } from '@alaarab/ogrid-react-radix'; function MyApp() { const columns: IColumnDefinition[] = [ { columnId: 'id', name: 'ID', required: true }, { columnId: 'name', name: 'Product Name' }, { columnId: 'price', name: 'Price' }, { columnId: 'category', name: 'Category' }, ]; const [visibleColumns, setVisibleColumns] = useState>( new Set(['id', 'name', 'price']) ); const handleVisibilityChange = (columnKey: string, visible: boolean) => { const newSet = new Set(visibleColumns); if (visible) { newSet.add(columnKey); } else { newSet.delete(columnKey); } setVisibleColumns(newSet); }; return ( ); } ``` -------------------------------- ### Development and Build Commands Source: https://github.com/alaarab/ogrid/blob/main/README.md Standard commands for managing the OGrid monorepo, including installation, building, testing, and running documentation servers. ```bash git clone https://github.com/alaarab/ogrid.git cd ogrid bun install bun run build # Build all packages (Turborepo) bun run test # Run all tests bun run lint # Biome bun run test:e2e:smoke # Browser merge gate (React Radix) bun run test:e2e:docs # Built docs homepage verification bun run test:e2e:matrix # Full browser matrix across active example apps # GitHub Actions # CI -> fast push/PR checks (lint + browser smoke) # Full Verification -> manual full build/test matrix before release or larger merges # Playwright Matrix -> manual browser parity pass across active example apps # Storybook bun run storybook:react-fluent # React Fluent UI (port 6006) bun run storybook:react-radix # React Radix UI (port 6008) # Documentation bun run docs:dev:full # Build workspace packages, then start the Docusaurus dev server bun run docs:dev # Docusaurus dev server only (requires packages already built) bun run docs:build # Build docs site ``` -------------------------------- ### Status Bar Output Examples Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/features/status-bar.mdx Visual representations of the status bar output based on grid state. ```text Rows: 150 ``` ```text Rows: 150 | Filtered: 42 ``` ```text Rows: 150 | Selected: 5 ``` ```text Rows: 150 | Cells: 12 | Sum: 4800 | Avg: 400 | Min: 150 | Max: 900 | Count: 12 ``` ```text Rows: 1000 | Filtered: 250 | Selected: 3 | Cells: 8 | Sum: 12500 | Avg: 1562.50 | Min: 800 | Max: 3200 | Count: 8 ``` -------------------------------- ### Configure Sidebar Panels Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/api/components-sidebar.mdx Examples of configuring the OGrid sidebar to display only specific panels. ```tsx import { OGrid } from '@alaarab/ogrid-react-radix'; ``` ```tsx import { OGrid } from '@alaarab/ogrid-react-radix'; ``` -------------------------------- ### Query OGrid Documentation via MCP Source: https://github.com/alaarab/ogrid/blob/main/README.md Example natural language queries for interacting with the OGrid documentation through an MCP-enabled editor. ```text > Which filtering modes does OGrid support? > Show me a server-side data source example > How do I pin columns? ``` -------------------------------- ### Check MCP Server Version Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/guides/mcp.mdx Verify the installed version of the OGrid MCP server. ```bash npx @alaarab/ogrid-mcp --version ``` -------------------------------- ### Run the full Playwright matrix Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/guides/browser-support-matrix.mdx Executes the broader browser suite against all example apps via manual workflow dispatch. ```bash npm run test:e2e:matrix ``` -------------------------------- ### Launch OGrid Live Testing Bridge Source: https://github.com/alaarab/ogrid/blob/main/README.md Starts the MCP server with the bridge flag to enable real-time interaction with a running OGrid instance. ```bash npx @alaarab/ogrid-mcp --bridge ``` -------------------------------- ### Start the MCP server with bridge enabled Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/guides/mcp-live-testing.mdx Commands to launch the MCP server with the bridge functionality enabled using either a flag or an environment variable. ```bash # Option A: use --bridge flag (port 7890) npx @alaarab/ogrid-mcp --bridge # Option B: use env var (custom port) OGRID_BRIDGE_PORT=7890 npx @alaarab/ogrid-mcp # Claude Desktop / claude mcp add claude mcp add ogrid -- npx -y @alaarab/ogrid-mcp --bridge ``` -------------------------------- ### Install Fluent UI React package Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/getting-started/installation.mdx Requires Fluent UI v9 as a peer dependency; suitable for Microsoft 365 or SPFx integrations. ```bash npm install @alaarab/ogrid-react-fluent @fluentui/react-components ``` -------------------------------- ### Configure OGrid Side Bar Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/api/types.mdx Examples showing how to enable the default side bar or provide a custom configuration object to the OGrid component. ```typescript // Default side bar // Custom side bar on the left, showing only column chooser ``` -------------------------------- ### Minimal OGrid Implementation Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/api/ogrid-props.mdx Basic setup for the OGrid component requiring columns, data, and a unique row identifier. ```typescript import { OGrid } from '@alaarab/ogrid-react-radix'; interface Person { id: number; name: string; age: number; } const columns = [ { columnId: 'name', name: 'Name' }, { columnId: 'age', name: 'Age', type: 'numeric' as const }, ]; const data: Person[] = [ { id: 1, name: 'Alice', age: 30 }, { id: 2, name: 'Bob', age: 25 }, ]; function App() { return ( columns={columns} data={data} getRowId={(row) => row.id} /> ); } ``` -------------------------------- ### Run verification suite Source: https://github.com/alaarab/ogrid/blob/main/RELEASING.md Execute the full build, test, and linting suite from the repository root before publishing. ```bash bun run build bun run test bun run lint bun run test:e2e:smoke bun run test:e2e:docs ``` -------------------------------- ### Run the full verification suite Source: https://github.com/alaarab/ogrid/blob/main/CONTRIBUTING.md Execute the complete build, test, lint, and smoke test pipeline before submitting a pull request. ```bash bun run build && bun run test && bun run lint && bun run test:e2e:smoke ``` -------------------------------- ### Mounting in HTML Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/features/xlsx-import.mdx Load the bundle and mount the grid into a DOM element using the module import. ```html
``` -------------------------------- ### Initialize Headless Grid Hooks Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/api/headless-hooks.mdx Demonstrates the initialization of all available headless hooks for a grid implementation. ```tsx const grid = useHeadlessGrid({ columns, data, getRowId: (r) => r.id }); const range = useRangeSelection({ rowCount: grid.rows.length, colCount: grid.columns.length }); const undo = useUndoRedo({ onCellValueChanged: applyEditToRows }); const edit = useInlineEdit({ columns, getRowId, onCellEdit: undo.onCellValueChanged }); const fill = useFillHandle({ rangeSelection: range, rows: grid.rows, columns, onFillCells }); const clipboard = useCellClipboard({ rangeSelection: range, rows: grid.rows, columns, onCellEdit }); const focus = useGridFocus({ rowCount: grid.rows.length, colCount: grid.columns.length, rangeSelection: range }); ``` -------------------------------- ### Create a Popup Editor Component Source: https://github.com/alaarab/ogrid/blob/main/packages/docs/docs/guides/custom-cell-editors.mdx Example of a custom textarea editor component designed to render in a popup overlay. ```tsx import type { ICellEditorProps } from '@alaarab/ogrid-react-radix'; interface NoteItem { id: string; title: string; notes: string; } function NotesEditor({ value, onValueChange, onCommit, onCancel }: ICellEditorProps) { return (