> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/ueberdosis/tiptap/llms.txt
> Use this file to discover all available pages before exploring further.

# OrderedList

> Create ordered numbered lists with nested support.

The OrderedList extension allows you to create ordered numbered lists. It requires the ListItem extension to function properly and supports custom start numbers.

## Installation

<CodeGroup>
  ```bash npm theme={null}
  npm install @tiptap/extension-ordered-list @tiptap/extension-list-item
  ```

  ```bash yarn theme={null}
  yarn add @tiptap/extension-ordered-list @tiptap/extension-list-item
  ```

  ```bash pnpm theme={null}
  pnpm add @tiptap/extension-ordered-list @tiptap/extension-list-item
  ```
</CodeGroup>

## Usage

The OrderedList extension is included in the StarterKit by default:

```typescript theme={null}
import { Editor } from '@tiptap/core'
import StarterKit from '@tiptap/starter-kit'

const editor = new Editor({
  extensions: [StarterKit],
})
```

To use it standalone:

```typescript theme={null}
import { Editor } from '@tiptap/core'
import Document from '@tiptap/extension-document'
import OrderedList from '@tiptap/extension-ordered-list'
import ListItem from '@tiptap/extension-list-item'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'

const editor = new Editor({
  extensions: [
    Document,
    Paragraph,
    Text,
    OrderedList,
    ListItem,
  ],
})
```

## Configuration

### itemTypeName

The node name for list items.

<ParamField path="itemTypeName" type="string" default="'listItem'">
  Specifies which node type to use for list items.

  ```typescript theme={null}
  OrderedList.configure({
    itemTypeName: 'listItem',
  })
  ```
</ParamField>

### HTMLAttributes

Custom HTML attributes to add to the ordered list element.

<ParamField path="HTMLAttributes" type="Record<string, any>" default="{}">
  Custom HTML attributes that should be added to the rendered HTML tag.

  ```typescript theme={null}
  OrderedList.configure({
    HTMLAttributes: {
      class: 'my-ordered-list',
    },
  })
  ```
</ParamField>

### keepMarks

Keep marks when splitting the list.

<ParamField path="keepMarks" type="boolean" default="false">
  Whether to preserve text marks when creating new list items.

  ```typescript theme={null}
  OrderedList.configure({
    keepMarks: true,
  })
  ```
</ParamField>

### keepAttributes

Keep attributes when splitting the list.

<ParamField path="keepAttributes" type="boolean" default="false">
  Whether to preserve attributes when creating new list items.

  ```typescript theme={null}
  OrderedList.configure({
    keepAttributes: true,
  })
  ```
</ParamField>

## Attributes

The OrderedList node supports the following attributes:

### start

The starting number for the list.

```typescript theme={null}
editor.commands.insertContent({
  type: 'orderedList',
  attrs: { start: 5 },
  content: [
    // list items...
  ],
})
```

### type

The list marker type (e.g., '1', 'a', 'A', 'i', 'I').

```typescript theme={null}
editor.commands.insertContent({
  type: 'orderedList',
  attrs: { type: 'a' },
  content: [
    // list items...
  ],
})
```

## Commands

### toggleOrderedList

Toggles an ordered list. If the current node is already an ordered list, it converts it to paragraphs.

```typescript theme={null}
editor.commands.toggleOrderedList()
```

## Keyboard Shortcuts

* **Mod-Shift-7**: Toggle ordered list

## Input Rules

The OrderedList extension supports Markdown-style input rules:

* Type `1.` followed by a space to create an ordered list
* Type any number followed by `.` and a space (e.g., `5.`) to create a list starting at that number

## Related Extensions

* [ListItem](/extensions/nodes/list-item) - Required for ordered lists
* [BulletList](/extensions/nodes/bullet-list) - For unordered lists

## Source Code

View the source code on GitHub:

[packages/extension-list/src/ordered-list/ordered-list.ts](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-list/src/ordered-list/ordered-list.ts)
