Underline a character in a text in Vue Split button component

8 Aug 20232 minutes to read

To underline a particular character in a text, it can be handled in beforeItemRender event by
adding <u> tag in between the text and given as innerHTML in li rendering.

In the following example, C is underlined in the text Copy:

    <ejs-splitbutton :items='items' :beforeItemRender='itemRender'>Paste</ejs-splitbutton>

import Vue from 'vue';
import { SplitButtonPlugin } from "@syncfusion/ej2-vue-splitbuttons";
import { enableRipple } from '@syncfusion/ej2-base';


export default {
    data () {
        return {
                text: 'Cut'
                text: 'Copy'
                text: 'Paste'
    methods: {
        itemRender: function(args) {
            if (args.item.text === 'Copy') {
                //To underline a particular text.
                args.element.innerHTML = '<u>C</u>opy';

@import '../node_modules/@syncfusion/ej2-base/styles/material.css';
@import '../node_modules/@syncfusion/ej2-buttons/styles/material.css';
@import '../node_modules/@syncfusion/ej2-popups/styles/material.css';
@import '../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css';
   margin: 20px 20px 5px 5px;