Skip to main content
The Bold extension allows you to mark text as bold. Text is rendered as a <strong> HTML element by default.

Installation

npm install @tiptap/extension-bold

Usage

import { Editor } from '@tiptap/core'
import Bold from '@tiptap/extension-bold'

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

Keyboard Shortcuts

  • Mod-b or Mod-B - Toggle bold formatting

Markdown Support

The extension supports markdown syntax for bold text:
  • Type **text** to create bold text
  • Type __text__ to create bold text

Configuration Options

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

Commands

setBold()

Set a bold mark on the current selection.
editor.commands.setBold()

toggleBold()

Toggle the bold mark on the current selection.
editor.commands.toggleBold()

unsetBold()

Remove the bold mark from the current selection.
editor.commands.unsetBold()

Source Code

View the source code on GitHub: