🚀 BlockNote AI is here! Access the early preview.
BlockNote Docs/React/Styling & Theming/Overriding CSS

Overriding CSS

Overview

BlockNote provides several ways to customize the editor's appearance through CSS. You can override default styles using CSS classes and attributes.

Basic Example

In the demo below, we create additional CSS rules to make the editor text and hovered slash menu items blue:

CSS Selectors Reference

BlockNote CSS Classes

BlockNote uses classes with the bn- prefix to style editor elements. Here are the key classes you can target:

Editor Structure

  • .bn-container: Container for editor and all menus/toolbars
  • .bn-editor: Main editor element
  • .bn-block: Individual block element (including nested)
  • .bn-block-group: Container for nested blocks
  • .bn-block-content: Block content wrapper
  • .bn-inline-content: Block's editable rich text content

UI Components

  • .bn-toolbar: Formatting & link toolbars
  • .bn-side-menu: Side menu element
  • .bn-drag-handle-menu: Drag handle menu
  • .bn-suggestion-menu: Suggestion menu

BlockNote CSS Attributes

BlockNote uses data attributes to target specific block types and properties:

  • [data-content-type="blockType"]: Targets blocks of type blockType
  • [data-propName="propValue"]: Targets blocks with specific prop values

Example: