add-column
Inserts a new column into the board configuration, optionally before an existing column. The action leaves cards and per-column load state (columnData) unchanged and resets the undo/redo history.
Usage
type AddColumnPayload = {
column: Partial<ColumnConfig>;
id?: ColumnID;
before?: ColumnID | null;
};
| Field | Type | Description |
|---|---|---|
column | Partial<ColumnConfig> | Configuration of the new column |
id | ColumnID | Optional. ID of the new column; takes precedence over column.id |
before | ColumnID | null | Optional. Column to insert before; null, omitted, or an unknown ID appends to the end |
- The ID resolves in this order: payload
id, thencolumn.id, then a generated temporary ID (tempID()). labeldefaults toString(id)when not set.- If a column with the same ID already exists, the action does nothing. Numeric and string IDs are distinct (
1and"1"are different columns). - After the action runs, the payload holds the resolved
id, andcolumnholds the full inserted config.
Trigger
api.exec("add-column", {
column: { label: "Review" },
before: "done",
});
Observe
api.on("add-column", ({ id, column }) => {
console.log("column added:", id, column.label);
});
Intercept
api.intercept("add-column", ({ column }) => {
return !!column.label;
});
Returning false cancels the insert.
Component handler
<Kanban {cards} {columns} onaddcolumn={({ id }) => console.log("added", id)} />
Related
- Columns guide - column setup, layout, and runtime updates
- columns - column definitions in board order
- update-column - patch an existing column
- RestDataProvider - sends new columns to
POST /columns