Add KendoReact to an Existing React Project

In this article, you’ll learn how to add KendoReact components to an already existing React project. To acquire the required knowledge, you will practice with the React Editor component.

All KendoReact packages are distributed through npm and offer a similar installation experience. The dependencies needed for the installation of each component package are listed in a dedicated Getting Started article on the component package level, for example, Getting Started with the React Editor.

Install the Editor Package

For example, to use the React Editor component, part of KendoReact, start with the installation of the KendoReact Editor npm package and its [dependencies]({%slug getstarted_editor %}#toc-dependencies). Use Node.js v14.0.0 or later.

npm install --save @progress/kendo-react-editor @progress/kendo-react-intl @progress/kendo-react-buttons @progress/kendo-react-dropdowns @progress/kendo-react-dialogs @progress/kendo-react-inputs @progress/kendo-react-layout @progress/kendo-react-popup @progress/kendo-react-pdf @progress/kendo-react-progressbars @progress/kendo-drawing @progress/kendo-licensing @progress/kendo-svg-icons

Import the Editor Component

After installing the needed packages, you can import the Editor component in the React App.

For the purpose of this example, you will use the Editor component in the src/App.js file. To use the already installed Editor package, import the Editor and EditorTools components in this file. The EditorTools provide different built-in user-interface tools that help users modify the content.

// ES2015 module syntax
import { Editor, EditorTools } from '@progress/kendo-react-editor';
// CommonJS format
const { Editor, EditorTools } = require('@progress/kendo-react-editor');

Use the Editor Component

  1. Define the editor tools that you want to enable.

       const {
       } = EditorTools;
  2. Add the component's markup to the src/App.js file in your project and set the tools. Optionally, configure the height of the Editor component.

       return <Editor tools={[[Bold, Italic, Underline], [Undo, Redo], [Link, Unlink], [AlignLeft, AlignCenter, AlignRight], [OrderedList, UnorderedList, Indent, Outdent]]} contentStyle={{
       height: 320
       }} defaultContent={content} />;
  3. To style the Editor, install and import the Default theme, which is one of the three beautiful themes for KendoReact.

    3.1. Install the Default theme package.

    npm install --save @progress/kendo-theme-default

    3.2. Import the CSS file from the package in src/App.js. Add this import before your existing App.css import.

    import '@progress/kendo-theme-default/dist/all.css';
  4. Build and run the application by typing the following command in the root folder of your project:

    npm start
  5. Navigate to http://localhost:3000 to see the KendoReact Editor component on the page.

Activating Your License Key

Using any of the UI components in the KendoReact library requires either a commercial license key or an active trial license key.

Since version 5.16.0 (26 July 2023) of KendoReact, a missing license causes a watermark to appear over selected components. For more information, see the Invalid License section.

To experience the full potential of the KendoReact components, follow the license activation instructions and hide the invalid/not-activated license messages and attributes. You can skip this step if your application already contains a KendoReact license file.

Additional Resources