TagsItem
Item displaying tags, either from string split into tags, an array of strings or by plucking a value from an array of objects.
Using a string, split into tags using the configured separator:
//<code-header>
fiddle.title = 'Tags item';
//</code-header>
const taskBoard = new TaskBoard({
appendTo : targetElement,
features : {
columnToolbars : false
},
bodyItems : {
// Display a tags item bound to the categories field
categories : {
type : 'tags'
}
},
columns : [
'todo',
'doing',
'done'
],
columnField : 'status',
project : {
tasks : [
{
id : 1,
name : 'Learn Angular',
status : 'doing',
categories : 'book'
},
{
id : 2,
name : 'Learn React',
status : 'done',
categories : 'online,video'
},
{
id : 3,
name : 'Learn Vue',
status : 'todo',
categories : 'lessons,exam'
}
]
}
});Using an array of strings, each entry is turned into a tag:
//<code-header>
fiddle.title = 'Tags item string array';
//</code-header>
const taskBoard = new TaskBoard({
appendTo : targetElement,
features : {
columnToolbars : false
},
bodyItems : {
// Display a tags item bound to the tags field
tags : {
type : 'tags'
}
},
columns : [
'todo',
'doing',
'done'
],
columnField : 'status',
project : {
tasks : [
{
id : 1,
name : 'Bug #1',
status : 'doing',
tags : ['bug', 'critical']
},
{
id : 2,
name : 'Bug #2',
status : 'done',
tags : ['bug']
},
{
id : 3,
name : 'Request #1',
status : 'todo',
tags : ['feature', 'info required']
}
]
}
});Using an array of objects, gives you the most control over the tags. Requires configuring a textProperty and optionally a clsProperty:
//<code-header>
fiddle.title = 'Tags item object array';
//</code-header>
const taskBoard = new TaskBoard({
appendTo : targetElement,
features : {
columnToolbars : false
},
bodyItems : {
// Display a tags item bound to the tags field
tags : {
type : 'tags',
// Plucking text from this property
textProperty : 'title',
// And CSS cls from this
clsProperty : 'cls'
}
},
columns : [
'todo',
'doing',
'done'
],
columnField : 'status',
project : {
tasks : [
{
id : 1,
name : 'Bug #1',
status : 'doing',
tags : [{ title : 'bug' }, { title : 'critical', cls : 'b-color-red' }]
},
{
id : 2,
name : 'Bug #2',
status : 'done',
tags : [{ title : 'bug' }]
},
{
id : 3,
name : 'Request #1',
status : 'todo',
tags : [{ title : 'feature' }, { title : 'info required' }]
}
]
}
});Configs
9
Configs
9Property used to add a CSS class to each tag. It is plucked from an array of objects that is used as the value for this item.
const taskBoard = new TaskBoard({
bodyItems : {
tags : { type : 'TagsItem', clsProperty : 'color' }
},
project : {
tasks : [{
id : 1,
name : 'Issue #1',
tags : [
{ title : 'bug', color : 'orange' },
{ title : 'important', color : 'red' }
]
}]
}
});
// Card for Issue #1 will render 2 tags, one with cls 'orange' and one with cls 'red'
Widget type or config to use as the editor for this item. Used in the inline task editor.
Defaults to use a TagCombo.
Property used to split a value string into tags.
const taskBoard = new TaskBoard({
bodyItems : {
tags : { type : 'TagsItem', separator : ';' }
},
project : {
tasks : [{
id : 1,
name : 'Issue #1',
tags : 'bug;important'
}]
}
});
// Card for Issue #1 will render 2 tags, 'bug' and 'important'
Property used to determine the text for the tag. It is plucked from an array of objects that is used as the value for this item.
const taskBoard = new TaskBoard({
bodyItems : {
tags : { type : 'TagsItem', textProperty : 'title' }
},
project : {
tasks : [{
id : 1,
name : 'Issue #1',
tags : [
{ title : 'bug', color : 'orange' },
{ title : 'important', color : 'red' }
]
}]
}
});
// Card for Issue #1 will render 2 tags, 'bug' and 'important'
Properties
2
Properties
2Typedefs
1
Typedefs
1CSS variables
6
CSS variables
6| Name | Description |
|---|---|
--b-task-board-tag-color | Tag color |
--b-task-board-tag-border | Tag border |
--b-task-board-tag-border-radius | Tag border radius |
--b-task-board-tag-font-size | Tag font size |
--b-task-board-tag-gap | Gap between tags |
--b-task-board-tag-padding | Tag padding |