Skip to main content

addCard()

Description

Inserts a new card into the Kanban board

Usage

addCard({
columnId: string | number,
id?: string | number,
rowId?: string | number,
before?: string | number,
select?: boolean,
card?: object
}): void;

Parameters

  • columnId - (required) the ID of the column where the card will be added
  • id - (optional) the ID to assign to the new card
  • rowId - (optional) the ID of the row where the card should be placed
  • before - (optional) the ID of an existing card that the new card will be inserted before
  • select - (optional) whether the newly added card should be selected
  • card - (optional) the data object defining the new card
info

You can find the complete list of card parameters here

Example

// create Kanban
const board = new kanban.Kanban("#root", {
columns,
cards
});
// add new card into the "backlog" column
board.addCard({
id: 1,
columnId: "backlog",
card: { label: "New card" }
});
tip

The ID of the new card can also be specified inside the card object