Skip to content

Commit f55b2fb

Browse files
Merge pull request #94 from DHTMLX/sp-next-rewrite-guides-via-skills
[update] Rewrite guides using skills
2 parents a870ca4 + 9b8c893 commit f55b2fb

16 files changed

Lines changed: 801 additions & 568 deletions

docs/api/methods/js_kanban_parse_method.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ board.parse({
4646

4747
**Change log:** Starting from v1.1 you don't need to reset initial data in constructor before parsing new data
4848

49-
**Related articles:** [Working with Data](guides/working_with_data.md#loading-data-from-local-source)
49+
**Related articles:** [Working with Data](guides/working_with_data.md#load-data-from-a-local-source)

docs/guides/configuration.md

Lines changed: 145 additions & 124 deletions
Large diffs are not rendered by default.

docs/guides/customization.md

Lines changed: 114 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,138 @@ description: You can learn about the customization in the documentation of the D
66

77
# Customization
88

9-
Besides configuring Kanban, you can customize its appearance and behaviour. The widget allows you to specify a custom template for cards, modify a context menu for cards, columns and rows, change the Toolbar structure and functionality, and apply custom css styles to Kanban.
9+
You can customize the Kanban appearance and behavior with the following properties:
10+
11+
- [`cardTemplate`](api/config/js_kanban_cardtemplate_config.md) — render cards with a custom HTML template
12+
- [`cardShape.menu`](api/config/js_kanban_cardshape_config.md), [`columnShape.menu`](api/config/js_kanban_columnshape_config.md), [`rowShape.menu`](api/config/js_kanban_rowshape_config.md) — modify the context menu for cards, columns, and rows
13+
- [`columnShape.headerTemplate`](api/config/js_kanban_columnshape_config.md), [`columnShape.collapsedTemplate`](api/config/js_kanban_columnshape_config.md) — replace column header templates
14+
- [`cardShape.css`](api/config/js_kanban_cardshape_config.md), [`columnShape.css`](api/config/js_kanban_columnshape_config.md), [`rowShape.css`](api/config/js_kanban_rowshape_config.md) — apply CSS classes conditionally
15+
- [`items`](api/config/toolbar_items_config.md) — rearrange Toolbar structure and add custom controls
16+
- CSS variables — adjust visual styles (see the [Stylization](guides/stylization.md) section)
1017

1118
## Custom cards
1219

13-
To display cards by a custom template, you can use the [`cardTemplate`](api/config/js_kanban_cardtemplate_config.md) property. It is a callback function that allows you to define the desired styles and logic and apply it to Kanban. See the snippet below:
20+
Use the [`cardTemplate`](api/config/js_kanban_cardtemplate_config.md) property to render cards with a custom HTML template. The callback returns the markup for each card.
21+
22+
The callback receives an object with the following parameters:
23+
24+
- `cardFields` — card data
25+
- `selected` — whether the card is selected
26+
- `dragging` — whether the card is being dragged
27+
- `cardShape` — card configuration
28+
29+
To embed a context menu trigger in a custom card template, wrap the menu icon in a `<div>` with the `data-menu-id=${cardFields.id}` attribute (the same structure as the built-in card). The widget binds the menu to the wrapper through this attribute.
30+
31+
The following demo applies a custom card template:
1432

1533
<iframe src="https://snippet.dhtmlx.com/8rhdq81d?mode=js&tag=kanban" frameborder="0" class="snippet_iframe" width="100%" height="600"></iframe>
1634

1735
## Custom context menu
1836

19-
To customize a context menu for cards, columns and rows, you can use the corresponding [`cardShape`](api/config/js_kanban_cardshape_config.md), [`columnShape`](api/config/js_kanban_columnshape_config.md) and [`rowShape`](api/config/js_kanban_rowshape_config.md) properties. See the snippet below:
37+
Configure the context menu for cards, columns, and rows through the [`cardShape.menu`](api/config/js_kanban_cardshape_config.md), [`columnShape.menu`](api/config/js_kanban_columnshape_config.md), and [`rowShape.menu`](api/config/js_kanban_rowshape_config.md) properties. Each `menu.items` entry can use a built-in action ID to invoke a default operation, or define a custom `onClick` handler for any other behavior.
2038

21-
<iframe src="https://snippet.dhtmlx.com/8eo65gr5?mode=js&tag=kanban" frameborder="0" class="snippet_iframe" width="100%" height="600"></iframe>
39+
### `cardShape.menu`
40+
41+
By default the card menu shows **Duplicate** and **Delete** options. Available built-in action IDs:
2242

23-
## Custom toolbar
43+
- `"duplicate-card"` — duplicate the card
44+
- `"delete-card"` — delete the card
2445

25-
To customize the Toolbar structure and its functionality, you can use the [`items`](api/config/toolbar_items_config.md) property. In the array of this config you can define controls you need, arrange them in the desired order as well as modify their behaviour.
46+
### `columnShape.menu`
2647

27-
In the snippet below you can see how to customize the following:
48+
- `"add-card"` — add a new card to the column
49+
- `"set-edit"` — rename the column
50+
- `"move-column:left"`, `"move-column:right"` — move the column left or right
51+
- `"delete-column"` — delete the column
52+
53+
### `rowShape.menu`
54+
55+
- `"set-edit"` — rename the row
56+
- `"move-row:up"`, `"move-row:down"` — move the row up or down
57+
- `"delete-row"` — delete the row
58+
59+
Set `menu.items` to a function to render a different menu per card, column, or row. Return `null` or `false` from the function to hide the menu for a specific item.
60+
61+
The following demo applies a custom context menu:
62+
63+
<iframe src="https://snippet.dhtmlx.com/8eo65gr5?mode=js&tag=kanban" frameborder="0" class="snippet_iframe" width="100%" height="600"></iframe>
2864

29-
- an order of controls arrangement
30-
- a searchbar and its behaviour
31-
- a sort control and its behaviour
32-
- a custom control and its behaviour
65+
## Custom column headers
66+
67+
The [`columnShape`](api/config/js_kanban_columnshape_config.md) property provides templates and behavior for column headers:
68+
69+
- [`columnShape.headerTemplate`](api/config/js_kanban_columnshape_config.md) — HTML template of the column header in the expanded state
70+
- [`columnShape.collapsedTemplate`](api/config/js_kanban_columnshape_config.md) — HTML template of the column header in the collapsed state
71+
- [`columnShape.fixedHeaders`](api/config/js_kanban_columnshape_config.md) — freeze column headers during vertical scroll (default: `true`)
72+
73+
The following code snippet sets a custom header template with a collapse icon, label with card count, and menu trigger:
74+
75+
~~~jsx {5-21}
76+
new kanban.Kanban("#root", {
77+
columns,
78+
cards,
79+
columnShape: {
80+
headerTemplate: kanban.template(({ column, columnState }) => {
81+
return `<div class="wx-collapse-icon" data-action="collapse">
82+
<i class="${column.collapsed ? "wxi-angle-right" : "wxi-angle-left"}"></i>
83+
</div>
84+
${!column.collapsed
85+
? `<div class="wx-label" data-action="rename">
86+
${column.label} (${columnState.cardsCount})
87+
</div>
88+
<div class="wx-menu" data-menu-id="${column.id}">
89+
<i class="wxi-dots-h"></i>
90+
</div>`
91+
: ""}`;
92+
}),
93+
collapsedTemplate: kanban.template(({ column }) => `<div class="wx-collapsed-label">${column.label}</div>`)
94+
}
95+
});
96+
~~~
97+
98+
:::tip
99+
For `fixedHeaders` to take effect, set a fixed height on the Kanban container so the board scrolls vertically.
100+
:::
101+
102+
## Conditional CSS classes
103+
104+
To apply a CSS class conditionally, pass a function to the `css` parameter of [`cardShape`](api/config/js_kanban_cardshape_config.md), [`columnShape`](api/config/js_kanban_columnshape_config.md), or [`rowShape`](api/config/js_kanban_rowshape_config.md). The function returns a class name based on the current data:
105+
106+
- [`cardShape.css: (card) => string`](api/config/js_kanban_cardshape_config.md) — class applied to a card
107+
- [`columnShape.css: (column, cards) => string`](api/config/js_kanban_columnshape_config.md) — class applied to a column
108+
- [`rowShape.css: (row, cards) => string`](api/config/js_kanban_rowshape_config.md) — class applied to a row
109+
110+
The following code snippet highlights overdue cards and underloaded columns:
111+
112+
~~~jsx {5,8}
113+
new kanban.Kanban("#root", {
114+
columns,
115+
cards,
116+
cardShape: {
117+
css: (card) => card.end_date < new Date() ? "overdue" : ""
118+
},
119+
columnShape: {
120+
css: (column, cards) => cards.length < 5 ? "low-load" : ""
121+
}
122+
});
123+
~~~
124+
125+
## Custom Toolbar
126+
127+
Use the [`items`](api/config/toolbar_items_config.md) property to customize the Toolbar structure. The array defines which controls appear, their order, and their behavior. An entry can be:
128+
129+
- a built-in control: `"search"`, `"sort"`, `"undo"`, `"redo"`, `"addColumn"`, `"addRow"`, `"spacer"`
130+
- an object that overrides the searchbar or sort control with custom options
131+
- a custom control passed as a string identifier or a function
132+
133+
The following demo customizes the order of controls, the searchbar, the sort control, and a custom control:
33134

34135
<iframe src="https://snippet.dhtmlx.com/s5r5h4ju?mode=js&tag=kanban" frameborder="0" class="snippet_iframe" width="100%" height="600"></iframe>
35136

36137
## Custom styles
37138

38-
You can customize the appearance of Kanban by changing values of the corresponding *CSS variables*. Refer to the [**Stylization**](guides/stylization.md) section for details.
139+
Change the values of CSS variables to customize the Kanban appearance. See the [Stylization](guides/stylization.md) section for the full list.
39140

40-
In this snippet you can see how to apply custom styles to Kanban:
141+
The following snippet applies custom styles to Kanban:
41142

42143
<iframe src="https://snippet.dhtmlx.com/oj18xwb5?mode=html&tag=kanban" frameborder="0" class="snippet_iframe" width="100%" height="600"></iframe>

docs/guides/initialization.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,51 @@ description: You can learn about the initialization in the documentation of the
66

77
# Initialization
88

9-
This guide will give you detailed instructions on how to create Kanban on a page to enrich your application with features of the Kanban board. Take the following steps to get a ready-to-use component:
9+
Create a Kanban widget on a page in three steps:
1010

11-
1. [Include the Kanban source files on a page](#including-source-files).
12-
2. [Create a container for Kanban](#creating-container).
13-
3. [Initialize Kanban with a constructor](#initializing-kanban).
11+
1. [Include source files](#include-source-files).
12+
2. [Create a container](#create-a-container).
13+
3. [Initialize Kanban](#initialize-kanban).
1414

15-
## Including source files
15+
## Include source files
1616

17-
[Download the package](https://dhtmlx.com/docs/products/dhtmlxKanban/download.shtml) and unpack it into a folder of your project.
17+
[Download the package](https://dhtmlx.com/docs/products/dhtmlxKanban/download.shtml) and unpack the contents into a folder of your project.
1818

19-
To create Kanban, you need to include 2 source files on your page:
19+
Include the following source files on your page:
2020

2121
- *kanban.js*
2222
- *kanban.css*
2323

24-
Make sure that you set correct relative paths to the source files:
24+
Set correct relative paths to both files:
2525

2626
~~~html title="index.html"
2727
<script type="text/javascript" src="./dist/kanban.js"></script>
2828
<link rel="stylesheet" href="./dist/kanban.css">
2929
~~~
3030

31-
## Creating container
31+
## Create a container
3232

33-
Add a container for Kanban and give it an ID, for example *"root"*:
33+
Add a container for Kanban and assign an ID, for example `root`:
3434

3535
~~~jsx title="index.html"
3636
<div id="root"></div>
3737
~~~
3838

39-
If you want to create the widget along with its *Toolbar*, you need to add a separate container for it:
39+
To create the widget with a Toolbar, add a separate container for the Toolbar:
4040

4141
~~~jsx {1} title="index.html"
4242
<div id="toolbar"></div> // container for Toolbar
4343
<div id="root"></div> // container for Kanban
4444
~~~
4545

46-
## Initializing Kanban
46+
## Initialize Kanban
4747

48-
Initialize Kanban with the **kanban.Kanban** constructor. It takes two parameters:
48+
Initialize Kanban with the `kanban.Kanban` constructor. The constructor takes two parameters:
4949

50-
- an HTML container (the ID of the HTML container)
51-
- an object with configuration properties. [See the full list here](#configuration-properties)
50+
- a CSS selector for the HTML container (or the container element itself)
51+
- a configuration object (see the [full list of properties](#configuration-properties))
52+
53+
The following code snippet creates a Kanban instance:
5254

5355
~~~jsx title="index.html"
5456
// create Kanban
@@ -57,35 +59,33 @@ new kanban.Kanban("#root", {
5759
});
5860
~~~
5961

60-
If you want to create the widget along with its *Toolbar*, you need to initialize it separately using the **kanban.Toolbar** constructor. It also takes two parameters:
61-
62-
- an HTML container (the ID of the HTML container)
63-
- an object with configuration properties
62+
To create the widget with a Toolbar, initialize the Toolbar separately with the `kanban.Toolbar` constructor. The Toolbar controls operate on the Kanban instance through the [`api`](api/config/toolbar_api_config.md) parameter. Pass `board.api` to bind the Toolbar to the board:
6463

65-
~~~jsx {6-8} title="index.html"
64+
~~~jsx {7} title="index.html"
6665
// create Kanban
6766
const board = new kanban.Kanban("#root", {
6867
// configuration properties
6968
});
7069

7170
new kanban.Toolbar("#toolbar", {
72-
// configuration properties
71+
api: board.api, // required: links Toolbar controls to the Kanban instance
72+
// other configuration properties
7373
});
7474
~~~
7575

7676
:::info
77-
To learn more about configuring the Toolbar of Kanban, read the [**Configuration**](guides/configuration.md/#toolbar) section
77+
For details on configuring the Toolbar, read the [Configuration](guides/configuration.md#toolbar) section.
7878
:::
7979

8080
### Configuration properties
8181

82-
:::note
83-
The full list of properties to configure **Kanban** can be found [**here**](api/overview/properties_overview.md). <br/>
84-
The full list of properties to configure **Toolbar of Kanban** can be found [**here**](api/overview/toolbar_properties_overview.md).
85-
:::
82+
For the full configuration reference:
83+
84+
- [Kanban properties overview](api/overview/properties_overview.md) — all Kanban configuration properties
85+
- [Toolbar properties overview](api/overview/toolbar_properties_overview.md) — all Toolbar configuration properties
8686

8787
## Example
8888

89-
In this snippet you can see how to initialize **Kanban** with the initial data:
89+
The following snippet initializes Kanban with sample data:
9090

9191
<iframe src="https://snippet.dhtmlx.com/gb50vyip?mode=js&tag=kanban" frameborder="0" class="snippet_iframe" width="100%" height="500"></iframe>

docs/guides/integration.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,20 @@ description: You can learn about the integration in the documentation of the DHT
66

77
# Integration with DHTMLX widgets
88

9-
You can integrate DHTMLX Kanban with other DHTMLX widgets (for instance, [Gantt](https://docs.dhtmlx.com/gantt/), [Scheduler](https://docs.dhtmlx.com/scheduler/), [To Do List](https://docs.dhtmlx.com/todolist/)). Check the examples below.
9+
You can integrate DHTMLX Kanban with other DHTMLX widgets, including:
1010

11-
## Integration with DHTMLX Gantt and Scheduler
11+
- [Gantt](https://docs.dhtmlx.com/gantt/)
12+
- [Scheduler](https://docs.dhtmlx.com/scheduler/)
13+
- [To Do List](https://docs.dhtmlx.com/todolist/)
14+
15+
## Gantt and Scheduler
16+
17+
The following demo embeds a Kanban board alongside Gantt and Scheduler views:
1218

1319
<iframe src="https://snippet.dhtmlx.com/i7j5668s?mode=result&tag=kanban" frameborder="0" class="snippet_iframe" width="100%" height="700"></iframe>
1420

15-
## Integration with DHTMLX To Do List
21+
## To Do List
22+
23+
The following demo embeds a Kanban board alongside a To Do List:
1624

1725
<iframe src="https://snippet.dhtmlx.com/id05kedo?mode=result&tag=kanban" frameborder="0" class="snippet_iframe" width="100%" height="750"></iframe>

0 commit comments

Comments
 (0)