Element
API reference for elements in Slate.
Element
objects are a type of node in a Slate document that contain other element nodes or text nodes. They can be either "blocks" or "inlines" depending on the Slate editor's configuration.
Element
Find the corresponding documentation in the Slate docs.
isElementType
Checks if a value implements the TElement
interface and has elementKey with selected value.
Parameters
The value to check.
The value to match against.
The key to check. Defaults to 'type'.
Returns
Returns true
if the value is an element with matching type.
isAncestor
Checks if a value implements the 'Ancestor' interface.
Parameters
The value to check.
Returns
Returns true
if the value is an ancestor node.
isElement
Checks if a value implements the TElement
interface.
Parameters
The value to check.
Returns
Returns true
if the value is an element.
isElementList
Checks if a value is an array of TElement
objects.
Parameters
The value to check.
Returns
Returns true
if the value is an array of elements.
isElementProps
Checks if a set of props is a partial of TElement.
Parameters
The props to check.
Returns
Returns true
if the props match element properties.
matches
Checks if an element matches set of properties.
Parameters
The element to check.
The properties to match against.
Returns
Returns true
if the element matches all properties (excluding children).
Types
TElement
The base element type.
Attributes
children: Descendant[]
- Array of child nodestype: string
- Element type identifier[key: string]: unknown
- Additional custom properties
Properties:
Element
The concrete element type (same as TElement).
ElementOrTextOf
A union type representing either an element or text node of an editor.
Attributes
Generic type for elements or text nodes from a specific editor type.
ElementOrTextIn
A union type representing either an element or text node in a value.
Attributes
Generic type for elements or text nodes from a specific value type.
ElementOf
A utility type to get all the element nodes type from a root node.
Attributes
Generic type that extracts element types from a node type.
ElementIn
A utility type to get element types from a value type.
Attributes
Generic type that extracts element types from a value type.