JavaScript/jQuery TagBox - fieldAddons
Specifies tagbox input field addons.
Type:
Default Value: null
Field addons are custom markup containers that you can add to either side of the tagbox input field. The component arranges visual elements in the following order: beforeTemplate, tagbox input, afterTemplate.
jQuery
index.js
$('#tagbox-container').dxtagbox({
fieldAddons: {
beforeTemplate(data, element) {
element.append(
$('<i>').addClass('dx-icon-chevronprev'),
);
},
afterTemplate(data, element) {
element.append(
$('<i>').addClass('dx-icon-chevronnext'),
);
},
},
})Angular
app.component.html
<dx-tagbox ... >
<dxo-tagbox-field-addons
beforeTemplate="beforetagbox"
afterTemplate="aftertagbox"
></dxo-tagbox-field-addons>
<div *dxTemplate="let data of 'beforetagbox'">
<i class="dx-icon-chevronprev"></i>
</div>
<div *dxTemplate="let data of 'aftertagbox'">
<i class="dx-icon-chevronnext"></i>
</div>
</dx-tagbox>Vue
App.vue
<script setup lang="ts">
import { Dxtagbox, DxFieldAddons } from 'devextreme-vue/tagbox';
</script>
<template>
<Dxtagbox ... >
<DxFieldAddons
before-template="beforetagbox"
after-template="aftertagbox"
/>
<template #beforetagbox="{ data }">
<i class="dx-icon-chevronprev"></i>
</template>
<template #after="{ data }">
<i class="dx-icon-chevronnext"></i>
</template>
</Dxtagbox>
</template>React
App.tsx
import { tagbox, FieldAddons } from 'devextreme-react/tagbox';
function beforetagboxRender(data) {
return (
<i class="dx-icon-chevronprev"></i>
);
}
function aftertagboxRender(data) {
return (
<i class="dx-icon-chevronnext"></i>
);
}
function App() {
return (
<tagbox ... >
<FieldAddons
beforeRender={beforetagboxRender}
afterRender={aftertagboxRender}
/>
</tagbox>
);
}