To-do lists
The to-do list feature lets you create a list of interactive checkboxes with labels. It supports all features of regular lists so you can nest a to-do list together with bulleted and numbered lists in any combination.
To-do lists can be introduced using the dedicated toolbar button. Thanks to the integration with the autoformatting feature, they can also be added with Markdown code. Simply start a line with [ ]
or [x]
followed by a space to insert an unchecked or checked list item, respectively.
After reading this guide, you may find additional interesting details and examples in the Lists in CKEditor 5 blog post.
# Demo
Use the Insert to-do list toolbar button
to add a list to the editor content.# Keyboard support
You can check and uncheck a list item by using the Ctrl + Enter (Cmd + Enter on Mac) shortcut when the selection is in that item.
# Installation
To add this feature to your editor, install the @ckeditor/ckeditor5-list
package:
Then add the TodoList
plugin to your plugin list and the toolbar configuration:
Read more about installing plugins.
# HTML structure
When you call editor.getData()
, a to-do list will be represented as the following HTML:
For nested lists:
# Model representation
From the technical point of view, to-do lists are built on top of the list feature. In the CKEditor 5 data model they are represented as a special listType
, with an optional todoListChecked
attribute:
# Ordered and unordered lists
You can read more about these features in the lists feature guide.
# Contribute
The source code of the feature is available on GitHub in https://github.com/ckeditor/ckeditor5/tree/master/packages/ckeditor5-list.
Every day, we work hard to keep our documentation complete. Have you spotted an outdated information? Is something missing? Please report it via our issue tracker.