Text Editor - Underline
Toggle underline formatting on the current selection with the underline command and pressed state.
#Usage
import { TextEditor } from '@primeui/vue-texteditor';<TextEditor.Root v-model="value">
<TextEditor.Toolbar>
<UnderlineButton />
</TextEditor.Toolbar>
<TextEditor.Content />
</TextEditor.Root>Underline underscores a word or phrase for emphasis. A toolbar button toggles the mark on the selection with commands.underline() and reflects pressed state with state.underline, both from useTextEditorContext().
#Command
commands.underline() toggles the mark on the selected text.
<!-- UnderlineButton.vue -->
<script setup lang="ts">
import { useTextEditorContext } from '@primeui/vue-texteditor';
const { commands, state } = useTextEditorContext();
</script>
<template>
<button @click="commands.underline()" :aria-pressed="state.underline">U</button>
</template>#Example
Loading Demo...
#API
commands.underline() and state.underline come from useTextEditorContext(). See Slots and Contexts.