Skip to main content

cardContent

Replaces the built-in card template with a custom React component. The wrapper element (selection state, drag affordances, data-id, CSS classes) stays intact - only the content inside it changes.

Usage​

cardContent?: Component<{ card: KanbanCard; cardShape: CardShape }>;

The component receives two props:

FieldTypeDescription
cardKanbanCardSource card data object
cardShapeCardShapeCurrent section visibility map from card

Example​

import { Kanban } from "@svar-ui/react-kanban";
import MyCard from "./MyCard.jsx";

<Kanban cards={cards} columns={columns} cardContent={MyCard} />;
// MyCard.jsx
function MyCard({ card, cardShape }) {
return (
<div className="my-card">
<strong>{card.label}</strong>

{card.owner && <span>{card.owner}</span>}
</div>
);
}

export default MyCard;

The drag ghost renders the same component.

The component also replaces the built-in ⋯ card menu button. To keep the button, render CardMenuButton (props: card, optional css) inside the component:

// MyCard.jsx
import { CardMenuButton } from "@svar-ui/react-kanban";

function MyCard({ card, cardShape }) {
return (
<div className="my-card">
<strong>{card.label}</strong>
{cardShape.menu && <CardMenuButton card={card} />}
</div>
);
}

export default MyCard;
  • Cards guide - card data shape and custom card body
  • card - CardShape controlling section visibility
  • cardCss - per-card CSS classes
  • Card Menu - CardActionMenu that the CardMenuButton opens