Skip to content

Lists, Checklists and Indentation in Vue 3 ​

With @erag/text-editor-vue, list controls are toolbar keywords passed through :init. They give Vue 3 users bulleted and numbered lists with marker styles, checklists, nesting, and indent and outdent. Because checkbox state is written into the markup, the HTML in your v-model ref keeps track of which items are checked.

Headings, fonts, colors, and alignment live on a separate page: text formatting.


Toolbar Configuration ​

Add list and indentation controls to your init.toolbar:

vue
<script setup lang="ts">
import { shallowRef } from 'vue';
import { Editor, type EditorInit } from '@erag/text-editor-vue';

const content = shallowRef('<ul><li>First item</li></ul>');

const editorConfig: EditorInit = {
    toolbar:
        'undo redo | blocks | bullist numlist checklist outdent indent | removeformat',
};
</script>

<template>
    <Editor v-model="content" :init="editorConfig" />
</template>

Detailed Controls ​

Control NameToolbar KeywordResultShortcut
Bulleted Listbullist<ul><li>Item</li></ul> with style menuStandard toolbar click
Numbered Listnumlist<ol><li>Item</li></ol> with style menuStandard toolbar click
ChecklistchecklistInteractive checkbox listStandard toolbar click
Increase IndentindentIndents current line or list item depthTab (inside list item)
Decrease IndentoutdentDecreases indentation depth or exits listShift+Tab (inside list)

The Decrease Indent and Increase Indent buttons use matching filled format-indent icons. The arrow points left for decrease and right for increase.

In a table cell, Tab and Shift+Tab move between cells rather than changing indentation, as described in the table editor guide.


Bulleted and numbered style groups ​

bullist and numlist are separate dropdown controls and keep their own list icon. Each dropdown presents a visual preview grid:

  • Bulleted list: default, circle, disc, and square markers.
  • Numbered list: decimal, lower alpha, lower Greek, lower Roman, upper alpha, and upper Roman markers.

Selecting a preview creates or updates the current list and applies its list-style-type. Arrow keys navigate the preview grid, Home and End jump to the first or last style, and Escape closes it.


Interactive checklists ​

Add checklist to the toolbar and keep the lists plugin enabled. The same action is also available through Insert → Checklist.

  • Clicking the command converts the current unordered list into a checklist.
  • Clicking it again inside an active checklist converts the content back to a normal unordered list.
  • Every item contains a native checkbox whose checked state is persisted in the editor HTML.
  • Enter after a non-empty item creates the next checklist item.
  • Enter on an empty checklist item exits the list and creates a paragraph.
  • Checkboxes are non-interactive in disabled and readonly editors.

Checklist HTML uses package-specific data attributes:

html
<ul data-erag-checklist="true">
    <li data-erag-checklist-item="true">
        <input
            type="checkbox"
            data-erag-checklist-checkbox="true"
            contenteditable="false"
        />
        Prepare release notes
    </li>
</ul>

Tailwind CSS Reset Fix ​

In projects using Tailwind CSS or CSS resets (such as Tailwind Preflight), standard browser ul list discs and ol numbers are often stripped globally by reset rules (list-style: none).

@erag/text-editor-vue solves this issue out of the box by applying package-scoped styles inside .erag-editor__content. This guarantees that lists and nested levels render cleanly inside the editor without requiring global application CSS modifications.