tiptap/docs/api/nodes/bullet-list.md

64 lines
1.7 KiB
Markdown
Raw Normal View History

---
description: Everything looks more serious with a few bullet points.
2021-10-15 03:20:21 +08:00
icon: list-unordered
---
2020-08-19 03:39:41 +08:00
# BulletList
2021-01-25 17:35:52 +08:00
[![Version](https://img.shields.io/npm/v/@tiptap/extension-bullet-list.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-bullet-list)
[![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-bullet-list.svg)](https://npmcharts.com/compare/@tiptap/extension-bullet-list?minimal=true)
2020-11-03 23:13:13 +08:00
This extension enables you to use bullet lists in the editor. They are rendered as `<ul>` HTML tags.
2020-08-19 03:39:41 +08:00
2020-09-23 18:03:03 +08:00
Type <code>*&nbsp;</code>, <code>-&nbsp;</code> or <code>+&nbsp;</code> at the beginning of a new line and it will magically transform to a bullet list.
2020-09-15 23:26:42 +08:00
2020-09-23 18:03:03 +08:00
## Installation
```bash
2020-09-23 18:03:03 +08:00
npm install @tiptap/extension-bullet-list @tiptap/extension-list-item
```
2021-02-12 22:02:40 +08:00
This extension requires the [`ListItem`](/api/nodes/list-item) node.
2020-09-23 18:03:03 +08:00
## Settings
### HTMLAttributes
Custom HTML attributes that should be added to the rendered HTML tag.
```js
BulletList.configure({
HTMLAttributes: {
class: 'my-custom-class',
},
})
```
2020-08-19 03:39:41 +08:00
2021-12-11 07:13:24 +08:00
### itemTypeName
Specify the list item name.
Default: `'listItem'`
```js
BulletList.configure({
itemTypeName: 'listItem',
})
```
2020-08-20 21:33:16 +08:00
## Commands
2021-10-02 06:14:44 +08:00
### toggleBulletList()
Toggles a bullet list.
```js
editor.commands.toggleBulletList()
```
2020-08-19 03:39:41 +08:00
## Keyboard shortcuts
| Command | Windows/Linux | macOS |
| ---------------- | ------------------------------- | --------------------------- |
| toggleBulletList | `Control`&nbsp;`Shift`&nbsp;`8` | `Cmd`&nbsp;`Shift`&nbsp;`8` |
2020-08-19 03:39:41 +08:00
2020-09-21 22:59:28 +08:00
## Source code
2021-04-21 21:31:11 +08:00
[packages/extension-bullet-list/](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-bullet-list/)
2020-08-19 03:39:41 +08:00
## Usage
2021-10-19 00:01:47 +08:00
https://embed.tiptap.dev/preview/Nodes/BulletList