Documentation

Blockquote

Set a passage apart as a quotation.

Try it

Place the caret in the sample paragraph and click Quote. The output changes to <blockquote>I spent longer naming the toolbar than building it.</blockquote>. Toggle again to return to a paragraph.

Live example
Example result

Add it to your editor

Enable Blockquote and call toggleBlockquote to style one or more blocks as a quotation.

import { EditorContent, EditorProvider, Blockquote, useEditor, useIsActive } from 'yurich';

export function BlockquoteEditor() {
  const editor = useEditor({
    extensions: [Blockquote],
    initialValue: "<p>I spent longer naming the toolbar than building it.</p>",
  });
  const active = useIsActive(editor, 'toggleBlockquote');

  return (
    <EditorProvider editor={editor}>
      <button
        type="button"
        aria-pressed={active}
        onMouseDown={event => event.preventDefault()}
        onClick={() => editor.execute('toggleBlockquote')}
      >
        Quote
      </button>
      <EditorContent ariaLabel="Editor" />
    </EditorProvider>
  );
}

Behavior to account for

Yurich is headless, so add your own quote styling to the editable area and rendered content. Applying a quote to a list item removes that item from the list.

Features