Skip to main content

add-swimlane

The functionality is available in PRO Edition only

PRO

Adds a new swimlane configuration to the board. Follows the same rules as add-column.

  • The ID comes from the payload id, then swimlane.id, then a generated temporary ID.
  • The label defaults to String(id).
  • A duplicate ID is a no-op. Numeric and string IDs are distinct.
  • A null, omitted, or unknown before anchor appends the lane to the end.
  • After dispatch, the payload carries the inserted id and the full inserted config in swimlane.

A successful add resets the undo/redo history. Cards, column data, and the editor state stay untouched.

Usage​

type AddSwimlanePayload = {
swimlane: Partial<SwimlaneConfig>;
id?: SwimlaneID;
before?: SwimlaneID | null;
};
  • swimlane - partial lane config with the fields to set on the new lane
  • id - explicit ID for the new lane (overrides swimlane.id)
  • before - ID of an existing lane to insert the new lane before. null appends
FieldTypeDescription
idstring | numberUnique lane identifier
labelstringDisplay text in the lane header
collapsedbooleanInitial collapsed state of the lane
cssstringCSS class name(s) applied to the lane
metadataRecord<string, any>Arbitrary data attached to the lane

Trigger​

api.exec("add-swimlane", {
swimlane: { id: "design", label: "Design" },
before: "platform",
});

Observe​

api.on("add-swimlane", ev => {
console.log("Swimlane added with id:", ev.id);
});

Intercept​

api.intercept("add-swimlane", ev => {
if (!ev.swimlane.label) return false; // cancel if no label
});

Component handler​

<Kanban
cards={cards}
columns={columns}
swimlanes={swimlanes}
onAddSwimlane={ev => console.log("added:", ev.id)}
/>