DevExtreme React - Customize the Drop-Down Menu

On desktops and iOS devices, the drop-down menu is the Popover widget; on other devices, it is the Popup widget. To use the Popup on all devices, assign false to the usePopover option. In this case, you can specify whether to shade the area beneath the Popup and whether the Popup should occupy the full screen.

jQuery
JavaScript
$(function() {
    $("#lookupContainer").dxLookup({
        dataSource: [
            "HD Video Player",
            "SuperHD Video Player",
            "SuperPlasma 50",
            // ...
        ],
        usePopover: false,
        shading: false,
        fullScreen: false
    });
});
Angular
HTML
TypeScript
<dx-lookup
    [dataSource]="lookupDataSource"
    [usePopover]="false"
    [shading]="false"
    [fullScreen]="false">
</dx-lookup>
import { DxLookupModule } from "devextreme-angular";
// ...
export class AppComponent {
    lookupDataSource = [ "HD Video Player", "SuperHD Video Player", "SuperPlasma 50" ];
}
@NgModule({
    imports: [
        // ...
        DxLookupModule
    ],
    // ...
})

To change the size of the drop-down menu and position it against a specific element on your page, specify the popupHeight, popupWidth and position options, respectively. The following configuration of the position option reads as follows: "place my left side at the left side of the "#targetElement".

jQuery
JavaScript
$(function() {
    $("#lookupContainer").dxLookup({
        dataSource: [
            "HD Video Player",
            "SuperHD Video Player",
            "SuperPlasma 50",
            // ...
        ],
        popupHeight: 300,
        popupWidth: 300,
        position: {
            my: "left",
            at: "left",
            of: "#targetElement"
        }
    });
});
Angular
HTML
TypeScript
<img id="targetElement" src="http://here/goes/my.jpg">
<dx-lookup
    [dataSource]="lookupDataSource"
    [popupHeight]="300"
    [popupWidth]="300">
    <dxo-position
        my="left"
        at="left"
        of="#targetElement">
    </dxo-position>
</dx-lookup>
import { DxLookupModule } from "devextreme-angular";
// ...
export class AppComponent {
    lookupDataSource = [ "HD Video Player", "SuperHD Video Player", "SuperPlasma 50" ];
}
@NgModule({
    imports: [
        // ...
        DxLookupModule
    ],
    // ...
})

The drop-down menu can have a title. Use the title option to specify its text, or the titleTemplate option to redesign it completely. For details on implementing templates, see the Customize Item Appearance topic.

jQuery
JavaScript
$(function() {
    $("#lookupContainer").dxLookup({
        dataSource: [
            "HD Video Player",
            "SuperHD Video Player",
            "SuperPlasma 50",
            // ...
        ],
        title: "Products"
        /*
        titleTemplate: function () {
            return $("<div style='color: blue'>Products</div>");
        }
        */
    });
});
Angular
HTML
TypeScript
<dx-lookup
    [dataSource]="lookupDataSource"
    title="Products">
    <!-- titleTemplate="titleTemplate">
        <div *dxTemplate="let title of 'titleTemplate'">
            <div style='color: blue'>Products</div>
        </div> -->
</dx-lookup>
import { DxLookupModule } from "devextreme-angular";
// ...
export class AppComponent {
    lookupDataSource = [ "HD Video Player", "SuperHD Video Player", "SuperPlasma 50" ];
}
@NgModule({
    imports: [
        // ...
        DxLookupModule
    ],
    // ...
})

If you have not specified anything to be displayed in the title, hide it by assigning false to the showPopupTitle option.

See Also