1 | # Kendo UI Bootstrap Theme
|
2 |
|
3 | The Kendo UI Bootstrap Theme is a theme for the Kendo UI components which is based on the Bootstrap 5 framework. To style and size the components and make them blend in with the surrounding page, the Bootstrap theme uses variables defined in Bootstrap framework, or their value if direct usage is impossible.
|
4 |
|
5 | * [Quick start](#quick-start)
|
6 | * [Customizing](#customizing)
|
7 | * [Integrating with third party frameworks](#integrating-with-third-party-frameworks)
|
8 | * [Bug reports and feature requests](#bug-reports-and-feature-requests)
|
9 | * [Versioning](#versioning)
|
10 | * [License](#license)
|
11 |
|
12 | ## Quick start
|
13 |
|
14 | Kendo UI Bootstrap Theme is available as an npm package.
|
15 |
|
16 | If you don't need to apply any [customization](#customizing) to the theme, you can can reference the precompiled CSS directly from unpkg CDN:
|
17 |
|
18 | ```html
|
19 | <link rel="stylesheet" href="https://unpkg.com/@progress/kendo-theme-bootstrap/dist/all.css" />
|
20 | ```
|
21 |
|
22 | While using the precompiled CSS file is faster than compiling the theme from the source code, the approach has the two drawbacks: it includes CSS for all components; 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.
|
23 |
|
24 | If you prefer, or you need to customize the theme, you can install it:
|
25 |
|
26 | ```sh
|
27 | npm install --save @progress/kendo-theme-bootstrap
|
28 | ```
|
29 |
|
30 | and then import it in your project styles:
|
31 |
|
32 | ```scss
|
33 | // Import the entire theme
|
34 | @use "@progress/kendo-theme-bootstrap/scss/all.scss" as *;
|
35 | ```
|
36 |
|
37 | For more information on how to implement the Bootstrap theme in your project, refer to the following articles:
|
38 |
|
39 | * [Using the Bootstrap Theme in Angular Projects](https://www.telerik.com/kendo-angular-ui/components/styling/theme-bootstrap/)
|
40 | * [Using the Bootstrap Theme in React Projects](https://www.telerik.com/kendo-react-ui/components/styling/theme-bootstrap/)
|
41 | * [Using the Bootstrap Theme in jQuery Projects](http://docs.telerik.com/kendo-ui/styles-and-layout/sass-themes)
|
42 |
|
43 | ## Customizing
|
44 |
|
45 | You can customize Kendo UI Bootstrap Theme both in terms of what gets compiled and how the theme will look.
|
46 |
|
47 | ### Importing
|
48 |
|
49 | In your custom scss file, you can import the entirety of the theme, by importing `scss/all.scss` or pick just the styles for the components you need. The files for individual components:
|
50 |
|
51 | ```scss
|
52 | // Import only Button and Grid styles
|
53 | @use "@progress/kendo-theme-bootstrap/scss/index.scss" as *;
|
54 |
|
55 | @include kendo-button--styles();
|
56 | @include kendo-grid--styles();
|
57 | ```
|
58 |
|
59 | ### SCSS Variables
|
60 |
|
61 | Kendo UI Bootstrap Theme provides many variables for customization. There are variables that control globally used theme colors like `$primary`, `$secondary`, `$success`, `$error` etc.; variables for all components such as `$component-text`, `$component-bg`; as well as variables for individual components such as `$grid-bg`, `$tabstrip-font-size` and so on.
|
62 |
|
63 | Most component variables link to higher abstracted generic variables. For instance, the background of the grid component can be customized both from `$component-bg` and `$grid-bg`, with the latter referencing the former.
|
64 |
|
65 | We have more than 2000 variables, so it's hard to list them all. We've tried to make variable names as coherent as possible. For instance, all variables ending in `-bg` control background color; all variables ending in `-text` control text color.
|
66 |
|
67 | Here is a quick example on how to customize:
|
68 |
|
69 | ```scss
|
70 | @use "@progress/kendo-theme-bootstrap/scss/all.scss" as * with (
|
71 | $kendo-button-bg: #ff0000,
|
72 | $kendo-font-size: 20px
|
73 | );
|
74 | ```
|
75 |
|
76 | ## Integrating with third party frameworks
|
77 |
|
78 | CSS can be complicated due to cascades (that's what C stands for). If there are multiple frameworks loaded on a single page, it is quite possible that their styles will interfere with one another.
|
79 |
|
80 | To avoid that, we've prefixed all our class names with `k-` e.g. `k-grid`, `k-hidden` etc., with the exception of handling for `hidden` attribute, which will hide the element that has it.
|
81 |
|
82 | Some frameworks, like Bootstrap and Tailwind, touch global styles to establish a sort of baseline -- we call that normalizing. One such styles is the following bit, which makes dimensions (width and height) behave in a specific way:
|
83 |
|
84 | ```css
|
85 | *, ::after, ::before {
|
86 | box-sizing: border-box;
|
87 | }
|
88 | ```
|
89 |
|
90 | We've ensured that our themes work correctly with both those styles being present and absent.
|
91 |
|
92 | However, even when being cautious, neglecting the scope and cascade of CSS, that may result in unexpected side effects. Oddly enough, most of the cases when that happens, everything is expected, at least from CSS point of view, but it can be still frustrating.
|
93 |
|
94 | For instance, it cannot be expected that adding `form-control` from Bootstrap to a Kendo UI Combobox will make the component behave and look like a Bootstrap form component. The scope and cascade are different -- `form-control` is intended to be added to pure `input` elements, where as a Kendo UI Combobox has a different structure and styles will not be applied correctly.
|
95 |
|
96 | Another example is adding `bg-red-400` from Tailwind to a Kendo UI Button, depending on the exact stylesheet order that class may or may not be applied.
|
97 |
|
98 | As a general rule, it should not be expected that mixing at matching classes from different frameworks will yield the desired results.
|
99 |
|
100 | ## Bug reports and feature requests
|
101 |
|
102 | Have a bug or a feature request? Please first search for existing and closed issues. If your problem or idea is not addressed yet, please open a new [bug report](https://github.com/telerik/kendo-themes/issues/new?labels=bug,T:Bootstrap&template=bug_report.md) or [feature request](https://github.com/telerik/kendo-themes/issues/new?labels=Enhancement,T:Bootstrap&template=feature_request.md).
|
103 |
|
104 | ## Versioning
|
105 |
|
106 | To ensure version predictability, we use [Semantic Versioning](https://semver.org/): we try to add only features for minor versions and bugfixes (or smaller features) for patch version.
|
107 |
|
108 | ## License
|
109 |
|
110 | This package is part of the following suites:
|
111 |
|
112 | * [Kendo UI for Angular](http://www.telerik.com/kendo-angular-ui/)
|
113 | * [KendoReact](http://www.telerik.com/kendo-react-ui/)
|
114 | * [Kendo UI for jQuery](http://www.telerik.com/kendo-ui)
|
115 | * [UI for ASP.NET MVC](http://www.telerik.com/aspnet-mvc)
|
116 | * [UI for ASP.NET Core](http://www.telerik.com/aspnet-core-ui)
|
117 |
|
118 | All available Kendo UI commercial licenses may be obtained at http://www.telerik.com/purchase/kendo-ui.
|
119 |
|
120 | If you do not own a commercial license, the usage of this software shall be governed by the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
|
121 |
|
122 | *Copyright © 2021 Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved.*
|
123 |
|
124 | *Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries.*
|