# Block Type Menu ## Example ```svelte {#if $editor} {/if} ``` ## Documentation ## Usage `BlockTypeMenu` renders a row of block type buttons that reflect the current selection. Click a button to toggle between paragraph, headings, lists, and more. ```svelte {#if $editor} {/if} ``` Default items include Paragraph, Heading 1–3, Blockquote, Code Block, Bullet List, and Ordered List. Only items with registered extensions are shown. ## Custom items Pass `items` to customize the available block types. ```svelte ``` ## How it works `BlockTypeMenu` listens to editor transactions and tracks which items are active. The active item is highlighted with an accent color. Paragraph is only highlighted when it's the only active item — so it doesn't show as active alongside a heading or list. ## API Reference ### BlockTypeMenu A row of block type buttons that reflect the current selection. Only shows items for registered extensions. | Prop | Type | Default | Description | |------|------|---------|-------------| | editor | `Readable` | `-` | The editor store. (required, bindable) | | items | `BlockTypeItem[]` | `-` | Custom block type items. Defaults to Paragraph, Heading 1–3, Blockquote, Code Block, Bullet List, Ordered List. | | class | `string` | `-` | CSS classes for the container. | ### BlockTypeItem The data shape for block type items. | Prop | Type | Default | Description | |------|------|---------|-------------| | id | `string` | `-` | Unique identifier. (required) | | label | `string` | `-` | Display label for the button. (required) | | isActive | `(editor: Editor) => boolean` | `-` | Returns whether this block type is currently active. (required) | | command | `(editor: Editor) => void` | `-` | Called when the button is clicked. (required) |