Tabs

Beta

Word documents use tab characters for alignment, indentation, and columnar layout within paragraphs. Tiptap and HTML do not have a native tab stop concept, so tabs are converted to spaces during import.

What you need

  • Extensions: No additional extensions required. Tab content is converted to plain text.
  • Configuration: None.

Support overview

ImportEditorExport
Tab characters (mid-paragraph)Converted to four spacesPlain text (spaces)Spaces remain as spaces
Tab characters (start of paragraph)Converted to four spaces in the JSON; visually collapse in the editorNot visible by default (see below)Spaces remain as spaces
Tab stop positionsNot preservedNot supportedNot supported

Import

Import tabs using the editor extension or the REST API. Both handle tabs identically.

When the import converter encounters a <w:tab/> element in a text run, it replaces it with four space characters. Word's tab stop positions (left, center, right, decimal, and bar tabs defined in paragraph or style properties) are not extracted or preserved.

The conversion is positional-agnostic: a tab at the start of a paragraph and a tab in the middle of a paragraph both produce four space characters in the JSON. The visual outcome differs because of how the browser renders whitespace (see Editor rendering below).

Editor rendering

Tab characters are converted to spaces on import, so the editor receives regular text content. There is no tab stop or tab character concept in Tiptap.

Leading spaces in a paragraph are not visible by default

The four spaces produced from a tab character live in the JSON and reach the editor unchanged, but the browser collapses runs of whitespace under default white-space: normal. A tab at the start of a paragraph therefore renders as if it were a single space hugging the paragraph's left edge, which visually looks like the tab was dropped. This is the standard HTML whitespace rule, not import-side trimming. A tab in the middle of a sentence is also collapsed to a single space, which usually reads correctly because there is text on either side.

To preserve the visual indentation, either set white-space: pre-wrap on your editor's paragraph styles, or transform leading spaces into non-breaking spaces ( ) in your onImport callback before loading content into the editor.

Export

Spaces remain as spaces in the exported DOCX. There is no conversion from spaces back to tab characters. Content that originally used tabs in Word will export with spaces instead.