All Components

This website hosts native Kendo UI components, built from the ground up with the ultimate performance in mind, intended to be used in the React ecosystem.

Styling Overview

Kendo UI for React provides themes that you can used to style your application.

Currently, the suite ships the following themes:

Installation

  1. To start using a theme, install its package through NPM. For example, to install the Default theme, run the following command:

    npm install --save @progress/kendo-theme-default
  2. After the theme package is installed, reference it in your project.

Including Themes in Your Project

Each theme package provides the two ways for including the theme in your project:

Using Precompiled CSS

Each Kendo UI theme includes a precompiled dist/all.css CSS file that contains the styles for all Kendo UI components. To use dist/all.css, reference it in the App.jsx file of the application.

import '@progress/kendo-theme-default/dist/all.css';

class App extends React.Component {
    render() {
        return (
            <h1>My First Kendo UI React App</h1>
            <Button primary={true}>
                My Kendo UI Button
            </Button>
        )
    }
}

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

While using the precompiled CSS file is faster than compiling the theme from the source code, the approach has the following drawbacks:

  • It includes CSS for components that are not used in the application.
  • It does not provide options for theme customization through SCSS variables (which is possible when you build the theme from the source code) because the theme is already compiled.

Customizing Themes

Each Kendo UI theme package includes the source files of the theme which provides options for you to modify and rebuild the theme as part of your build process. For example, you can change the theme colors, remove the CSS of unused components, or use specific theme colors to style your application. The theme source files are located in the scss folder of the theme package.

For a list of variables that can be modified in a theme, refer to the article on each theme customization:

To build a custom theme by using the theme variables, apply either of the following approaches:

For a visual preview of the theme for all components and versatile color swatches, use the ThemeBuilder application which provides an interface for theme customization.

Using the Build Process of the Application

Create React App does not support the compilation of SCSS files out of the box. For more information, refer to the Adding a CSS Preprocessor article.

// styles.scss
@import "~@progress/kendo-theme-default/scss/all";

With this setup, you can customize theme variables directly in your application. For example, you can change the default accent color from orange to pink with the following lines:

$accent: #ff69b4;

@import "~@progress/kendo-theme-default/scss/all";

The scss/all file adds the styles for all components that are available in the theme. To trim down the size of the generated CSS, import only the source for the components that you use in your application.

// import only the PanelBar and Grid styles
@import "~@progress/kendo-theme-default/scss/panelbar";
@import "~@progress/kendo-theme-default/scss/grid";

Using the Build Process of the Themes

While each Kendo UI theme has a dedicated NPM package (for example, @progress/kendo-theme-default), the source code for all themes is located in the kendo-themes repository which contains a build task that compiles the theme sources to CSS. To customize a theme, modify the source code of the theme and use the build task to produce a CSS file for your application. This approach avoids the need for a setting up a build configuration when you compile SCSS, but may be harder to maintain as the process has to be repeated each time a theme is updated.

To improve the development process, the previous independent GitHub repositories of each theme were merged in the single kendo-themes repository and the individual repositories were archived.

To create a custom theme by modifying the themes source code:

  1. Clone the kendo-themes GitHub repository.
  2. Install the dependencies for all themes with npm install && npx lerna bootstrap.
  3. Customize the theme variables in the packages/<THEME_NAME>/scss/_variables.scss files.
  4. Build the themes with the npm run build command to create the customized version of the themes in the packages/THEME_NAME/dist/all.css file.

    You might want to omit the styles for some components in the CSS output. To include only the styles that you need, run the COMPONENTS='component1,component2' npm run build command. For example, to create a CSS file that includes only the Grid and PanelBar styles, run COMPONENTS='panelbar,grid' npm run build. The command creates the dist/custom.css file which includes only the specified components.

  5. After the build completes, use the compiled CSS.

In this article