Documentation

Numbered list

Number steps and other items in sequence.

Try it

Select both paragraphs and click Numbered list. The result is an <ol> with two <li> items. Select the list and toggle it again to turn its items into paragraphs.

Live example
Example result

Add it to your editor

Enable OrderedList and connect a button to toggleOrderedList. Choose this for steps where order carries meaning.

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

export function OrderedListEditor() {
  const editor = useEditor({
    extensions: [OrderedList],
    initialValue: "<p>Install Yurich</p><p>Give the Bold button a home</p>",
  });
  const active = useIsActive(editor, 'toggleOrderedList');

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

Behavior to account for

With the caret in one item, the command operates on that item. Removing or changing a middle item can split the surrounding list.

Features