--- title: "Text Formatting in the Vue 3 Editor" description: "Every Vue 3 formatting control, from headings and fonts to colors, alignment, line height, and change case, is a toolbar keyword you bind through :init." head: - - meta - name: robots content: 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1' - - meta - name: googlebot content: 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1' - - meta - name: bingbot content: 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1' ---
# Text Formatting in the Vue 3 Editor In `@erag/text-editor-vue`, each formatting control is a toolbar keyword in the object you bind to `:init`. The set covers block formats and headings, fonts and sizes, inline styles, colors, alignment, line height, case changes, and clear formatting. Standard commands use `document.execCommand` with Range and Selection APIs, which keeps them in the native undo stack while `v-model` receives the styled HTML. Bulleted, numbered, and checklist controls are described in [lists and indentation](./lists-and-indentation.html). Symbols and emoji are on the [special characters](./special-characters.html) page, and hyperlinks on [links and anchors](./links-and-anchors.html). --- ## Formatting Controls and Toolbar Items Include any of the following formatting keywords in your `init.toolbar` string: ```vue`, `
`, or `` code blocks. | | **Font Family** | `fontfamily` | Select a configured family such as Arial, Georgia, Courier New, Times New Roman, or Verdana. | | **Font Size** | `fontsize` | Select font sizes (e.g. 8pt to 36pt). | | **Line Height** | `lineheight` | Opens one grouped dropdown using the configured `lineHeightFormats`. | | **Bold** | `bold` | Toggles `` / `` bold text formatting (`Ctrl+B` / `Cmd+B`). | | **Italic** | `italic` | Toggles `` / `` italic text formatting (`Ctrl+I` / `Cmd+I`). | | **Underline** | `underline` | Toggles `` underline formatting (`Ctrl+U` / `Cmd+U`). | | **Strikethrough** | `strikethrough` | Toggles `` / `` strikethrough formatting. | | **Superscript** | `superscript` | Toggles `` superscript text (e.g. x2). | | **Subscript** | `subscript` | Toggles `` subscript text (e.g. H2O). | | **Change Case** | `casechange` | Dropdown menu offering **UPPERCASE**, **lowercase**, and **Title Case** conversions. | | **Text Color** | `forecolor` | Color picker dropdown for text foreground color. | | **Background Color** | `backcolor` | Color picker dropdown for text highlight / background fill color. | | **Alignment Group** | `alignment` | One dropdown containing left, center, right, and justify with matching icons. | | **Align Left** | `alignleft` | Aligns text paragraph to the left. | | **Align Center** | `aligncenter` | Centers text paragraph. | | **Align Right** | `alignright` | Aligns text paragraph to the right. | | **Justify** | `alignjustify` | Justifies text across full container width. | | **Remove Formatting** | `removeformat` | Strips inline formatting, styles, and tags from selection. | The Format menubar also provides **Inline code** and **Line height**. The current inline-code action changes the selected block to ``. Line-height choices come from `lineHeightFormats`, are available from both the toolbar and menubar, and are applied as an inline `line-height` style. ```ts const editorConfig: EditorInit = { lineHeightFormats: [ { label: 'Compact', value: '1.2' }, { label: 'Normal', value: '1.5' }, { label: 'Relaxed', value: '2' }, ], }; ``` The grouped `alignment` control is the default toolbar presentation. The individual `alignleft`, `aligncenter`, `alignright`, and `alignjustify` keywords remain available when separate buttons are preferred. Bold, italic, underline, and similar commands can establish the format used for subsequent typing when the caret is collapsed. **Change case** requires an active text selection. **Clear formatting** removes formatting from the selection and resets the active block to a paragraph. The default families are Arial, Book Antiqua, Comic Sans MS, Courier New, Georgia, Helvetica, Impact, Symbol, Tahoma, Terminal, Times New Roman, Trebuchet MS, and Verdana. Default sizes are `8pt`, `10pt`, `12pt`, `14pt`, `18pt`, `24pt`, and `36pt`.