JavaScript/jQuery ColorBox - fieldAddons
Specifies ColorBox input field addons.
Type:
Default Value: null
Field addons are custom markup containers that you can add to either side of the ColorBox input field. The component arranges visual elements in the following order: beforeTemplate, ColorBox input, afterTemplate.
jQuery
index.js
$('#color-box-container').dxColorBox({
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-color-box ... >
<dxo-color-box-field-addons
beforeTemplate="beforeColorBox"
afterTemplate="afterColorBox"
></dxo-color-box-field-addons>
<div *dxTemplate="let data of 'beforeColorBox'">
<i class="dx-icon-chevronprev"></i>
</div>
<div *dxTemplate="let data of 'afterColorBox'">
<i class="dx-icon-chevronnext"></i>
</div>
</dx-color-box>Vue
App.vue
<template>
<DxColorBox ... >
<DxFieldAddons
before-template="beforeColorBox"
after-template="afterColorBox"
/>
<template #beforeColorBox="{ data }">
<i class="dx-icon-chevronprev"></i>
</template>
<template #after="{ data }">
<i class="dx-icon-chevronnext"></i>
</template>
</DxColorBox>
</template>
<script setup lang="ts">
import { DxColorBox, DxFieldAddons } from 'devextreme-vue/color-box';
</script>React
App.tsx
import { ColorBox, FieldAddons } from 'devextreme-react/color-box';
function beforeColorBoxRender(data) {
return (
<i class="dx-icon-chevronprev"></i>
);
}
function afterColorBoxRender(data) {
return (
<i class="dx-icon-chevronnext"></i>
);
}
function App() {
return (
<ColorBox ... >
<FieldAddons
beforeRender={beforeColorBoxRender}
afterRender={afterColorBoxRender}
/>
</ColorBox>
);
}
Feel free to share topic-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Thank you for the feedback!
If you have technical questions, please create a support ticket in the DevExpress Support Center.