React Popover - Specify Toolbar Items

The Popover has two toolbars: top and bottom. Items on these toolbars can be plain text or UI components. To configure the items, populate the toolbarItems array with objects. Each object configures an individual toolbar item. For example, the following code adds two toolbar items to the Popover: one is plain text, another is the Button UI component. They both occupy the top toolbar, because their toolbar property assumes its default value.

  • import React from 'react';
  • import 'devextreme/dist/css/dx.light.css';
  •  
  • import { Popover, ToolbarItem } from 'devextreme-react/popover';
  •  
  • const buttonOptions = {
  • text: 'Refresh',
  • onClick: function() {
  • // ...
  • }
  • };
  •  
  • const renderContent = () => {
  • return (
  • <p>Popover content</p>
  • );
  • }
  •  
  • class App extends React.Component {
  • render() {
  • return (
  • <div>
  • <img id="image" src="https://url/to/an/image" />
  • <Popover
  • width={200}
  • target="#image"
  • showEvent="dxhoverstart"
  • hideEvent="dxhoverend"
  • contentRender={renderContent}>
  • <ToolbarItem
  • text="Title"
  • location="before"
  • />
  • <ToolbarItem
  • options={buttonOptions}
  • widget="dxButton"
  • location="after"
  • />
  • </Popover>
  • </div>
  • );
  • }
  • }
  •  
  • export default App;
See Also