add-swimlane
The functionality is available in PRO Edition only
PROAdds a new swimlane configuration to the board. Follows the same rules as add-column.
- The ID comes from the payload
id, thenswimlane.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 unknownbeforeanchor appends the lane to the end. - After dispatch, the payload carries the inserted
idand the full inserted config inswimlane.
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 laneid- explicit ID for the new lane (overridesswimlane.id)before- ID of an existing lane to insert the new lane before.nullappends
| Field | Type | Description |
|---|---|---|
id | string | number | Unique lane identifier |
label | string | Display text in the lane header |
collapsed | boolean | Initial collapsed state of the lane |
css | string | CSS class name(s) applied to the lane |
metadata | Record<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)}
/>
Related
- Swimlanes guide - lane config and runtime lane changes
- swimlanes - swimlane definitions
- update-swimlane - patch a swimlane config
- move-swimlane - reorder a swimlane config
- delete-swimlane - remove a swimlane config