Styling

The Bryntum TaskBoard is rendered in the DOM using regular HTML and CSS, and can be completely styled using CSS. It ships with both pre-compiled CSS bundles, and the original CSS files. The CSS includes different themes and colors, which can be used to alter how the TaskBoard and its contents look.

You can also programmatically modify the appearance of cells, headers and events using renderers (depending on product).

Using a theme

Bryntum products have their "structural" CSS and themes separated. The structural CSS contains the basic layout and styling shared between all themes for the product. It defines a lot of CSS variables (CSS custom properties), that the themes then set to specific values to create the visual appearance.

The theme CSS files set CSS variables for all Bryntum products, so you can use the same theme file for all Bryntum products.

The TaskBoard ships with four themes, each available in light and dark variants:

  • Stockholm (stockholm-light.css & stockholm-dark.css)
  • Svalbard (svalbard-light.css & svalbard-dark.css)
  • Visby (visby-light.css & visby-dark.css)
  • Material3 (material3-light.css & material3-dark.css)
  • Fluent2 (fluent2-light.css & fluent2-dark.css)

The CSS is located in the /build folder of the Bryntum distribution. You can include it in your project by for example using link tags:

<!-- Structural CSS -->
<link rel="stylesheet" href="build/taskboard.css">
<!-- Bryntum theme -->
<link rel="stylesheet" href="build/svalbard-light.css" data-bryntum-theme>

The data-bryntum-theme attribute on the link tag is not strictly required, but it allows you to programmatically switch the theme at runtime using DomHelper.setTheme().

Comparison of themes

Svalbard

Our default theme, very light and minimalistic. It is designed to be easy on the eyes and to not distract from the data.

Svalbard Light theme Svalbard Dark theme

Stockholm

The Stockholm theme was our default theme prior to v7.0. It has been updated with a more modern look and feel.

Stockholm Light theme Stockholm Dark theme

Visby

The city of Visby is famous for its medieval city wall, and the Visby theme embraces that by using more borders than our other themes.

Visby Light theme Visby Dark theme

Material3

The Material3 theme is based on Google's Material Design. It is a modern and clean theme that is slightly more colorful than our Svalbard theme.

Material3 Light theme Material3 Dark theme

In most of the included examples you can switch theme on the fly by clicking on the gear icon found in the header and then picking a theme in the dropdown.

Change theme

Combining products

The structural CSS described above include all the CSS you need to use TaskBoard and its helper widgets such as Popups, TextFields and so on. When combining multiple different Bryntum products on a single page using normal structural CSS, the shared styling will be included multiple times.

To avoid this, each product's structural CSS is available in a version that only contains the CSS specific for that product. These are called thin CSS bundles (e.g. taskboard.thin.css).

When using them you will need to include one for each used level in the Bryntum product hierarchy (TaskBoard -> Core + TaskBoard).

For example to combine Grid and TaskBoard using the Svalbard Light theme, you would include:

  • core.thin.css
  • grid.thin.css
  • taskboard.thin.css
  • svalbard-light.css

Which in your html file might look something like this:

<link rel="stylesheet" href="core.thin.css" >
<link rel="stylesheet" href="grid.thin.css">
<link rel="stylesheet" href="taskboard.thin.css">
<link rel="stylesheet" href="svalbard-light.css" data-bryntum-theme>

Nothing prevents you from always using thin CSS bundles, but please note that there might be a slight network overhead from pulling in multiple CSS files as opposed to a single one with the normal CSS.

Creating a custom theme

To create your own theme, get the distribution bundle or install the NPM package as usual and follow these steps:

  • (Optional) Make a copy of an existing theme found under build/ (either in package under the node_modules folder or in the extracted zip), for example the svalbard-light.css file. If you pick the theme that is closest to what you want, you will have to change less. You can also start from scratch, but it will be more work.
  • Edit the variables in it to suit your needs, and add any additional variables you want to tweak. You can reference all the available variables in the API documentation for each widget, or by looking at the CSS files in the lib folder.
  • Include your theme on page (and remove any default theme you where using).

Depending on the import order of your CSS files, you might need to make the theme's variables more specific than the structural CSS. If for example this does not alter the variables as you would expect:

:root {
    --b-button-outlined-border-color : lightsalmon;
}

It might be because the structural CSS is included after your theme, and it sets the variable to a different value. In that case, you can either alter the inclusion order (if you have control over the build process), or make your variables more specific:

/* The :not rule can contain anything, its purpose is only to make this rule */ 
/* more specific */
:root:not(.b-nothing) {
  --b-button-outlined-border-color : lightsalmon;
}

