cardContent
Replaces the built-in card template with a custom Vue 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:
| Field | Type | Description |
|---|---|---|
card | KanbanCard | The source card data object |
cardShape | CardShape | The current section visibility map from card |
Example
<script setup>
import { Kanban } from "@svar-ui/vue-kanban";
import MyCard from "./MyCard.vue";
</script>
<template>
<Kanban :cards="cards" :columns="columns" :cardContent="MyCard" />
</template>
<!-- MyCard.vue -->
<script setup>
const props = defineProps({
card: { type: Object },
cardShape: { type: Object },
});
</script>
<template>
<div class="my-card">
<strong>{{ props.card.label }}</strong>
<span v-if="props.card.owner">{{ props.card.owner }}</span>
</div>
</template>
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.vue -->
<script setup>
import { CardMenuButton } from "@svar-ui/vue-kanban";
const props = defineProps({
card: { type: Object },
cardShape: { type: Object },
});
</script>
<template>
<div class="my-card">
<strong>{{ props.card.label }}</strong>
<CardMenuButton v-if="props.cardShape.menu" :card="props.card" />
</div>
</template>
Related
- Cards guide - card data shape and custom card body
- card - CardShape controlling section visibility
- cardCss - per-card CSS classes
- Card Menu -
CardActionMenuthat theCardMenuButtonopens