2016-07-12 17:02:42 -07:00
# `Block`
```js
import { Block } from 'slate'
```
2016-07-12 17:31:45 -07:00
A block node in a Slate [`Document` ](./document.md ). Block nodes implement the [`Node` ](./node.md ) interface.
2016-07-12 17:02:42 -07:00
2016-07-12 17:31:45 -07:00
Block nodes may contain nested block nodes, inline nodes, and text nodes—just like in the DOM. They always contain at least one text node child.
2016-07-12 17:02:42 -07:00
- [Properties ](#properties )
- [`data` ](#data )
- [`isVoid` ](#isvoid )
- [`key` ](#key )
- [`nodes` ](#nodes )
- [`type` ](#type )
- [Computed Properties ](#computed-properties )
- [`kind` ](#kind )
- [`length` ](#length )
- [`text` ](#text )
2016-07-12 17:54:11 -07:00
- [Static Methods ](#static-methods )
2016-07-18 02:30:31 +05:30
- [`Block.create` ](#blockcreate )
- [`Block.createList` ](#blockcreatelist )
2016-07-12 17:02:42 -07:00
- [Node Methods ](#node-methods )
2016-07-12 17:31:45 -07:00
2016-07-12 17:02:42 -07:00
## Properties
```js
Block({
2016-07-12 17:54:11 -07:00
data: Data,
2016-07-12 17:02:42 -07:00
isVoid: Boolean,
key: String,
2016-07-12 17:54:11 -07:00
nodes: Immutable.List< Node > ,
2016-07-12 17:02:42 -07:00
type: String
})
```
### `data`
`Immutable.Map`
2016-07-12 17:31:45 -07:00
Arbitrary data associated with the node. Defaults to an empty `Map` .
2016-07-12 17:02:42 -07:00
### `isVoid`
`Boolean`
Whether the node is a "void" node, meaning that it has no child content (eg. images, videos, etc.). Defaults to `false` .
2016-07-12 17:31:45 -07:00
Note that even though a node may be "void", it will still contain a single, empty [`Text` ](./text.md ) node for consistency across other operations. However, when rendered by Slate that single [`Text` ](./text.md ) node will not be visible.
2016-07-12 17:02:42 -07:00
### `key`
`String`
A unique identifier for the node.
### `nodes`
`Immutable.List`
A list of child nodes. Defaults to a list with a single text node child.
### `type`
`String`
2016-07-12 17:31:45 -07:00
The custom type of the node (eg. `blockquote` or `list-item` ).
2016-07-12 17:02:42 -07:00
## Computed Properties
### `kind`
`String`
2016-07-12 17:31:45 -07:00
An immutable string value of `'block'` for easily separating this node from [`Inline` ](./inline.md ) or [`Text` ](./text.md ) nodes.
2016-07-12 17:02:42 -07:00
### `length`
`Number`
The sum of the lengths of all of the descendant [`Text` ](./text.md ) nodes of this node.
### `text`
`String`
A concatenated string of all of the descendant [`Text` ](./text.md ) nodes of this node.
2016-07-12 17:54:11 -07:00
## Static Methods
### `Block.create`
`Block.create(properties: Object) => Block`
Create a block from a plain Javascript object of `properties` .
### `Block.createList`
`Block.createList(array: Array) => List`
Create a list of block nodes from a plain Javascript `array` .
2016-07-12 17:02:42 -07:00
## Node Methods
2016-07-12 21:08:40 -07:00
Blocks implement the [`Node` ](./node.md ) interface. For information about all of the node methods, see the [`Node` reference ](./node.md ).