/* Another (less flexible) option is to scope it to a specific selector */
.b-button {
  --b-button-outlined-border-color : lightsalmon;
}

Overriding an existing theme

As an alternative to creating a full custom theme, you can also just override a few variables in an existing theme. To do so, include the structural CSS and the theme you want to use, and then add your own CSS file that overrides the variables you want to change.

<!-- Structural CSS -->
<link rel="stylesheet" href="build/taskboard.css">
<!-- Bryntum theme -->
<link rel="stylesheet" href="build/svalbard-light.css" data-bryntum-theme>
<!-- Your customizations -->
<link rel="stylesheet" href="path/to/your/customizations.css">

In customizations.css, you can then override any variables you want to change:

:root {
    /* Everything looks good in lightsalmon */
    --b-button-outlined-border-color : lightsalmon;
}

Switching theme at runtime

You can also add a combo box (or other UI) that lets you change the theme at run-time, similar to the examples we have. To do so, ensure you have multiple themes in a folder (e.g. /themes).

If you're using custom themes, ensure that you change their names in the .b-theme-info block in the CSS file to avoid collisions.

Next, you need to add a combo box using tbar.

import { TaskBoard, DomHelper } from '@bryntum/taskboard';
const taskboard = new TaskBoard({
    // ...taskboard data
    tbar : [
        {
            type  : 'combo',
            // list of themes shown in the drop down (combo box)
            items : [
                { text : 'Svalbard Light', value : 'svalbard-light' },
                { text : 'Svalbard Dark', value : 'svalbard-dark' },
                { text : 'Visby-Light', value : 'visby-light' },
                { text : 'Visby-Dark', value : 'visby-dark' }
                // More themes...
            ],
            label : 'Theme',
            // default theme
            value : 'svalbard-light',
            // change theme on selection
            onAction(props) {
                DomHelper.setTheme(props.value);
            }
        }
    ]
});

With that being set up, you can switch themes within your application.

Apply color to columns, swimlanes and cards

By default TaskBoard uses a neutral styling void of color. The reasoning behind this is that it makes it easier to adapt it to look the way you want in your app.

On the data level tasks (see eventColor), columns (color) and swimlanes (color) can have a color specified. If they do, a corresponding CSS class is applied to their element. For example the following task:

{
    "id"         : 1,
    "name"       : "Important task",
    "eventColor" : "red"
}

Will have the CSS class b-color-red applied to it. The following colors are predefined:

red
pink
magenta
purple
deep-purple
violet
indigo
blue
light-blue
cyan
teal
green
light-green
lime
yellow
amber
orange
deep-orange

The CSS class set the --b-primary CSS variable on the element, which does not directly affect the styling. Instead, you can use it to style some part of a task/column/swimlane as you see fit, by using var(--b-primary) for the color value. For example to give all tasks a thick left border with their configured color:

.b-task-board-task {
    border-left : 5px solid var(--b-primary);
}

This demo uses illustrates the above, with tasks using the listed colors:

Styling colors 1
//<code-header>
fiddle.title = 'Styling colors 1';
CSSHelper.insertRule('.colors1 .b-task-board-card { border-left : 5px solid var(--b-primary) }', targetElement.getRootNode());
//</code-header>
const taskBoard = new TaskBoard({
    appendTo : targetElement,

    cls : 'colors1',

    features : {
        columnToolbars : false
    },

    // Columns to display
    columns : [
        'todo',
        'doing',
        'review',
        'done'
    ],

    // Field used to pair a task to a column
    columnField : 'status',

    // Project using inline data
    project : {
        tasks : [
            { id : 1, name : 'red', status : 'todo', eventColor : 'red' },
            { id : 2, name : 'pink', status : 'doing', eventColor : 'pink' },
            { id : 3, name : 'purple', status : 'review', eventColor : 'purple' },
            { id : 4, name : 'deep-purple', status : 'done', eventColor : 'deep-purple' },
            { id : 5, name : 'indigo', status : 'todo', eventColor : 'indigo' },
            { id : 6, name : 'blue', status : 'doing', eventColor : 'blue' },
            { id : 7, name : 'light-blue', status : 'review', eventColor : 'light-blue' },
            { id : 8, name : 'cyan', status : 'done', eventColor : 'cyan' },
            { id : 9, name : 'teal', status : 'todo', eventColor : 'teal' },
            { id : 10, name : 'green', status : 'doing', eventColor : 'green' },
            { id : 11, name : 'light-green', status : 'review', eventColor : 'light-green' },
            { id : 12, name : 'lime', status : 'done', eventColor : 'lime' },
            { id : 13, name : 'yellow', status : 'todo', eventColor : 'yellow' },
            { id : 14, name : 'amber', status : 'doing', eventColor : 'amber' },
            { id : 15, name : 'orange', status : 'review', eventColor : 'orange' },
            { id : 16, name : 'deep-orange', status : 'done', eventColor : 'deep-orange' }
        ]
    }
});

