# Create a custom block {#block}

Source: [Create a custom block | Create custom extensions for the React editor · Yurich](https://leeyujoo.com/yurich/extensions/block/)

Package: [`yurich`](https://www.npmjs.com/package/yurich)

Package version: `0.1.2`

Use `block()` to format an entire paragraph. Put the caret inside the paragraph and click **Callout**. The paragraph becomes an `<aside>` block.

```tsx
import { block, EditorContent, EditorProvider, useEditor, useIsActive } from 'yurich';

const Callout = block({ name: 'callout', tag: 'aside' });

export function CalloutEditor() {
  const editor = useEditor({
    extensions: [Callout],
    initialValue: "<p>The toolbar is yours to design.</p>",
  });
  const active = useIsActive(editor, 'toggleCallout');

  return (
    <EditorProvider editor={editor}>
      <button
        type="button"
        aria-pressed={active}
        onMouseDown={event => event.preventDefault()}
        onClick={() => editor.execute('toggleCallout')}
      >
        Callout
      </button>
      <EditorContent ariaLabel="Editor" />
    </EditorProvider>
  );
}
```

## Result {#result}

In the HTML returned by `editor.getHTML()`, the whole paragraph is an `<aside>` block.

```html
<aside>The toolbar is yours to design.</aside>
```

Below is the first block in the document returned by `editor.getJSON()`. Its `type` is `callout`, the name registered with `block()`.

```json
{
  "type": "callout",
  "content": [
    { "type": "text", "text": "The toolbar is yours to design." }
  ]
}
```

[Verify an extension](https://leeyujoo.com/yurich/extensions/verify/)
