cardListEnd
Custom component rendered after the last card of every expanded card area. Use it for content that belongs at the bottom of a list, such as an "Add card" button or a list footer.
Usage
cardListEnd?: Component<CardListSlotProps>;
The component receives these props (CardListSlotProps is exported from the package):
| Field | Type | Description |
|---|---|---|
column | ColumnView | The column that owns the card area |
swimlane | SwimlaneView | The swimlane for a swimlane cell or a stack group; absent on an ordinary column |
cards | KanbanCard[] | All filtered and sorted cards in the area, including cards outside the virtual range |
readonly | boolean | The current value of the readonly prop |
cardListEnd follows the same rules as cardListStart:
- The component renders once per expanded card area: in each column, swimlane cell, and stack group. Collapsed areas and exports don't include it.
- It scrolls with the cards and stays mounted when
render.virtualizeColumnshides card content. - It isn't a card. It can't be dragged, it isn't counted, and double-clicking it doesn't add a card.
- A card dropped over it goes to the end of the area.
- The widget doesn't wire any actions. The slot component dispatches them and must respect
readonly.
The rendered wrapper has the wx-card-list-end CSS class.
Example
<script>
import { setContext } from "svelte";
import { Kanban } from "@svar-ui/svelte-kanban";
import AddCardButton from "./AddCardButton.svelte";
let api = $state();
setContext("kanban-api", () => api);
</script>
<Kanban bind:this={api} {cards} {columns} cardListEnd={AddCardButton} />
The slot component:
<!-- AddCardButton.svelte -->
<script>
import { getContext } from "svelte";
let { column, readonly } = $props();
const getApi = getContext("kanban-api");
function add() {
getApi()?.exec("add-card", {
card: { label: "New task", column: column.id },
});
}
</script>
<button disabled={readonly} onclick={add}>+ Add card</button>