Elevation in the Telerik and Kendo UI Default Theme
The elevation system in the Telerik and Kendo UI Default theme enables you to easily define and customize shadows, allowing you to achieve effects like lift and depth and ensuring consistency and adaptability for your design needs.
This article explains how to configure the elevation values specifically in the Telerik and Kendo UI Default theme. To learn how the Telerik and Kendo UI design system implements elevation through elevation levels and shadow layers, see the Elevation Overview article.
Default Configuration
By default, the elevation in the Telerik and Kendo UI Default theme is configured with a set of predefined values, which are structured in the $kendo-elevation
Sass map:
Key | Value |
---|---|
Variable: kendo-elevation | |
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
Description: The global default Elevation map. |
Usage
You can use the $kendo-elevation
map as is or customize it to fit your specific design needs.
To use the predefined values, utilize either of the following approaches:
-
Use the Sass map—Import the theme and apply the desired elevation level to your element:
@use 'sass:map'; // First, import the Default theme. @import "@progress/kendo-theme-default/dist/all.scss"; .my-element { box-shadow: map.get($kendo-elevation, 3); // Then, apply the default level 3 shadow to .my-element. }
-
Use custom CSS properties—Utilize the
k-elevation()
function, which returns a unique CSS variable:// First, import the Default theme. @import "@progress/kendo-theme-default/dist/all.scss"; .my-element { box-shadow: k-elevation(3); // Apply default level 3 shadow to .my-element. }
Customization
Customizing the $kendo-elevation
Sass map allows you to extend the available elevation levels and tailor them to your specific requirements by modifying existing values, creating new values, or removing existing values.
Modifying Existing Values
If most of the default elevation values match your design needs, you don't need to redeclare all the values in the Sass map. Identify the elevation levels that need changes and modify them.
// Modify the elevation map before importing the theme.
$kendo-elevation: (
6: (
12px 16px 10px -2px rgba(0,0,0,0.75), // For example, adjust elevation level 6.
0 4px 16px rgba(0, 0, 0, .12)
),
);
@import "@progress/kendo-theme-default/dist/all.scss";
Adding New Values
Adding new shadow intensity levels allows you to extend the elevation Sass map:
$kendo-elevation: (
10: (
0 34px 36px rgba(0, 0, 0, .34), // Add a new level 10 shadow intensity.
0 4px 16px rgba(0, 0, 0, .12)
)
);
@import "@progress/kendo-theme-default/dist/all.scss";
Removing Existing Values
To remove an existing shadow intensity level, set its value to null
.
$kendo-elevation: (
3: null // Remove the level 3 value.
);
@import "@progress/kendo-theme-default/dist/all.scss";