Popup Overview

The KendoReact Popup component positions a piece of content next to a specific anchor component.

Basic Usage

The following example demonstrates the Popup in action.

<style>
  .popup-content {
    padding: 30px;
    color: #787878;
    background-color: #fcf7f8;
    border: 1px solid rgba(0,0,0,.05);
  }
</style>
class AppComponent extends React.Component {
       anchor = null;
       constructor(props) {
           super(props);
           this.state = { show: false };
       }

       componentDidMount() {
           this.setState({show: true});
       }

       render() {
           return (
               <div>
                   <button
                       className="k-button"
                       onClick={this.onClick}
                       ref={(button) => {
                           this.anchor = button;
                       }}
                   >
                       {this.state.show ? 'Hide' : 'Show'}
                   </button>
                   <Popup
                       anchor={this.anchor}
                       show={this.state.show}
                       popupClass={'popup-content'}
                   >
                       Popup content.
                   </Popup>
               </div>
           );
       }

       onClick = () => {
           this.setState({ show: !this.state.show });
       }
   }

   ReactDOM.render(
       <AppComponent />,
       document.querySelector('my-app')
   );

Installation

  1. Download and install the package. Use Node.js v5.0.0 or later.

    npm install --save @progress/kendo-react-popup
  2. Once installed, import the package module.

    // ES2015 module syntax
    import { Popup } from '@progress/kendo-react-popup';
    // CommonJS format
    const { Popup } = require('@progress/kendo-react-popup');
  3. You are required to install one of the Kendo UI themes to style your components. For more information on how to add the styles, refer to the article on getting started.

Dependencies

The Popup package requires you to install the following peer dependencies in your application:

  • react
  • react-dom

Functionality and Features

In this article