Or using the very same code as in the demo above, but with this CSS rule:

.b-task-board-card-header::after {
    content       : '';
    width         : 1em;
    height        : 1em;
    border-radius : 50%;
    background    : var(--b-primary);
}
Styling colors 2
//<code-header>
fiddle.title = 'Styling colors 2';
CSSHelper.insertRule(`
    .colors2 .b-task-board-card-header::after {
        content       : '';
        width         : 1em;
        height        : 1em;
        border-radius : 50%;
        background    : var(--b-primary);
    }
`, targetElement);
//</code-header>
const taskBoard = new TaskBoard({
    appendTo : targetElement,

    cls : 'colors2',

    features : {
        columnToolbars : false
    },

    // Columns to display
    columns : [
        'todo',
        'doing',
        'review',
        'done'
    ],

    // Field used to pair a task to a column
    columnField : 'status',

    // Project using inline data
    project : {
        tasks : [
            { id : 1, name : 'red', status : 'todo', eventColor : 'red' },
            { id : 2, name : 'pink', status : 'doing', eventColor : 'pink' },
            { id : 3, name : 'purple', status : 'review', eventColor : 'purple' },
            { id : 4, name : 'deep-purple', status : 'done', eventColor : 'deep-purple' },
            { id : 5, name : 'indigo', status : 'todo', eventColor : 'indigo' },
            { id : 6, name : 'blue', status : 'doing', eventColor : 'blue' },
            { id : 7, name : 'light-blue', status : 'review', eventColor : 'light-blue' },
            { id : 8, name : 'cyan', status : 'done', eventColor : 'cyan' },
            { id : 9, name : 'teal', status : 'todo', eventColor : 'teal' },
            { id : 10, name : 'green', status : 'doing', eventColor : 'green' },
            { id : 11, name : 'light-green', status : 'review', eventColor : 'light-green' },
            { id : 12, name : 'lime', status : 'done', eventColor : 'lime' },
            { id : 13, name : 'yellow', status : 'todo', eventColor : 'yellow' },
            { id : 14, name : 'amber', status : 'doing', eventColor : 'amber' },
            { id : 15, name : 'orange', status : 'review', eventColor : 'orange' },
            { id : 16, name : 'deep-orange', status : 'done', eventColor : 'deep-orange' }
        ]
    }
});

When defining a color on a column/swimlane, it will be applied to both the column/swimlane and its tasks. Applying to columns could look like:

const taskBoard = new TaskBoard({
    columns : [
        { id : 'todo', text : 'Todo', color : 'deep-orange' },
        /*...*/
    ]
});

And this demo uses this rule to put a top border on both column headers and cards:

.b-task-board-column-header,
.b-task-board-card {
    border-top : 3px solid var(--b-primary);
}
Styling colors 3
//<code-header>
fiddle.title = 'Styling colors 3';
CSSHelper.insertRule(`
    .colors3 .b-task-board-column-header,
    .colors3 .b-task-board-card {
        border-top : 3px solid var(--b-primary);
    }
`, targetElement);
//</code-header>
const taskBoard = new TaskBoard({
    appendTo : targetElement,

    cls : 'colors3',

    features : {
        columnToolbars : false
    },

    css : {
        columnGap : 0
    },

    // Columns to display
    columns : [
        { id : 'todo', text : 'Todo', color : 'deep-orange' },
        { id : 'doing', text : 'Doing', color : 'yellow' },
        { id : 'review', text : 'Review', color : 'lime' },
        { id : 'done', text : 'Done', color : 'green' }
    ],

    // Field used to pair a task to a column
    columnField : 'status',

    // Project using inline data
    project : {
        tasks : [
            { id : 1, name : 'Task 1', status : 'todo' },
            { id : 2, name : 'Task 2', status : 'doing' },
            { id : 3, name : 'Task 3', status : 'review' },
            { id : 4, name : 'Task 4', status : 'done' }
        ]
    }
});

Use TaskBoards CSS variables

As mentioned above, TaskBoard uses CSS variables for its own styling (but the components it is based on uses SASS). This allows you to manipulate its looks, by either using CSS files or by specifying vars in code. For example to give the TaskBoard and its columns a background color using a CSS file:

