AdaptTable for Chakra

AI table assistant in Chakra

@adapttable/ai is optional and provider-neutral. This Chakra demo combines a conversational assistant with a real table. Try filtering, grouping, column pinning and a proposed edit; available actions depend on the mounted features and the host's permissions. Row pinning requires an ungrouped view in this demo.

Start in Simulated mode: suggested prompts run deterministic local scenarios, not a language model. The conversation shows action receipts; a proposed write still follows approval and save policy. Connect backend sends your prompt and permitted table context to an endpoint you run. The assistant keeps the same table session and Chakra controls in both modes.

Three integration levels share that session: a custom bridge that maps any agent format onto session.execute, an AgentEnvelope on your transport, and optional JSON, OpenAI, MCP or HTTP helpers from your own runtime. Execution never requires another model call.

Chakra supplies the assistant's controls as well as filters and approval. Use the ready panel or render the same headless conversation state in your own UI.

The code

import { useTableAssistant } from "@adapttable/ai-react";
import { assistantHttpTransport } from "@adapttable/ai/http";
import { tableAgent } from "@adapttable/ai-react";
import { DataTable, agentApproval } from "@adapttable/chakra";
import { TableAssistant } from "@adapttable/chakra/assistant";
import { editing } from "@adapttable/chakra/editing";
import { filters } from "@adapttable/chakra/filters";
import { useMemo, useState } from "react";

const suggestions = [
  {
    id: "core-team",
    title: "Show only the Core team",
    prompt: "Show only the Core team.",
    requires: ["view.setFilters"],
  },
];

export function Orders({ rows, columns, onEdit }) {
  const [session, setSession] = useState();
  const transport = useMemo(
    () => assistantHttpTransport({ endpoint: "/api/table-agent" }),
    []
  );
  const assistant = useTableAssistant({ session, transport, suggestions });

  return (
    <>
      <DataTable
        data={rows}
        columns={columns}
        rowKey={(row) => row.id}
        features={[
          filters([{ key: "team", type: "multiSelect", getValue: (row) => row.team }]),
          agentApproval(),
          editing(onEdit),
          tableAgent({
            tableId: "orders",
            writePolicy: "allow",
            approval: "writes",
            commit: "stage",
            columns: { salary: { type: "number", writable: true } },
            bridge: { attach: setSession },
          }),
        ]}
      />
      <TableAssistant
        assistant={assistant}
        open={assistant.open}
        onOpenChange={assistant.setOpen}
      />
    </>
  );
}

Install

pnpm add @adapttable/chakra @adapttable/core @chakra-ui/react @emotion/react

The same feature in the other kits

More Chakra features

Reference: ai-http, ai-integrations, ai, agent-capabilities. More of this kit: AdaptTable for Chakra, or the live demo.