TaskBoard - Custom Styles
Build app-owned TaskBoard visual systems with density, state classes, CSS variables, and product card styling.
#Usage
import { TaskBoard } from '@primeui/vue-taskboard';<TaskBoard.Root v-model:tasks="tasks" data-key="id" column-field="columnId" density="compact" class="support-board">
<!-- TaskBoard parts -->
</TaskBoard.Root>Use root classes, density values, data attributes, and CSS variables to style the runtime shell. Use slots or UI parts when the visible card, header, menu, or swimlane markup needs to change. These styles live in the app; they are not hidden packaged themes.
#Choose a Styling Layer
| Layer | Use when |
|---|---|
| Density prop | The same board needs compact, standard, or comfortable spacing. |
| CSS variables | Spacing, column width, colors, focus rings, and status accents change. |
| Runtime classes | Styling depends on selected, dragging, focused, filtered, or print state. |
| Data attributes | Styling depends on a specific task, column, swimlane, or print target. |
| Slots and UI parts | The markup, content model, card density, or visible structure also changes. |
Prefer variables for broad decisions and data attributes for object-specific decisions. Replace markup only when CSS is fighting the structure.
#Small Override
Scope product tokens to the board wrapper, then feed them into TaskBoard variables.
.support-board {
color-scheme: light dark;
--support-surface: light-dark(var(--p-surface-0), var(--p-surface-950));
--support-column: light-dark(var(--p-surface-50), var(--p-surface-900));
--support-border: light-dark(var(--p-surface-200), var(--p-surface-800));
--support-accent: light-dark(var(--p-primary-600), var(--p-primary-300));
--p-taskboard-background: var(--support-surface);
--p-taskboard-column-background: var(--support-column);
--p-taskboard-swimlane-border-color: var(--support-border);
--p-taskboard-drop-indicator-color: var(--support-accent);
--p-taskboard-focus-ring-color: var(--support-accent);
}State classes and data attributes handle targeted styling.
.support-board .p-taskboard-card-selected {
outline-color: var(--support-accent);
}
.support-board [data-column-id='blocked'] {
--p-taskboard-column-background: color-mix(in srgb, var(--p-red-500) 8%, var(--support-column));
}
.support-board [data-task-id='escalation-42'] {
scroll-margin-block: 1rem;
}#Style System Pattern
Most product boards need a few coordinated decisions rather than one CSS override. Start with a wrapper class, bind the density that matches the product mode, then map app tokens into TaskBoard variables.
| Decision | Example product treatment |
|---|---|
| Density | compact for an incident queue, comfortable for review. |
| Column width | Narrow queues for triage, wider columns for rich cards. |
| Card surface | Flat rows, campaign cards, or decision cards. |
| Accent strategy | Severity, workflow status, product area, or business value. |
| State styling | Selected, dragging, focused, filtered, and print states. |
<TaskBoard.Root v-model:tasks="tasks" :density="boardDensity" class="launch-board">
<!-- TaskBoard parts -->
</TaskBoard.Root>#CSS Variables
Common variables include:
| Variable | Use |
|---|---|
--p-taskboard-background, --p-taskboard-color | Board surface and text color. |
--p-taskboard-column-background | Column body surface. |
--p-taskboard-column-gap, --p-taskboard-card-gap | Column and card spacing. |
--p-taskboard-column-min-width, --p-taskboard-column-max-width | Column sizing and horizontal scroll. |
--p-taskboard-columns-padding, --p-taskboard-column-body-padding | Board and column inner padding. |
--p-taskboard-column-border-radius, --p-taskboard-border-radius | Shell and column radius. |
--p-taskboard-drop-indicator-color | Insertion marker color. |
--p-taskboard-focus-ring-color, --p-taskboard-focus-ring-width | Focus outline. |
--p-taskboard-column-status-* variables | Column status accents from statusType. |
--p-taskboard-scrollbar-thumb, --p-taskboard-scrollbar-track | Board scrollbar styling. |
--p-taskboard-swimlane-header-width, --p-taskboard-swimlane-min-height | Swimlane sizing. |
Set variables on a wrapper when the change belongs to one board. Set them in the app theme only when every TaskBoard should inherit the same treatment.
#State and Object Hooks
Runtime classes describe behavior state. Data attributes identify public objects.
| Hook | Use |
|---|---|
p-taskboard-card-selected, p-taskboard-card-dragging, p-taskboard-card-focused, p-taskboard-card-disabled | Card interaction states. |
p-taskboard-column-collapsed, p-taskboard-column-locked, p-taskboard-column-pinned | Column state. |
p-taskboard-drop-indicator | Drag insertion marker. |
p-taskboard-rtl, p-taskboard-print-active, p-taskboard-printing, p-taskboard-print-ancestor | Direction and print state. |
data-column-id, data-task-id, data-swimlane-id | Column, task, and swimlane specific styling. |
data-print-target | Print-only styling for the board root. |
Avoid styling private DOM depth. Anchor selectors to a local board class plus a public class or data attribute.
#Visual Style Systems
The style preview switches between three app-owned treatments while the TaskBoard data, drag behavior, selection, and keyboard handling stay the same. The column headers, card surfaces, drag preview, density, and color tokens all change together so the board feels like one product surface rather than a themed card list.
#CSS Variable Example
The CSS-variable preview changes TaskBoard shell tokens without replacing runtime parts. Use this route when the structure is already right and the board only needs product colors, borders, and spacing.
#Checklist
- Scope product styles to a board wrapper such as
.support-board. - Use
light-dark(...)or separate mode tokens when the app supports dark mode. - Keep selected, focused, dragging, filtered, invalid-drop, and print states visible.
- Keep the app-owned visual system close to product data: priority, account tier, SLA, campaign stage, or review confidence should drive the visible differences.
- Tune
--p-taskboard-column-min-widthwith the available container width; too-wide columns can hide useful board context. - Use public classes and data attributes for state styling.
- Move to Card Slots, Column Slots, or UI Parts when custom styling starts requiring extra markup.
#API
Relevant styling APIs include density, root classes, runtime state classes, data-column-id, data-task-id, data-swimlane-id, data-print-target, --p-taskboard-* variables, TaskBoard.ColumnContent, TaskBoard.Card, TaskBoard.ColumnHeader, and copied UI parts. See Theming for the full variable reference and Data Attributes for stable selectors.