Vitral 0.2.18
Data

Taskboard

A kanban board of cards in columns and swimlanes, dragged by mouse, touch or keyboard, with work-in-progress limits.

Import

main.ts
import { Taskboard } from '@vitral/vue';

Basic

A flat list of tasks, each naming its column. In progress holds two at most.

Backlog1 cards
To do2 cards
In progress2 of 2 cards
Done1 cards
  • Draft the release notesDocs
  • Audit colour contrastDesignHigh
  • Virtual scrolling in SelectWeb
  • Keyboard grid for DataGridWebHigh
  • Theme editor prototypeDesign
  • Publish 0.1WebHighLocked
Move a card to see the card-move event.
<script setup lang="ts">import { Button, Tag, Taskboard, type TaskboardCardMoveEvent, type TaskboardColumn } from '@vitral/vue';import { ref } from 'vue'; interface Task {    id: number;    title: string;    status: string;    team: string;    priority: 'low' | 'high';    locked?: boolean;} const columns = ref<TaskboardColumn[]>([    { key: 'backlog', title: 'Backlog', color: 'var(--vt-chart-8)' },    { key: 'todo', title: 'To do', color: 'var(--vt-chart-4)' },    { key: 'doing', title: 'In progress', wipLimit: 2, color: 'var(--vt-chart-5)' },    { key: 'done', title: 'Done', color: 'var(--vt-chart-3)' }]); const tasks = ref<Task[]>([    { id: 1, title: 'Draft the release notes', status: 'backlog', team: 'Docs', priority: 'low' },    { id: 2, title: 'Audit colour contrast', status: 'todo', team: 'Design', priority: 'high' },    { id: 3, title: 'Virtual scrolling in Select', status: 'todo', team: 'Web', priority: 'low' },    { id: 4, title: 'Keyboard grid for DataGrid', status: 'doing', team: 'Web', priority: 'high' },    { id: 5, title: 'Theme editor prototype', status: 'doing', team: 'Design', priority: 'low' },    { id: 6, title: 'Publish 0.1', status: 'done', team: 'Web', priority: 'high', locked: true }]); let next = 7;function add(column: string | number, team = 'Web') {    tasks.value = [...tasks.value, { id: next, title: `New task ${next++}`, status: String(column), team, priority: 'low' }];} const log = ref<string[]>([]);function onMove(event: TaskboardCardMoveEvent) {    const task = event.item as Task;    log.value = [`${task.title}: ${event.from.column} → ${event.to.column} (#${event.to.index + 1}, ${event.via})`, ...log.value].slice(0, 3);}</script> <template>    <Taskboard v-model:columns="columns" v-model:items="tasks" column-field="status" style="width: 100%" @card-move="onMove">        <template #card="{ item, locked }">            <div style="display: flex; flex-direction: column; gap: 0.5rem">                <span>{{ (item as Task).title }}</span>                <span style="display: flex; gap: 0.375rem; align-items: center">                    <Tag :value="(item as Task).team" severity="secondary" />                    <Tag v-if="(item as Task).priority === 'high'" value="High" severity="danger" />                    <small v-if="locked" style="color: var(--vt-text-muted-color)">Locked</small>                </span>            </div>        </template>        <template #add-card="{ column }">            <Button label="Add task" icon="plus" variant="text" size="small" severity="secondary" fluid @click="add(column.key)" />        </template>    </Taskboard>    <small style="color: var(--vt-text-muted-color)">{{ log.length ? log.join(' · ') : 'Move a card to see the card-move event.' }}</small></template>

Swimlanes

The same tasks split by team. Page Up and Page Down carry a picked-up card between lanes; a lane collapses from its header.

