How to change the CSS
It is important to know how our web components look, control details such as fonts, layout, colors, backgrounds, margins, etc.
Using Kendo UI Angular is easy to choose a theme like :
Kendo UI Default theme
Kendo UI Bootstrap theme
Kendo UI Material theme
To start using the Default or Material theme, install it through NPM.
For the Bootstrap theme, which depends on the Bootstrap framework, install the version of the bootstrap framework specified as a peer dependency.
After the theme package is installed, reference it in your project.
This steps have been taken from kendo Styling Guide here you can find the kendo styling documentation.
There are some ways to take even more control over components style
Global styles in WinformsComponent
Applying global CSS to our project is easy, we just have to use a general document styling to apply CSS styles to our components.
In our angular project we are talking about the styles.scss
or jQueryStyles.scss
files, these files allows users to add global styles and supports CSS imports.
Those global styles and further must be added inside angular-cli.json
.
These will be loaded exactly as if you had added them in a <link>
tag inside html
file.
Styles in Samples
Aplying Classes
We implement a special behavior on each component using html class
attribute to add classes in the internal component.
With this we can take control of any component that is inside a form just using the css
file generated by the migration tool like this:
The special behavior is that the component declaration does not use the css class, actually, the content rendered is whom uses the css class and the class is removed from component declaration.
For example, the following component declaration has the buttonLoading
css class:
however when the component is rendered in the browser its declaration does not contain the buttonLoading
class, but the content displayed inside of the declaration has applied the class successfully.
Note
If you want to add a specific class to container element you can do it using ngClass
, for example if you want to add a class in the outer definition of the component you should use ngClass="buttonSpecialClass"
and this class will be applied in the component declaration.
*The class included in the ngClass must be written as string literal with single quotes ''
.
And the buttonSpecialClass
defined in ngClass will appear on the component declaration:
Local styles on WinformsComponent
On every single component that is generated like this:
a scss
file will be generated, here you should be able to modify the style of any component locally.
Its important to have in mind that these properties may be affected by any global style change
Last updated