React SelectBox - fieldAddons

Specifies selectbox input field addons.

Selector: FieldAddons
Type:

FieldAddons

Default Value: null

Field addons are custom markup containers that you can add to either side of the selectbox input field. The component arranges visual elements in the following order: beforeTemplate, selectbox input, afterTemplate.

jQuery
index.js
$('#selectbox-container').dxselectbox({
    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-selectbox ... >
    <dxo-selectbox-field-addons
        beforeTemplate="beforeselectbox"
        afterTemplate="afterselectbox"
    ></dxo-selectbox-field-addons>
    <div *dxTemplate="let data of 'beforeselectbox'">
        <i class="dx-icon-chevronprev"></i>
    </div>
    <div *dxTemplate="let data of 'afterselectbox'">
        <i class="dx-icon-chevronnext"></i>
    </div>
</dx-selectbox>
Vue
App.vue
<script setup lang="ts">
import { Dxselectbox, DxFieldAddons } from 'devextreme-vue/selectbox';

</script>

<template>
    <Dxselectbox ... >
        <DxFieldAddons
            before-template="beforeselectbox"
            after-template="afterselectbox"
        />
        <template #beforeselectbox="{ data }">
            <i class="dx-icon-chevronprev"></i>
        </template>
        <template #after="{ data }">
            <i class="dx-icon-chevronnext"></i>
        </template>
    </Dxselectbox>
</template>
React
App.tsx
import { selectbox, FieldAddons } from 'devextreme-react/selectbox';

function beforeselectboxRender(data) {
    return (
        <i class="dx-icon-chevronprev"></i>
    );
}

function afterselectboxRender(data) {
    return (
        <i class="dx-icon-chevronnext"></i>
    );
}

function App() {
    return (
        <selectbox ... >
            <FieldAddons
                beforeRender={beforeselectboxRender}
                afterRender={afterselectboxRender}
            />
        </selectbox>
    );
}

SelectBox Demo

afterComponent

An alias for the afterTemplate property specified in React. Accepts a custom component. Refer to Using a Custom Component for more information.

afterRender

An alias for the afterTemplate property specified in React. Accepts a rendering function. Refer to Using a Rendering Function for more information.

afterTemplate

A custom markup that display content to the right of the input field.

Type:

template

Template Data:

Object

Data of the selected editor item.

beforeComponent

An alias for the beforeTemplate property specified in React. Accepts a custom component. Refer to Using a Custom Component for more information.

beforeRender

An alias for the beforeTemplate property specified in React. Accepts a rendering function. Refer to Using a Rendering Function for more information.

beforeTemplate

A custom markup that displays content to the left of the input field.

Type:

template

Template Data:

Object

Data of the selected editor item.