> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/ueberdosis/tiptap/llms.txt
> Use this file to discover all available pages before exploring further.

# Underline

> Mark text with underline formatting.

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

## Installation

<CodeGroup>
  ```bash npm theme={null}
  npm install @tiptap/extension-underline
  ```

  ```bash yarn theme={null}
  yarn add @tiptap/extension-underline
  ```

  ```bash pnpm theme={null}
  pnpm add @tiptap/extension-underline
  ```
</CodeGroup>

## Usage

```typescript theme={null}
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

<ParamField path="HTMLAttributes" type="Record<string, any>" default="{}">
  HTML attributes to add to the underline element.

  ```typescript theme={null}
  Underline.configure({
    HTMLAttributes: {
      class: 'my-underline-class',
    },
  })
  ```
</ParamField>

## Commands

### setUnderline()

Set an underline mark on the current selection.

```typescript theme={null}
editor.commands.setUnderline()
```

### toggleUnderline()

Toggle the underline mark on the current selection.

```typescript theme={null}
editor.commands.toggleUnderline()
```

### unsetUnderline()

Remove the underline mark from the current selection.

```typescript theme={null}
editor.commands.unsetUnderline()
```

## Source Code

View the source code on GitHub:

* [packages/extension-underline](https://github.com/ueberdosis/tiptap/tree/main/packages/extension-underline)