Backlog1 cards
To do2 cards
In progress2 of 2 cards
Done1 cards
Docs1 tasks
  • Draft the release notes
    No cards
      No cards
        No cards
        Design2 tasks
          No cards
          • Audit colour contrast
          • Theme editor prototype
            No cards
            Web3 tasks
              No cards
              • Virtual scrolling in Select
              • Keyboard grid for DataGrid
              • Publish 0.1
              <script setup lang="ts">import { Taskboard, type TaskboardColumn } from '@vitral/vue';import { ref } from 'vue'; interface Task {    id: number;    title: string;    status: string;    team: string;    priority: 'low' | 'high';    locked?: boolean;} const columns = ref<TaskboardColumn[]>([    { key: 'backlog', title: 'Backlog', color: 'var(--vt-chart-8)' },    { key: 'todo', title: 'To do', color: 'var(--vt-chart-4)' },    { key: 'doing', title: 'In progress', wipLimit: 2, color: 'var(--vt-chart-5)' },    { key: 'done', title: 'Done', color: 'var(--vt-chart-3)' }]); const tasks = ref<Task[]>([    { id: 1, title: 'Draft the release notes', status: 'backlog', team: 'Docs', priority: 'low' },    { id: 2, title: 'Audit colour contrast', status: 'todo', team: 'Design', priority: 'high' },    { id: 3, title: 'Virtual scrolling in Select', status: 'todo', team: 'Web', priority: 'low' },    { id: 4, title: 'Keyboard grid for DataGrid', status: 'doing', team: 'Web', priority: 'high' },    { id: 5, title: 'Theme editor prototype', status: 'doing', team: 'Design', priority: 'low' },    { id: 6, title: 'Publish 0.1', status: 'done', team: 'Web', priority: 'high', locked: true }]);</script> <template>    <Taskboard v-model:columns="columns" v-model:items="tasks" column-field="status" lane-field="team" :reorder-columns="false" style="width: 100%" scroll-height="14rem">        <template #lane-header="{ lane, count }">            <strong>{{ lane.title }}</strong>            <small style="color: var(--vt-text-muted-color)">{{ count }} tasks</small>        </template>    </Taskboard></template>

              Nested columns

              Columns that carry their own cards (v-model:columns). Later starts collapsed but still takes drops; Frozen is locked, and its card is disabled.

              Ideas2 cards
              Next1 cards
              Later2 cards
              Frozen1 cards
              • Dark mode for charts
              • Right-to-left layout
              • Nuxt module
                • IE support
                <script setup lang="ts">import { Taskboard, type TaskboardColumn } from '@vitral/vue';import { ref } from 'vue'; const nested = ref<TaskboardColumn[]>([    { key: 'ideas', title: 'Ideas', items: [{ id: 'a', title: 'Dark mode for charts' }, { id: 'b', title: 'Right-to-left layout' }] },    { key: 'next', title: 'Next', items: [{ id: 'c', title: 'Nuxt module' }] },    { key: 'later', title: 'Later', collapsed: true, items: [{ id: 'd', title: 'Angular adapter' }, { id: 'e', title: 'React adapter' }] },    { key: 'frozen', title: 'Frozen', locked: true, items: [{ id: 'f', title: 'IE support', disabled: true }] }]);</script> <template>    <Taskboard v-model:columns="nested" style="width: 100%">        <template #column-footer="{ count }">            <small style="color: var(--vt-text-muted-color)">{{ count }} in this column</small>        </template>    </Taskboard></template>

                A figure per column

                `summary` adds up a field of each column's cards — the story points here — and shows it beside the count, as it does beside each lane's. `type` makes it an average, a minimum or a maximum, and `format` words it. Move a card and the figures follow.

                To do2 cards11 pts
                In progress2 of 3 cards10 pts
                Done1 cards13 pts
                • Sign-in with passkeys8 pts
                • Empty states3 pts
                • Export to CSV5 pts
                • Trend lines5 pts
                • Guided tour13 pts
                <script setup lang="ts">import { Taskboard, type TaskboardColumn } from '@vitral/vue';import { ref } from 'vue'; const columns: TaskboardColumn[] = [    { key: 'todo', title: 'To do' },    { key: 'doing', title: 'In progress', wipLimit: 3 },    { key: 'done', title: 'Done' }]; interface Task {    id: number;    title: string;    status: string;    points: number;} const tasks = ref<Task[]>([    { id: 1, title: 'Sign-in with passkeys', status: 'todo', points: 8 },    { id: 2, title: 'Empty states', status: 'todo', points: 3 },    { id: 3, title: 'Export to CSV', status: 'doing', points: 5 },    { id: 4, title: 'Trend lines', status: 'doing', points: 5 },    { id: 5, title: 'Guided tour', status: 'done', points: 13 }]);const task = (item: unknown) => item as Task;</script> <template>    <Taskboard v-model:items="tasks" :columns="columns" column-field="status" :summary="{ field: 'points', format: '{value} pts' }" style="width: 100%" scroll-height="14rem">        <template #card="{ item }">            <span style="display: flex; justify-content: space-between; gap: 0.5rem; width: 100%">                <span>{{ task(item).title }}</span>                <small style="color: var(--vt-text-muted-color); white-space: nowrap">{{ task(item).points }} pts</small>            </span>        </template>    </Taskboard></template>

                canDrop

                A hook has the last word: here only high-priority tasks may go to Done from anywhere but In progress.

                Backlog1 cards
                To do2 cards
                In progress2 of 2 cards
                Done1 cards
                • Draft the release notes
                • Audit colour contrast
                • Virtual scrolling in Select
                • Keyboard grid for DataGrid
                • Theme editor prototype
                • Publish 0.1
                <script setup lang="ts">import { Taskboard, type TaskboardColumn } from '@vitral/vue';import { ref } from 'vue'; interface Task {    id: number;    title: string;    status: string;    team: string;    priority: 'low' | 'high';    locked?: boolean;} const columns = ref<TaskboardColumn[]>([    { key: 'backlog', title: 'Backlog', color: 'var(--vt-chart-8)' },    { key: 'todo', title: 'To do', color: 'var(--vt-chart-4)' },    { key: 'doing', title: 'In progress', wipLimit: 2, color: 'var(--vt-chart-5)' },    { key: 'done', title: 'Done', color: 'var(--vt-chart-3)' }]); const tasks = ref<Task[]>([    { id: 1, title: 'Draft the release notes', status: 'backlog', team: 'Docs', priority: 'low' },    { id: 2, title: 'Audit colour contrast', status: 'todo', team: 'Design', priority: 'high' },    { id: 3, title: 'Virtual scrolling in Select', status: 'todo', team: 'Web', priority: 'low' },    { id: 4, title: 'Keyboard grid for DataGrid', status: 'doing', team: 'Web', priority: 'high' },    { id: 5, title: 'Theme editor prototype', status: 'doing', team: 'Design', priority: 'low' },    { id: 6, title: 'Publish 0.1', status: 'done', team: 'Web', priority: 'high', locked: true }]); // Only high-priority work may skip straight to Done.const canDrop = ({ item, from, to }: { item: unknown; from: { column: string | number }; to: { column: string | number } }) =>    !(to.column === 'done' && from.column !== 'doing' && (item as Task).priority !== 'high');</script> <template>    <Taskboard v-model:columns="columns" v-model:items="tasks" column-field="status" :can-drop="canDrop" style="width: 100%" /></template>

                Filtered

                `filter` shows only some cards: words, looked for in each card's text and numbers with case and accents aside (“revisao” finds Revisão), or a function that keeps a card. The counts are of the cards shown. While a filter hides some cards they cannot be dragged — a drop between two visible cards would say nothing about where it goes among the hidden ones — and picking one up says so.

                To do3 cards
                In progress2 cards
                Done1 cards
                • Audit colour contrastDesign
                • Virtual scrolling in SelectWeb
                • Revisão da documentaçãoDocs
                • Keyboard grid for DataGridWeb
                • Theme editor prototypeDesign
                • Release notes for 0.3Docs
                <script setup lang="ts">import { IconField, InputIcon, InputText, SelectButton, Tag, Taskboard, type TaskboardColumn } from '@vitral/vue';import { computed, ref } from 'vue'; interface Task {    id: number;    title: string;    status: string;    team: string;} const columns: TaskboardColumn[] = [    { key: 'todo', title: 'To do' },    { key: 'doing', title: 'In progress' },    { key: 'done', title: 'Done' }]; const tasks = ref<Task[]>([    { id: 1, title: 'Audit colour contrast', status: 'todo', team: 'Design' },    { id: 2, title: 'Virtual scrolling in Select', status: 'todo', team: 'Web' },    { id: 3, title: 'Revisão da documentação', status: 'todo', team: 'Docs' },    { id: 4, title: 'Keyboard grid for DataGrid', status: 'doing', team: 'Web' },    { id: 5, title: 'Theme editor prototype', status: 'doing', team: 'Design' },    { id: 6, title: 'Release notes for 0.3', status: 'done', team: 'Docs' }]); const search = ref('');const team = ref('All');// Words, or a function: here the team is a function and the words are added to it.const filter = computed(() => {    const words = search.value.trim();    if (team.value === 'All') return words;    return (item: Task) => item.team === team.value && (!words || item.title.toLowerCase().includes(words.toLowerCase()));});</script> <template>    <div style="display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0.75rem">        <IconField>            <InputIcon icon="search" />            <InputText v-model="search" placeholder="Search cards" aria-label="Search cards" />        </IconField>        <SelectButton v-model="team" :options="['All', 'Web', 'Design', 'Docs']" :allow-empty="false" aria-label="Team" />    </div>    <Taskboard v-model:items="tasks" :columns="columns" column-field="status" :filter="filter" style="width: 100%">        <template #card="{ item }">            <div style="display: flex; flex-direction: column; gap: 0.5rem">                <span>{{ (item as Task).title }}</span>                <Tag :value="(item as Task).team" severity="secondary" style="align-self: start" />            </div>        </template>    </Taskboard></template>

                API

                Read from packages/vue/src/components/Taskboard/types.ts, so it says what the component actually accepts.

                Props

                NameTypeDescription
                columns TaskboardColumn[]The columns, in order. With no `items`, each carries its own cards (`v-model:columns`).
                items unknown[]The cards as one flat list (`v-model:items`); each names its column in `columnField`.
                columnField stringThe field of a flat item that holds its column's key. Defaults to `'column'`.
                laneField stringThe field that places a card in a swimlane; set it to split the board into lanes.
                summary TaskboardSummaryA figure beside each column's and lane's count, from a field of its cards: `{ field: 'points', format: '{value} pts' }`.
                lanes TaskboardLane[]The lanes, in order. Without them, the lanes are the distinct values of `laneField`, in order of appearance.
                dataKey stringThe field that identifies a card. Defaults to `'id'`.
                cardLabel stringThe field holding a card's title, shown by the default card and used in the announcements. Defaults to `'title'`.
                disabledField stringThe field that marks a card disabled: not clickable and not movable. Defaults to `'disabled'`.
                lockedField stringThe field that marks a card locked: clickable but not movable. Defaults to `'locked'`.
                filter string | ((item: any) => boolean) | nullShows only some cards: words looked for in each card's text and numbers (case and accents aside), or a function that keeps a card. Cards cannot be dragged while a filter hides some.
                canDrop (context: TaskboardDropContext) => booleanLast word on a drop. Return false to refuse it.
                dragdrop booleanCards can be dragged (pointer, touch or keyboard). Defaults to true.
                reorderColumns booleanColumns can be reordered by their handle. Defaults to true.
                collapsible booleanColumns (and lanes) get a button that collapses them. Defaults to true.
                autoScroll booleanScroll the board and the columns while a card is dragged near their edges. Defaults to true.
                touchDelay numberMilliseconds a finger rests on a card before it drags, so a swipe still scrolls. Defaults to 250.
                scrollHeight stringThe height of a column's card list; it scrolls past it.
                disabled boolean—
                scrollbar ScrollbarModeThe bars of the boxes this component scrolls inside — `'hover'`, `'always'` or `'native'`. The application's `scrollbar` option by default, which is `'hover'`.

                Plus pt, dt and unstyled from BaseProps, see pass-through and unstyled mode.

                Emits

                EventPayloadDescription
                update:columns value: TaskboardColumn[]The columns after a card or column moved on a nested board, or after a column moved on a flat one.
                update:items value: unknown[]The flat list after a card moved.
                card-move event: TaskboardCardMoveEvent—
                column-move event: TaskboardColumnMoveEvent—
                card-click event: { item: unknown; column: TaskboardColumn; originalEvent: Event }—
                drop-refused event: TaskboardDropRefusedEvent—

                Slots

                NameSlot propsDescription
                default —The parts, written as children: `<Taskboard.Card>`, `<Taskboard.ColumnHeader>`…
                card (props: TaskboardCardSlotProps)A card's content.
                column-header (props: TaskboardColumnSlotProps)A column header's title area.
                column-footer (props: TaskboardColumnSlotProps)Under a column.
                add-card (props: { column: TaskboardColumn; lane?: TaskboardLane })At the end of every cell: an "add card" button, typically.
                lane-header (props: { lane: TaskboardLane; count: number; collapsed: boolean; toggle: () => void })A lane header's title area.
                empty (props: { column: TaskboardColumn; lane?: TaskboardLane })An empty cell.