Skip to content

Commit 8fa7898

Browse files
[update] add new setTheme() method and update related topics
1 parent be323cb commit 8fa7898

File tree

7 files changed

+55
-8
lines changed

7 files changed

+55
-8
lines changed

docs/api/config/js_kanban_theme_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ To configure the **theme**, you can use the following parameters.
6262
- `fonts` - (optional) enables/disables fonts loading from the CDN (wxi font)
6363

6464
:::tip
65-
You can also apply the **Willow** and **Willow-Dark** themes as well. To change the current theme dynamically, you can use the [**setConfig()**](../../methods/js_kanban_setconfig_method) method.
65+
You can also apply the **Willow** and **Willow-Dark** themes as well. To change the current theme dynamically, you can use the [**setTheme()**](../../methods/js_kanban_settheme_method) method.
6666
:::
6767

6868
### Default config

docs/api/methods/js_kanban_setconfig_method.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ setConfig(config: object): void;
2121
- `config` - (required) the object of the Kanban configuration. See the full list of properties [here](api/overview/main_overview.md#kanban-properties)
2222

2323
:::tip
24-
Using this method, you can configure the Kanban widget as well as load data to it. The method changes only the parameters you passed.
25-
:::
26-
27-
:::important
28-
The `setConfig()` method destroys the current component and initialize a new one. If you use the component with **Toolbar**, you need to call the [`setConfig()`](api/methods/toolbar_setconfig_method.md) method of **Toolbar**, because it uses the internal API of Kanban. See the example below!
24+
Using this method, you can configure the Kanban widget as well as load data to it. The method doesn't change history (you cannot change history at all) and themes (use the [`setTheme()`](api/methods/js_kanban_settheme_method.md) method instead).
2925
:::
3026

3127
### Example
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
sidebar_label: setTheme()
3+
title: setTheme Method
4+
description: You can learn about the setTheme method in the documentation of the DHTMLX JavaScript Kanban library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Kanban.
5+
---
6+
7+
# setTheme()
8+
9+
### Description
10+
11+
@short: Applies a new theme to Kanban dynamically (with reinitialization)
12+
13+
### Usage
14+
15+
~~~jsx {}
16+
setTheme(theme?: string): void;
17+
~~~
18+
19+
### Parameters
20+
21+
- `theme` - (optional) a theme to be applied to Kanban. There are 3 available themes:
22+
- "material" (*default*)
23+
- "willow"
24+
- "willow-dark"
25+
26+
:::tip
27+
To specify the initial theme, you can use the [**setTheme()**](../../config/js_kanban_theme_config) property.
28+
:::
29+
30+
### Example
31+
32+
~~~jsx {6}
33+
// create Kanban
34+
const board = new eventCalendar.EventCalendar("#root", {
35+
// initial configuration parameters
36+
});
37+
// set the "willow" theme
38+
board.setTheme( "willow" );
39+
~~~
40+
41+
**Change log:** The method was added in v2.0
42+
43+
**Related articles:** [Stylization](../../../guides/stylization)
44+
45+
**Related sample:**
46+
- [Kanban. Using themes](https://snippet.dhtmlx.com/jnw54xif?tag=kanban)
47+
- [Kanban. Including a theme as a stylesheet](https://snippet.dhtmlx.com/k3iw6ti0?tag=kanban)
48+
- [Kanban. Changing a theme via the CSS class](https://snippet.dhtmlx.com/7qzp561m?tag=kanban)

docs/api/overview/main_overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ new kanban.Toolbar("#toolbar", {
6464
| [](../methods/js_kanban_setlocale_method.md) | @getshort(../methods/js_kanban_setlocale_method.md) |
6565
| [](../methods/js_kanban_setsearch_method.md) | @getshort(../methods/js_kanban_setsearch_method.md) |
6666
| [](../methods/js_kanban_setsort_method.md) | @getshort(../methods/js_kanban_setsort_method.md) |
67+
| [](../methods/js_kanban_settheme_method.md) | @getshort(../methods/js_kanban_settheme_method.md) |
6768
| [](../methods/js_kanban_undo_method.md) | @getshort(../methods/js_kanban_undo_method.md) |
6869
| [](../methods/js_kanban_unselectcard_method.md) | @getshort(../methods/js_kanban_unselectcard_method.md) |
6970
| [](../methods/js_kanban_updatecard_method.md) | @getshort(../methods/js_kanban_updatecard_method.md) |

docs/api/overview/methods_overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ description: You can have a Methods overview of JavaScript Kanban in the documen
3636
| [](../methods/js_kanban_setlocale_method.md) | @getshort(../methods/js_kanban_setlocale_method.md) |
3737
| [](../methods/js_kanban_setsearch_method.md) | @getshort(../methods/js_kanban_setsearch_method.md) |
3838
| [](../methods/js_kanban_setsort_method.md) | @getshort(../methods/js_kanban_setsort_method.md) |
39+
| [](../methods/js_kanban_settheme_method.md) | @getshort(../methods/js_kanban_settheme_method.md) |
3940
| [](../methods/js_kanban_undo_method.md) | @getshort(../methods/js_kanban_undo_method.md) |
4041
| [](../methods/js_kanban_unselectcard_method.md) | @getshort(../methods/js_kanban_unselectcard_method.md) |
4142
| [](../methods/js_kanban_updatecard_method.md) | @getshort(../methods/js_kanban_updatecard_method.md) |

docs/guides/stylization.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: You can learn about the stylization in the documentation of the DHT
66

77
# Stylization
88

9-
Using Kanban, you can stylize **columns**, **rows** and **cards** appearance via the [`columnShape.css`](../../api/config/js_kanban_columnshape_config), [`rowShape.css`](../../api/config/js_kanban_rowshape_config) and [`cardShape.css`](../../api/config/js_kanban_cardshape_config) properties. These properties allow you styles columns, rows and cards conditionally.
9+
Using Kanban, you can stylize **columns**, **rows** and **cards** appearance via the [`columnShape.css`](../../api/config/js_kanban_columnshape_config), [`rowShape.css`](../../api/config/js_kanban_rowshape_config) and [`cardShape.css`](../../api/config/js_kanban_cardshape_config) properties. These properties allow you to style columns, rows and cards conditionally.
1010

1111
You can also apply a custom css class to a separate **column**, **row** and **card** via the [`columns.css`](../../api/config/js_kanban_columns_config), [`rows.css`](../../api/config/js_kanban_rows_config) and [`cards.css`](../../api/config/js_kanban_cards_config) properties.
1212

@@ -95,7 +95,7 @@ Next versions of Kanban can bring some changes for the variables and their names
9595

9696
## Built-in themes
9797

98-
You can use the [`theme`](../../api/config/js_kanban_theme_config) property to apply one of the following themes: **material**, **willow** and **willow-dark**.
98+
You can use the [`theme`](../../api/config/js_kanban_theme_config) property or the [`setTheme()`](../../api/methods/js_kanban_settheme_method) method to apply one of the following themes: **material**, **willow** and **willow-dark**.
9999

100100
:::important
101101
Besides using the `theme` property, you can also apply the needed theme via adding the corresponding *css* classes to the widget containers:

sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ module.exports = {
8686
"api/methods/js_kanban_setlocale_method",
8787
"api/methods/js_kanban_setsearch_method",
8888
"api/methods/js_kanban_setsort_method",
89+
"api/methods/js_kanban_settheme_method",
8990
// U
9091
"api/methods/js_kanban_undo_method",
9192
"api/methods/js_kanban_unselectcard_method",

0 commit comments

Comments
 (0)