BlockNote DocsReactStyling & ThemingThemes

Themes

BlockNote comes with both a light and dark theme. By default, the theme is automatically selected based on the user's system preference, but you can also force either light or dark mode.

When using Mantine, you have additional theme functionality:

  • Custom color schemes for light and dark mode, including highlight colors
  • Change fonts, shadows, borders, and border radii
  • Customize themes programmatically or using CSS variable overrides

This page mostly focuses on the extra functionality that comes from using Mantine, but the Forcing Light/Dark Mode section is applicable to all UI libraries.

CSS Variables

A theme is made up of a set of CSS variables, which can be overwritten to change the look & feel of the editor.

.bn-root {
  /* Theme variables */
  --bn-text-color-muted: oklch(85% 0 0);
  --bn-border-color: oklch(95% 0 0);
  --bn-radius-medium: 6px;
  ...
}

BlockNote components don't use the theme variables directly. Instead, there's another layer of element variables which assigns the theme variables to specific elements within the editor. For example, --bn-text-color-muted theme variable is used by both the --bn-editor-placeholder-color and --bn-side-menu-icon-color element variables. To change the Side Menu color specifically, the --bn-side-menu-icon-color should be overridden rather than the underlying --bn-text-color-muted variable.

.bn-root {
  /* Element variables */
  --bn-editor-placeholder-color: var(--bn-text-color-muted);
  --bn-side-menu-icon-color: var(--bn-text-color-muted);
  --bn-toolbar-border: 1px solid var(--bn-border-color);
  --bn-toolbar-radius: var(--bn-radius-medium);
  ...
}

Overriding theme/element variables on the .bn-root[data-color-scheme] selector will overwrite them for both light & dark mode. To overwrite variables separately for light & dark mode, use the .bn-root[data-color-scheme="light"] and .bn-root[data-color-scheme="dark"] selectors.

For the full list of theme/element variables used by BlockNote, see theme.css.

Programmatic Configuration

You can also set the theme CSS variables using the theme prop in BlockNoteView. Passing a Theme object will overwrite CSS variables for both light & dark themes with values from the object.

Additionally, an elements field allows for overriding the element variables.

import type {  } from "@blocknote/mantine";

const  = {
  : { : "#737373" },
  : { : "2px", : "4px", : "6px" },
  : { : "Helvetica Neue, sans-serif" },
  // Optional: override styles for specific elements.
  : {
    : { : "#999999" },
    : { : "2px dashed blue" },
  },
} satisfies ;

In the demo below, we create the same red theme as from the previous demo, but this time we set it using the theme prop in BlockNoteView:

Light and Dark Themes

Alternatively, you can overwrite CSS variables for the light & dark theme separately by passing the following object type:

type LightAndDarkThemes = {
  light: Theme;
  dark: Theme;
};

Forcing Light/Dark Mode

By passing "light" or "dark" to the theme prop instead of a Theme object, you can also force BlockNote to always use the light or dark theme.

If you want to set more complex styles on the editor, see Overriding CSS.