React SelectBox - Customize Item Appearance

To customize the appearance of items in the SelectBox drop-down menu, configure itemRender/itemComponent (customize all items) or items[].render/component (customize individual items).

App.tsx
  • import React from 'react';
  • import 'devextreme/dist/css/dx.fluent.blue.light.css';
  •  
  • import { SelectBox } from 'devextreme-react/select-box';
  •  
  • function itemRender(data) {
  • return (
  • <img src={data.imgSrc} />
  • );
  • }
  •  
  • function App() {
  • return (
  • <SelectBox ...
  • itemRender={itemRender}
  • />
  • );
  • }

You can also customize the SelectBox input field. Configure fieldAddons.beforeRender/beforeComponent and fieldAddons.afterRender/afterComponent to display custom markup to the left/right of the component input:

App.tsx
  • import React from 'react';
  • import 'devextreme/dist/css/dx.fluent.blue.light.css';
  •  
  • import { SelectBox, FieldAddons } from 'devextreme-react/select-box';
  •  
  • function beforeRender(data) {
  • return (
  • <img src={data.imgSrc} />
  • );
  • }
  •  
  • function App() {
  • return (
  • <SelectBox ... >
  • <FieldAddons
  • beforeRender={beforeRender}
  • />
  • </SelectBox>
  • );
  • }
See Also