All docs
V19.1
19.2 (CTP)
19.1
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
17.1
The page you are viewing does not exist in version 17.1. This link will take you to the root page.
16.2
The page you are viewing does not exist in version 16.2. This link will take you to the root page.

DropDownButton

The DropDownButton is a button that opens a drop-down menu.

Export: default
DropDownButton interactive configuration
Copy Code
Copy to Codepen
import DropDownButton from "devextreme/ui/drop_down_button";

new DropDownButton(container, {
});

                    
Type:

Object

Configuration

This section describes options that configure the DropDownButton widget's contents, behavior, and appearance.

Name Description
accessKey

Specifies the shortcut key that sets focus on the widget.

activeStateEnabled

Specifies whether or not the widget changes its state when interacting with a user.

dataSource

Provides data for the drop-down menu.

deferRendering

Specifies whether to wait until the drop-down menu is opened the first time to render its content.

disabled

Specifies whether the widget responds to user interaction.

displayExpr

Specifies the data field whose values should be displayed in the drop-down menu.

dropDownContentTemplate

Specifies custom content for the drop-down field.

dropDownOptions

Configures the drop-down field.

elementAttr

Specifies the attributes to be attached to the widget's root element.

focusStateEnabled

Specifies whether users can use keyboard to focus the widget.

height

Specifies the widget's height.

hint

Specifies text for a hint that appears when a user pauses on the widget.

hoverStateEnabled

Specifies whether the widget changes its state when a user hovers the mouse pointer over it.

icon

Specifies the button's icon.

items

Provides drop-down menu items.

itemTemplate

Specifies a custom template for drop-down menu items.

keyExpr

Specifies which data field provides keys used to distinguish between the selected drop-down menu items.

noDataText

Specifies text or HTML markup displayed in the drop-down menu when it does not contain any items.

onButtonClick

A function that is executed when the button is clicked or tapped. If splitButton is true, this function is executed for the action button only.

onContentReady

A function that is executed when the widget's content is ready and each time the content is changed.

onDisposing

A function that is executed before the widget is disposed of.

onInitialized

A function used in JavaScript frameworks to save the widget instance.

onItemClick

A function that is executed when a drop-down menu item is clicked.

onOptionChanged

A function that is executed after a widget option is changed.

onSelectionChanged

A function that is executed when an item is selected or selection is canceled. In effect when useSelectMode is true.

opened

Specifies whether the drop-down menu is opened.

rtlEnabled

Switches the widget to a right-to-left representation.

selectedItem

Contains the selected item's data. Available when useSelectMode is true.

selectedItemKey

Contains the selected item's key and allows you to specify the initially selected item. Applies when useSelectMode is true.

showArrowIcon

Specifies whether the arrow icon should be displayed.

splitButton

Specifies whether to split the button in two: one executes an action, the other opens and closes the drop-down menu.

stylingMode

Specifies how the button is styled.

tabIndex

Specifies the number of the element when the Tab key is used for navigating.

text

Specifies the button's text. Applies only if useSelectMode is false.

useSelectMode

Specifies whether the widget stores the selected drop-down menu item.

visible

Specifies whether the widget is visible.

width

Specifies the widget's width.

See Also

Methods

This section describes methods that control the DropDownButton widget.

Name Description
beginUpdate()

Prevents the widget from refreshing until the endUpdate() method is called.

close()

Closes the drop-down menu.

defaultOptions(rule)

Specifies the device-dependent default configuration options for this component.

dispose()

Disposes of all the resources allocated to the DropDownButton instance.

element()

Gets the root widget element.

endUpdate()

Refreshes the widget after a call of the beginUpdate() method.

focus()

Sets focus on the widget.

getDataSource()

Gets the DataSource instance.

getInstance(element)

Gets the instance of a widget found using its DOM node.

instance()

Gets the widget's instance. Use it to access other methods of the widget.

off(eventName)

Detaches all event handlers from a single event.

off(eventName, eventHandler)

Detaches a particular event handler from a single event.

on(eventName, eventHandler)

Subscribes to an event.

on(events)

Subscribes to events.

open()

Opens the drop-down menu.

option()

Gets all widget options.

option(optionName)

Gets the value of a single option.

option(optionName, optionValue)

Updates the value of a single option.

option(options)

Updates the values of several options.

registerKeyHandler(key, handler)

Registers a handler to be executed when a user presses a specific key.

repaint()

Repaints the widget without reloading data. Call it to update the widget's markup.

toggle()

Opens or closes the drop-down menu, reversing the current state.

toggle(visibility)

Opens or closes the drop-down menu, depending on the argument.

See Also

Events

This section describes events that the DropDownButton widget raises.

Name Description
buttonClick

Raised when the button is clicked.

contentReady

Raised when the widget's content is ready.

disposing

Raised before the widget is disposed of.

initialized

Raised only once, after the widget is initialized.

itemClick

Raised when an item in the drop-down filed is clicked.

optionChanged

Raised after a widget option is changed.

selectionChanged

Raised when an item is selected or selection is canceled.

See Also

Default Item Template

This section describes object fields that can be used in the default item template.

Type:

Object