CardMenuButton
Renders the card ⋯ menu button inside a custom cardContent template. A custom template replaces the built-in button, so use this component to keep the card menu. An outer CardActionMenu opens the menu when the user clicks the button.
Usage
import { CardMenuButton } from "@svar-ui/vue-kanban";
<CardMenuButton :card="card" />
Props
| Prop | Type | Default | Description |
|---|---|---|---|
card | KanbanCard | - | Required. The card that the menu opens for |
css | string | "" | Extra class names for the button |
Details
The component renders the same button as the built-in card: the wx-menu class, the theme styling, and the localized "Card menu" label. It sets data-card-menu, so CardActionMenu finds the card. It also sets data-action="menu", so a click on the button doesn't select the card. Don't build these attributes by hand.
The button always renders. The template controls when it appears, for example with v-if="cardShape.menu". Without an outer CardActionMenu, the button does nothing.
Example
Custom card template with a menu button:
<!-- 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>{{ card.label }}</strong>
<CardMenuButton v-if="cardShape.menu" :card="card" css="my-card-menu" />
</div>
</template>
Board with the template and the action menu:
<script setup>
import { ref } from "vue";
import { Kanban, CardActionMenu } from "@svar-ui/vue-kanban";
import MyCard from "./MyCard.vue";
const api = ref(null);
</script>
<template>
<CardActionMenu :api="api">
<Kanban
ref="api"
:cards="cards"
:columns="columns"
:card="{ menu: true }"
:cardContent="MyCard"
/>
</CardActionMenu>
</template>
Related
- cardContent - custom card template
- CardActionMenu - menu that opens from this button
- getMenuOptions - default card menu items