duplicate-card
Clones an existing card. The clone gets a new temporary id and is inserted immediately after the source card. Fields in the optional card object override the clone's values. With edit: true, the editor opens on the new card.
Usage
{
id: CardID;
card?: Partial<KanbanCard>;
edit?: boolean;
}
| Field | Type | Description |
|---|---|---|
id | CardID | Id of the card to clone |
card | Partial<KanbanCard> | Fields to override on the clone (optional) |
edit | boolean | Open the editor on the cloned card when true |
Trigger
api.exec("duplicate-card", { id: 42 });
With overrides:
api.exec("duplicate-card", {
id: 42,
card: { label: "Copy of Task" },
edit: true,
});
Observe
api.on("duplicate-card", ev => {
console.log("duplicated card", ev.id);
});
Intercept
api.intercept("duplicate-card", ev => {
// prevent duplicating locked cards
return !isLocked(ev.id);
});
Component handler
<Kanban onDuplicateCard={ev => console.log("duplicated", ev.id)} />
Related
- Cards guide - card actions overview
- add-card - create a card from scratch
- delete-card - remove a card