BC Grid

Public API Surface

The consumer-facing packages and contracts BusinessCraft screens should import from BC Grid.

BC Grid has a stable public surface so BusinessCraft screens can use it without depending on implementation details. The enforced export list lives in packages/bc-grid/tools/api-surface/src/manifest.ts; this page is the working map for app developers and agents.

Primary Imports#

Most BusinessCraft screens should start with these imports:

screen imports
import {
  BcGrid,
  BcEditGrid,
  BcServerGrid,
  type BcGridColumn,
} from "@bc-grid/react";
import { textEditor, numberEditor } from "@bc-grid/editors";
import "@bc-grid/theming/styles.css";

Use @bc-grid/react as the main consumer surface. It re-exports the grid components, the React-aware column type, grid state types, server row model types, saved view helpers, and aggregation hooks that screens normally need.

Component Choice#

Choose the smallest component that matches the screen:

  • BcGrid for read-only, client-side data.
  • BcEditGrid when the user edits cells in place.
  • BcServerGrid when rows come from a server query and the grid owns paging, infinite blocks, lazy tree children, or streaming updates.

The component choice is part of the screen contract. Do not wrap a server-backed list in BcGrid and recreate block caching in the screen.

Column Contract#

Columns are typed against the row shape:

typed columns
type AccountRow = {
  account: string;
  description: string;
  balance: number;
};

const columns: BcGridColumn<AccountRow>[] = [
  { field: "account", header: "Account", pinned: "left", format: "code" },
  { field: "description", header: "Description", filter: { type: "text" } },
  { field: "balance", header: "Balance", align: "right", format: "currency" },
];

Prefer built-in column features before custom renderers. format, filter, aggregation, pinned, sortable, and resizable keep the screen simple and preserve consistent grid behavior.

Public Packages#

  • @bc-grid/core owns framework-agnostic types, range helpers, server query types, and pivot DTOs.
  • @bc-grid/react owns components, React column extensions, hooks, saved views, filters UI contracts, and server grid APIs.
  • @bc-grid/editors owns built-in editor factories.
  • @bc-grid/theming owns density classes, CSS variables, and styles.css.
  • @bc-grid/aggregations, @bc-grid/filters, @bc-grid/export, and @bc-grid/server-row-model expose engine-level helpers for advanced integrations.

What Not To Import#

Do not import from package internals:

tsx
// Do not do this in app code.
import { something } from "@bc-grid/react/src/internal/something";

If a BusinessCraft screen needs an internal helper, promote it through the public manifest with review. That keeps future refactors tractable and protects every screen that depends on BC Grid.

API Review Trigger#

Adding, removing, or renaming an export is an API-surface change. It should come with:

  • an update to the manifest,
  • docs or demo coverage,
  • a migration note if existing screen code changes,
  • review from the BC Grid owner or coordinator.