List commands

Lists are a crucial part of structuring content in your Tiptap editor. Tiptap provides commands to manipulate list structures easily. Here’s an overview of the essential commands that help you create, update, and manage your lists.

Use Cases

  • Creating and Toggling Lists: Create or switch between list types using toggleList.
  • Nesting and Unnesting List Items: Lift or sink list items using commands like liftListItem and sinkListItem.
  • Splitting and Wrapping List Items: Split or wrap list items efficiently with splitListItem and wrapInList.
  • Improving List Keyboard Behavior: Use the List Keymap extension to refine list behavior with additional keymap handlers.

List Keymap Extension

You might also want to include the List Keymap extension, which adds extra keymap handlers to change the default backspace and delete behavior for lists. It modifies the default behavior so that pressing backspace at the start of a list item lifts the content into the list item above.

Here’s a list of… list commands

CommandDescription
liftListItemAttempts to lift the list item around the current selection up into a wrapping parent list.
sinkListItemSinks the list item around the current selection down into a wrapping child list.
splitListItemSplits one list item into two separate list items.
toggleListToggles between different types of lists.
wrapInListWraps a node in the current selection in a list.