Skip to main content

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):

FieldTypeDescription
columnColumnViewThe column that owns the card area
swimlaneSwimlaneViewThe swimlane for a swimlane cell or a stack group; absent on an ordinary column
cardsKanbanCard[]All filtered and sorted cards in the area, including cards outside the virtual range
readonlybooleanThe 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.virtualizeColumns hides 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>
  • Columns - card list slots in context
  • Themes - styling .wx-card-list-start and .wx-card-list-end