Ritext
Extensions

Clear Format

Remove all inline formatting from selected text.

The ClearFormat extension adds a button that removes all inline formatting (bold, italic, color, font size, etc.) from the current selection. It also clears block-level formatting by resetting the node type to a paragraph.

Import

import { ClearFormat } from 'ritext/extension/clearformat';

Usage

const extensions = [ClearFormat];

Behavior

Clicking the Clear Format button runs:

  • editor.chain().focus().clearNodes().unsetAllMarks().run()

This removes:

  • All marks (bold, italic, underline, strike, color, background color, font family, font size, etc.)
  • Block-level formatting (headings → paragraph, etc.)

Options

Prop

Type

The Clear Format button has no active state — it always appears in its default style.

On this page