Skip to main content
The Underline extension allows you to mark text with underline formatting. Text is rendered as a <u> HTML element by default.

Installation

npm install @tiptap/extension-underline

Usage

import { Editor } from '@tiptap/core'
import Underline from '@tiptap/extension-underline'

const editor = new Editor({
  extensions: [
    Underline,
  ],
})

Keyboard Shortcuts

  • Mod-u or Mod-U - Toggle underline formatting

Markdown Support

The extension supports markdown syntax for underlined text:
  • Type ++text++ to create underlined text

Configuration Options

HTMLAttributes
Record<string, any>
default:"{}"
HTML attributes to add to the underline element.
Underline.configure({
  HTMLAttributes: {
    class: 'my-underline-class',
  },
})

Commands

setUnderline()

Set an underline mark on the current selection.
editor.commands.setUnderline()

toggleUnderline()

Toggle the underline mark on the current selection.
editor.commands.toggleUnderline()

unsetUnderline()

Remove the underline mark from the current selection.
editor.commands.unsetUnderline()

Source Code

View the source code on GitHub:

Build docs developers (and LLMs) love