Skip to main content

history

The functionality is available in PRO Edition only

PRO

Enables the local history subsystem. When true, mutating actions (add-card, update-card, move-card, duplicate-card, delete-card) push snapshots onto a history stack. The undo / redo actions work only when this flag is on.

Usage​

history?: boolean;

Default: false

Details​

The widget reads the flag once, when it creates the store. Changing history after the first render has no effect.

Successful structural actions reset both the undo and redo stacks: add-column, delete-column, move-column, and their swimlane counterparts (add-swimlane, delete-swimlane, move-swimlane). No-op moves and swimlane renames keep the history. Passing new cards or columns props doesn't reset the stacks. The widget applies changed props as an incremental update, not a full reinitialization.

Example​

Board with history and toolbar undo/redo buttons:

import { useState } from "react";
import { Kanban, Toolbar } from "@svar-ui/react-kanban";

function App() {
const columns = [
{ id: "todo", label: "To Do" },
{ id: "doing", label: "In Progress" },
{ id: "done", label: "Done" },
];
const cards = [];
const [api, setApi] = useState(null);

return (
<>
{api && <Toolbar api={api} undo />}
<Kanban
init={setApi}
cards={cards}
columns={columns}
history={true}
/>
</>
);
}
  • Undo and redo guide - enabling history, toolbar integration, and custom shortcuts
  • undo - revert the last card mutation
  • redo - re-apply the last undone change
  • Toolbar - exposes undo/redo buttons