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
import { createContext, useRef } from "react";
import { Kanban } from "@svar-ui/react-kanban";
import AddCardButton from "./AddCardButton.jsx";
export const ApiContext = createContext(null);
function App() {
const apiRef = useRef(null);
return (
<ApiContext.Provider value={apiRef}>
<Kanban
ref={apiRef}
cards={cards}
columns={columns}
cardListEnd={AddCardButton}
/>
</ApiContext.Provider>
);
}
export default App;
The slot component:
// AddCardButton.jsx
import { useContext } from "react";
import { ApiContext } from "./App.jsx";
function AddCardButton({ column, readonly }) {
const apiRef = useContext(ApiContext);
const add = () => {
apiRef.current?.exec("add-card", {
card: { label: "New task", column: column.id },
});
};
return (
<button disabled={readonly} onClick={add}>
+ Add card
</button>
);
}
export default AddCardButton;