# Rendering One of the best parts of Slate is that it's built with React, so it fits right into your existing application. It doesn't re-invent its own view layer that you have to learn. It tries to keep everything as React-y as possible. To that end, Slate gives you control over the rendering behavior of every node and mark in your document, any placeholders you want to render, and even the top-level editor itself. You can define these behaviors by passing `props` into the editor, or you can define them in Slate plugins. ## Nodes & Marks Using custom components for the nodes and marks is the most common rendering need. Slate makes this easy to do, you just define a `renderNode` function. The function is called with the node's props, including `props.node` which is the node itself. You can use these to determine what to render. For example, you can render nodes using simple HTML elements: ```js function renderNode(props) { const { node, attributes, children } = props switch (node.type) { case 'paragraph': return

{children}

case 'quote': return
{children}
case 'image': { const src = node.data.get('src') return } } } ``` > 🤖 Be sure to mix in `props.attributes` and render `props.children` in your node components! The attributes are required for utilities like Slate's `findDOMNode`, and the children are the actual text content of your nodes. You don't have to use simple HTML elements, you can use your own custom React components too: ```js function renderNode(props) { switch (props.node.type) { case 'paragraph': case 'quote': ... } } ``` And you can just as easily put that `renderNode` logic into a plugin, and pass that plugin into your editor instead: ```js function SomeRenderingPlugin() { return { renderNode(props) { ... } } } const plugins = [ SomeRenderingPlugin(), ... ] ``` Marks work the same way, except they invoke the `renderMark` function. Like so: ```js function renderMark(props) { const { children, mark, attributes } = props switch (mark.type) { case 'bold': return {children} case 'italic': return {children} case 'code': return {children} case 'underline': return {children} case 'strikethrough': return {children} } } ``` Be sure to mix `props.attributes` in your `renderMark`. `attributes` provides `data-*` dom attributes for spell-check in non-IE browsers. That way, if you happen to have a global stylesheet that defines `strong`, `em`, etc. styles then your editor's content will already be formatted! > 🤖 Be aware though that marks aren't guaranteed to be "contiguous". Which means even though a **word** is bolded, it's not guaranteed to render as a single `` element. If some of its characters are also italic, it might be split up into multiple elements—one `wo` and one `rd`. ## Placeholders By default Slate will render a placeholder for you which mimics the native DOM `placeholder` attribute of `` and `