Skip to main content

Blockquote Plugin

The Blockquote plugin provides styled quote blocks for highlighting quotations, testimonials, and important text excerpts.

Installation

npm install @yoopta/blockquote

Usage

import Blockquote from '@yoopta/blockquote';
import { createYooptaEditor } from '@yoopta/editor';

const plugins = [Blockquote];
const editor = createYooptaEditor({ plugins });

Features

  • Styled quote blocks with left border
  • Keyboard shortcut: >
  • HTML, Markdown, and Email export
  • Supports all text marks (bold, italic, etc.)
  • Supports alignment and depth
  • Automatic border and padding styling

Options

The blockquote plugin is configured with these default options:
{
  type: 'Blockquote',
  options: {
    display: {
      title: 'Blockquote',
      description: 'Capture quote',
    },
    shortcuts: ['>'],
  },
}

Element Type

import type { BlockquoteElement } from '@yoopta/blockquote';

type BlockquoteElement = SlateElement<'blockquote'>;

Commands

The Blockquote plugin exports BlockquoteCommands for programmatic manipulation:
import { BlockquoteCommands } from '@yoopta/blockquote';

// Access via editor.commands
editor.commands.Blockquote.insertBlockquote();
See the Commands API for available methods.

Parsers

HTML

Deserialize: Converts <blockquote> tags to blockquote blocks Serialize: Outputs blockquote with left border styling
<blockquote 
  data-meta-align="left" 
  data-meta-depth="0" 
  style="
    margin-left: 0px; 
    text-align: left; 
    border-left: 3px solid; 
    color: #292929; 
    padding: 2px 14px; 
    margin-top: 8px;
  ">
  Quote text content
</blockquote>

Markdown

> Quote text content

Email

Wraps content in a table structure for email client compatibility:
<table style="width:100%;">
  <tbody style="width:100%;">
    <tr>
      <td>
        <blockquote 
          data-meta-align="left" 
          data-meta-depth="0" 
          style="
            line-height: 1.75rem;
            margin: 8px 0 0; 
            border-color: #e5e7eb;
            border-left: 3px solid; 
            color: #292929; 
            padding: 2px 14px; 
            margin-top: 8px;
          ">
          Quote text content
        </blockquote>
      </td>
    </tr>
  </tbody>
</table>

Examples

Basic Usage

import YooptaEditor, { createYooptaEditor } from '@yoopta/editor';
import Blockquote from '@yoopta/blockquote';
import Paragraph from '@yoopta/paragraph';

function Editor() {
  const editor = useMemo(() => 
    createYooptaEditor({ 
      plugins: [Paragraph, Blockquote] 
    }), 
    []
  );

  return <YooptaEditor editor={editor} />;
}

Programmatic Insertion

import { Blocks } from '@yoopta/editor';
import { generateId } from '@yoopta/editor';

// Insert a blockquote
Blocks.insertBlock(editor, {
  type: 'Blockquote',
  value: [
    {
      id: generateId(),
      type: 'blockquote',
      children: [
        { text: 'The only way to do great work is to love what you do.' },
      ],
    },
  ],
});

With Formatting

// Create blockquote with bold text
const blockquoteElement = editor.y('blockquote', {
  children: [
    editor.y.text('"'),
    editor.y.text('Innovation distinguishes between a leader and a follower.', 
      { bold: true }
    ),
    editor.y.text('" - Steve Jobs', { italic: true }),
  ],
});

Blocks.insertBlock(editor, {
  type: 'Blockquote',
  value: [blockquoteElement],
});

Using Keyboard Shortcut

Type > at the start of an empty paragraph, then press Space:
> [Space] → Converts to blockquote

Converting Existing Block

import { Blocks } from '@yoopta/editor';

// Toggle a paragraph to blockquote (preserves content)
Blocks.toggleBlock(editor, {
  blockId: 'existing-block-id',
  type: 'Blockquote',
});

Styling

The blockquote automatically includes:
  • Left Border: 3px solid border on the left
  • Padding: 2px vertical, 14px horizontal
  • Color: Dark gray text (#292929)
  • Margin: 8px top margin for spacing
These styles are applied during HTML and Email serialization.

Use Cases

  • Customer testimonials
  • Pull quotes in articles
  • Citing external sources
  • Highlighting important statements
  • Code review comments
  • Interview responses

Build docs developers (and LLMs) love