Skip to main content

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;
}
FieldTypeDescription
idCardIDId of the card to clone
cardPartial<KanbanCard>Fields to override on the clone (optional)
editbooleanOpen 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)} />