Skip to main content

users

Description​

Optional. Specifies an array of objects containing the users data

Usage​

users?: [
{
id: string | number,
label: string,
avatar?: string,
color?: string,
},
{...} // more user objects
];

Parameters​

The users property presents an array of people objects. Each object includes the following set of parameters:

  • id - (required) the id of a person
  • label - (required) the description of the person
  • avatar - (optional) a path to the image of the person
  • color - (optional) the color of the icon if the image isn't uploaded
info

If the color parameter is not specified, the color from the default set of colors will be applied.

Example​

const { ToDo, Toolbar } = todo;

const tasks = [
{
id: "1",
project: "books",
// parent: null,
text: "Read books",
collapsed: false,
due_date: new Date()
},
{
id: "2",
project: "books",
parent: "1",
text: "Don Quixote",
assigned: [ "user_1" ],
},
{
id: "3",
project: "books",
parent: "1",
text: "The Great Gatsby",
assigned: [ "user_2" ],
checked: true,
},
];

const users = [
{
id: "user_1",
label: "John",
avatar: "../avatar_02.jpg"
},
{
id: "user_2",
label: "Kate",
avatar: "../avatar_03.jpg"
},
];

const projects = [
{ "id": "books", "label": "Books" },
];

const list = new ToDo("#root", {
tasks,
users,
projects
});

const toolbar = new Toolbar("#toolbar", {
api: list.api,
});

Related articles: