2021-10-14 06:13:50 +08:00
|
|
|
|
---
|
2021-10-16 04:48:57 +08:00
|
|
|
|
description: Simply does its job. Doesn’t even care if it’s part of a bullet list or an ordered list.
|
|
|
|
|
icon: asterisk
|
2021-10-14 06:13:50 +08:00
|
|
|
|
---
|
|
|
|
|
|
2020-08-19 03:39:41 +08:00
|
|
|
|
# ListItem
|
2021-01-25 17:35:52 +08:00
|
|
|
|
[![Version](https://img.shields.io/npm/v/@tiptap/extension-list-item.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-list-item)
|
|
|
|
|
[![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-list-item.svg)](https://npmcharts.com/compare/@tiptap/extension-list-item?minimal=true)
|
|
|
|
|
|
2020-09-23 18:33:45 +08:00
|
|
|
|
The ListItem extension adds support for the `<li>` HTML tag. It’s used for bullet lists and ordered lists and can’t really be used without them.
|
2020-08-19 03:39:41 +08:00
|
|
|
|
|
2020-09-23 18:33:45 +08:00
|
|
|
|
## Installation
|
2020-09-23 15:52:04 +08:00
|
|
|
|
```bash
|
|
|
|
|
npm install @tiptap/extension-list-item
|
|
|
|
|
```
|
|
|
|
|
|
2021-02-12 22:02:40 +08:00
|
|
|
|
This extension requires the [`BulletList`](/api/nodes/bullet-list) or [`OrderedList`](/api/nodes/ordered-list) node.
|
|
|
|
|
|
2020-09-23 18:03:03 +08:00
|
|
|
|
## Settings
|
2021-10-02 05:27:39 +08:00
|
|
|
|
|
|
|
|
|
### HTMLAttributes
|
|
|
|
|
Custom HTML attributes that should be added to the rendered HTML tag.
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
ListItem.configure({
|
|
|
|
|
HTMLAttributes: {
|
|
|
|
|
class: 'my-custom-class',
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
```
|
2020-09-23 18:33:45 +08:00
|
|
|
|
|
|
|
|
|
## Keyboard shortcuts
|
2021-10-02 04:57:27 +08:00
|
|
|
|
| Command | Windows/Linux | macOS |
|
|
|
|
|
| --------------- | ------------------ | ------------------ |
|
|
|
|
|
| splitListItem() | `Enter` | `Enter` |
|
|
|
|
|
| sinkListItem() | `Tab` | `Tab` |
|
|
|
|
|
| liftListItem() | `Shift` `Tab` | `Shift` `Tab` |
|
2020-09-23 18:33:45 +08:00
|
|
|
|
|
|
|
|
|
## Source code
|
2021-04-21 21:31:11 +08:00
|
|
|
|
[packages/extension-list-item/](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-list-item/)
|
2020-09-23 18:33:45 +08:00
|
|
|
|
|
|
|
|
|
## Usage
|
2021-10-19 00:01:47 +08:00
|
|
|
|
https://embed.tiptap.dev/preview/Nodes/ListItem
|