.b-task-board {
    --b-task-board-body-padding             : 2em;
    --b-task-board-column-gap               : 1em;
    --b-task-board-background               : var(--b-primary-30);
    --b-task-board-column-background        : var(--b-primary-95);
    --b-task-board-column-header-background : var(--b-primary-90);
}
Styling variables 1
//<code-header>
fiddle.title = 'Styling variables 1';
CSSHelper.insertRule(`
    .vars1.b-task-board-base {
        --b-task-board-body-padding             : 2em;
        --b-task-board-column-gap               : 1em;
        --b-task-board-background               : var(--b-primary-30);
        --b-task-board-column-background        : var(--b-primary-95);
        --b-task-board-column-header-background : var(--b-primary-90);
    }
`, targetElement);
//</code-header>
const taskBoard = new TaskBoard({
    appendTo : targetElement,

    cls : 'vars1',

    features : {
        columnToolbars : false
    },

    // Columns to display
    columns : [
        { id : 'todo', text : 'Todo' },
        { id : 'doing', text : 'Doing' },
        { id : 'done', text : 'Done' }
    ],

    // Field used to pair a task to a column
    columnField : 'status',

    // Project using inline data
    project : {
        tasks : [
            { id : 1, name : 'Task 1', status : 'todo' },
            { id : 2, name : 'Task 2', status : 'doing' },
            { id : 3, name : 'Task 3', status : 'done' },
            { id : 4, name : 'Task 4', status : 'todo' },
            { id : 5, name : 'Task 5', status : 'doing' },
            { id : 6, name : 'Task 6', status : 'done' }
        ]
    }
});

You can also achieve the same result by supplying a css config to TaskBoard. When doing so, you can leave out the --b-taskboard prefix that CSS vars use and use camel casing instead of hyphenated names:

const taskBoard = new TaskBoard({
    css : {
        bodyPadding            : '2em',
        columnGap              : '1em',
        background             : 'var(--b-primary-30)',
        columnBackground       : 'var(--b-primary-95)',
        columnHeaderBackground : 'var(--b-primary-90)'
    }
});
Styling variables 2
//<code-header>
fiddle.title = 'Styling variables 2';
//</code-header>
const taskBoard = new TaskBoard({
    appendTo : targetElement,

    cls : 'vars2',

    css : {
        bodyPadding            : '2em',
        columnGap              : '1em',
        background             : 'var(--b-primary-30)',
        columnBackground       : 'var(--b-primary-95)',
        columnHeaderBackground : 'var(--b-primary-90)'
    },

    features : {
        columnToolbars : false
    },

    // Columns to display
    columns : [
        { id : 'todo', text : 'Todo' },
        { id : 'doing', text : 'Doing' },
        { id : 'done', text : 'Done' }
    ],

    // Field used to pair a task to a column
    columnField : 'status',

    // Project using inline data
    project : {
        tasks : [
            { id : 1, name : 'Task 1', status : 'todo' },
            { id : 2, name : 'Task 2', status : 'doing' },
            { id : 3, name : 'Task 3', status : 'done' },
            { id : 4, name : 'Task 4', status : 'todo' },
            { id : 5, name : 'Task 5', status : 'doing' },
            { id : 6, name : 'Task 6', status : 'done' }
        ]
    }
});

CSS variables reference

See the API documentation for each class, it lists the CSS variables directly defined on it. For example here for the TaskBoard itself: TaskBoard CSS docs

Troubleshooting

CSS mismatched version

If you've encountered a CSS error:

CSS version 7.0.0 doesn't match bundle version 7.2.0-alpha-1!
Make sure you have imported css from the appropriate product version.

That means you're using a wrong version of Bryntum theme file. Following are some of the ways to check and fix the issue:

Verify CSS version

Ensure that the CSS file being used matches the version of the Bryntum API. For example, if you're using version 7.2.0-alpha-1 of TaskBoard, you need to have the CSS files of version 7.2.0-alpha-1.

Clear Cache

Ensure the mismatched CSS file is not cached on your web server to prevent outdated files from being served. Clear the browser cache to ensure the latest CSS file is loaded.

Cache Busting

Cache busting is a technique used to force browsers to load the most recent versions of files. If the CSS file is imported in index.html, then it should have cache busting by specifying the version (taskboard.css?v=7.2.0-alpha-1) or use timestamps (taskboard.css?1704085200).

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Your TaskBoard App</title>
    <link rel="stylesheet" href="path/to/stylesheet.css?v=1.2.3"> <!-- Cache busting by specifying version -->
</head>
<body>
    <!-- Your content here -->
</body>
</html>

Modern frameworks apply this by default to the production code, but it needs to be manually implemented in vanilla JavaScript projects.