React DropDownButton API

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

import DropDownButton from "devextreme-react/drop-down-button"
Selector: DropDownButton

Configuration

This section describes properties that configure the DropDownButton UI component's contents, behavior, and appearance.

Name Description
accessKey

Specifies the shortcut key that sets focus on the UI component.

activeStateEnabled

Specifies whether the UI component changes its visual state as a result of user interaction.

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. Specifies whether to render the view's content when it is displayed. If false, the content is rendered immediately.

disabled

Specifies whether the UI component responds to user interaction.

displayExpr

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

dropDownContentComponent

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

dropDownContentRender

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

dropDownContentTemplate

Specifies custom content for the drop-down field.

dropDownOptions

Configures the drop-down field.

elementAttr

Specifies the global attributes to be attached to the UI component's container element.

focusStateEnabled

Specifies whether users can use keyboard to focus the UI component.

height

Specifies the UI component's height.

hint

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

hoverStateEnabled

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

icon

Specifies the button's icon.

itemComponent

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

itemRender

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

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 the 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 UI component is rendered and each time the component is repainted.

onDisposing

A function that is executed before the UI component is disposed of.

onInitialized

A function used in JavaScript frameworks to save the UI component instance.

onItemClick

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

onOptionChanged

A function that is executed after a UI component property 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 UI component 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.

useItemTextAsTitle

Specifies whether the DropDownButton uses item's text a title attribute.

useSelectMode

Specifies whether the UI component stores the selected drop-down menu item.

visible

Specifies whether the UI component is visible.

width

Specifies the UI component's width.

wrapItemText

Specifies whether text that exceeds the drop-down list width should be wrapped.

Methods

This section describes methods that control the DropDownButton UI component.

Name Description
beginUpdate()

Postpones rendering that can negatively affect performance until the endUpdate() method is called.

close()

Closes the drop-down menu.

defaultOptions(rule)

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

dispose()

Disposes of all the resources allocated to the DropDownButton instance.

element()

Gets the root UI component element.

endUpdate()

Refreshes the UI component after a call of the beginUpdate() method.

focus()

Sets focus on the UI component.

getDataSource()

Gets the DataSource instance.

getInstance(element)

Gets the instance of a UI component found using its DOM node.

instance()

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

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 UI component properties.

option(optionName)

Gets the value of a single property.

option(optionName, optionValue)

Updates the value of a single property.

option(options)

Updates the values of several properties.

registerKeyHandler(key, handler)

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

repaint()

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

resetOption(optionName)

Resets a property to its default value.

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 UI component raises.

Name Description
buttonClick

Raised when the button is clicked.

contentReady

Raised when the UI component's content is ready.

disposing

Raised before the UI component is disposed of.

initialized

Raised only once, after the UI component is initialized.

itemClick

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

optionChanged

Raised after a UI component property is changed.

selectionChanged

Raised when an item is selected or selection is canceled.

See Also