🚀 BlockNote AI is here! Access the early preview.

Adding DOM Attributes

BlockNote allows you to add custom HTML attributes to various DOM elements within the editor. This gives you fine-grained control over styling and functionality.

Available DOM Elements

The following DOM elements can receive custom attributes:

  • editor: The main editor container, excluding menus & toolbars
  • block: The container element for individual blocks
  • blockGroup: Wrapper for top-level and nested blocks
  • blockContent: Wrapper for a block's content
  • inlineContent: Wrapper for rich-text content within blocks

Example Usage

The demo below shows how to add a custom class to the block element to create a border around each block: