Skip to main content

addProject()

Description

Adds a new project

Usage

addProject({
id?: string | number,
project?: object
}): void;

Parameters

  • id - (optional) the ID of a new project
  • project - (optional) an object with parameters of the project:
    • label - (optional) a string with the name of the project

Example

const { ToDo, Toolbar } = todo;

const list = new ToDo("#root", {
projects: [
{ id: "first", label: "First project" },
{ id: "second", label: "Second project" },
{ id: "third", label: "Third project" },
]
});

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

// add a new project
list.addProject({
id: "fourth",
project: {
label: "Fourth project"
}
});

Related article: Operations with projects