# Formatting Toggles ## Example ```svelte {#if $editor}
{/if}
``` ## Documentation ## Usage Individual formatting toggle buttons for bold, italic, underline, and strikethrough. Drop them into any toolbar or bubble menu. ```svelte {#if $editor}
{/if} ``` ## Reading state Each toggle exposes a bindable state prop (`isBold`, `isItalic`, `isUnderline`, `isStrikethrough`) that reactively tracks whether the mark is active at the current selection. ```svelte

Bold is {isBold ? 'on' : 'off'}

``` ## In a bubble menu These toggles are what `FormattingBubbleMenu` uses internally. You can also use them inside a custom `BubbleMenu`. ```svelte ``` ## How it works Each toggle uses `@foxui/core`'s `Toggle` component and listens to editor transactions to stay in sync. Clicking a toggle calls the corresponding tiptap chain command (e.g. `toggleBold()`). ## API Reference ### BoldToggle A toggle button for bold formatting. Syncs with the current editor selection. | Prop | Type | Default | Description | |------|------|---------|-------------| | editor | `Readable` | `-` | The editor store. (required, bindable) | | isBold | `boolean` | `false` | Whether bold is active at the current selection. (bindable) | ### ItalicToggle A toggle button for italic formatting. Syncs with the current editor selection. | Prop | Type | Default | Description | |------|------|---------|-------------| | editor | `Readable` | `-` | The editor store. (required, bindable) | | isItalic | `boolean` | `false` | Whether italic is active at the current selection. (bindable) | ### UnderlineToggle A toggle button for underline formatting. Syncs with the current editor selection. | Prop | Type | Default | Description | |------|------|---------|-------------| | editor | `Readable` | `-` | The editor store. (required, bindable) | | isUnderline | `boolean` | `false` | Whether underline is active at the current selection. (bindable) | ### StrikethroughToggle A toggle button for strikethrough formatting. Syncs with the current editor selection. | Prop | Type | Default | Description | |------|------|---------|-------------| | editor | `Readable` | `-` | The editor store. (required, bindable) | | isStrikethrough | `boolean` | `false` | Whether strikethrough is active at the current selection. (bindable) |