KendoReact Dialogs Overview

The KendoReact Dialogs are UI components for prompting user interaction.

The KendoReact Dialogs components are distributed through NPM under the kendo-react-dialogs NPM package.

The Dialogs package is part of KendoReact, a professionally built commercial UI library. To try out this package you need to sign up for a 30-day trial, which gives you access to the full KendoReact library.

Basic Usage

The following example demonstrates the Dialog and Window components in action.

import React from 'react';
import ReactDOM from 'react-dom';
import { Dialog, DialogActionsBar, Window } from '@progress/kendo-react-dialogs';

class App extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            visibleDialog: false,
            visibleWindow: false
        };
    }

    toggleDialog = () => {
        this.setState({
            visibleDialog: !this.state.visibleDialog
        });
    }
    toggleWindow= () => {
        this.setState({
            visibleWindow: !this.state.visibleWindow
        });
    }

    render() {
        return (
            <div>
                {(!this.state.visibleDialog && !this.state.visibleWindow) && (
                    <span>
                        <button className="k-button" onClick={this.toggleDialog}>Open Dialog</button>
                        <button className="k-button" onClick={this.toggleWindow}>Open Window</button>
                    </span>) }
                {this.state.visibleDialog && <Dialog title={"Please confirm"} onClose={this.toggleDialog}>
                    <p style={{ margin: "25px", textAlign: "center" }}>Are you sure you want to continue?</p>
                    <DialogActionsBar>
                        <button className="k-button" onClick={this.toggleDialog}>No</button>
                        <button className="k-button" onClick={this.toggleDialog}>Yes</button>
                    </DialogActionsBar>
                </Dialog>}
                {this.state.visibleWindow && <Window title={"Status"} onClose={this.toggleWindow}>
                    Additional info
                </Window>}
            </div>
        );
    }
}
ReactDOM.render(
    <App />,
    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-dialogs
  2. Once installed, import the package module.

    // ES2015 module syntax
    import { Dialog, Window } from '@progress/kendo-react-dialogs';
    // CommonJS format
    const { Dialog, Window } = require('@progress/kendo-react-dialogs');
  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 Dialogs package requires the following peer dependencies that have to be installed by your application:

  • react 16.8.2*
  • react-dom