How to customize icon and width in Vue Dropdown Button
21 Aug 20264 minutes to read
Width of the DropDownButton can be customized by setting required width to the dropdown element.
The following UI can be achieved by setting iconPosition as Top, width as 85px and size of the font icon as 40px by adding e-custom class.
<template>
<ejs-dropdownbutton :items='items' iconCss='e-icons e-search' cssClass='e-custom' iconPosition='Top'
content='Find & Select'></ejs-dropdownbutton>
</template>
<script setup>
import { DropDownButtonComponent as EjsDropdownbutton } from "@syncfusion/ej2-vue-splitbuttons";
import { enableRipple } from '@syncfusion/ej2-base';
enableRipple(true);
const items = [
{
text: 'Find'
},
{
text: 'Replace'
},
{
text: 'Go To'
},
{
text: 'Go To Special'
}];
</script>
<style>
@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';
.e-search::before {
content: '\e993';
}
.e-dropdown-btn.e-custom {
width: 85px;
}
.e-dropdown-btn.e-custom .e-search::before {
font-size: 40px;
}
</style><template>
<ejs-dropdownbutton :items='items' iconCss='e-icons e-search' cssClass='e-custom' iconPosition='Top' content='Find & Select'></ejs-dropdownbutton>
</template>
<script>
import { DropDownButtonComponent } from "@syncfusion/ej2-vue-splitbuttons";
import { enableRipple } from '@syncfusion/ej2-base';
enableRipple(true);
export default {
name: "App",
components: {
"ejs-dropdownbutton":DropDownButtonComponent,
},
data () {
return {
items:[
{
text: 'Find'
},
{
text: 'Replace'
},
{
text: 'Go To'
},
{
text: 'Go To Special'
}]
};
}
}
</script>
<style>
@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';
.e-search::before {
content: '\e993';
}
.e-dropdown-btn.e-custom {
width: 85px;
}
.e-dropdown-btn.e-custom .e-search::before {
font-size: 40px;
}
</style>