Skip to content

Commit b9fef3c

Browse files
Integrated latest changes at 07-12-2024 4:30:10 AM
1 parent 5ff3462 commit b9fef3c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+923
-332
lines changed

ej2-vue-toc.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<li><a href="/ej2-vue/appearance/size-modes">Size-Modes</a></li>
7474
<li><a href="/ej2-vue/appearance/icons">Icons</a></li>
7575
<li><a href="/ej2-vue/appearance/theme-studio">Theme Studio</a></li>
76-
<li><a href="/ej2-vue/appearance/material3">Material 3 Theme</a></li>
76+
<li><a href="/ej2-vue/appearance/css-variables">CSS Variables</a></li>
7777
</ul>
7878
</li>
7979
<li>
@@ -2685,9 +2685,9 @@
26852685
</li>
26862686
<li><a href="https://ej2.syncfusion.com/vue/documentation/api/tooltip/">API Reference</a></li>
26872687
</ul>
2688-
</li><li>
2689-
<a href="/ej2-vue/treegrid/overview">TreeGrid</a>
2688+
</li><li>TreeGrid
26902689
<ul>
2690+
<li><a href="/ej2-vue/treegrid/overview">Overview</a></li>
26912691
<li>Getting Started
26922692
<ul>
26932693
<li><a href="/ej2-vue/treegrid/getting-started">Vue 2</a></li>

ej2-vue/appearance/css-variables.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
---
2+
layout: post
3+
title: Themes using CSS Variables in Vue Appearance component | Syncfusion
4+
description: Learn here all about Themes using CSS Variables in Syncfusion Vue Appearance component of Syncfusion Essential JS 2 and more.
5+
control: Themes using CSS Variables
6+
platform: ej2-vue
7+
documentation: ug
8+
domainurl: ##DomainURL##
9+
---
10+
11+
# About CSS variables in themes
12+
13+
[CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties), also known as custom properties, are entities defined by CSS authors that contain specific values that can be reused throughout a CSS file. They are identified by their name, which must begin with two hyphens (--) followed by an identifier. These variables can be assigned any valid CSS value, such as colors, lengths, or fonts. To retrieve the value of a CSS variable, the var() function is used.
14+
15+
Syncfusion currently offers two modern and highly customizable themes using CSS variables. These themes are designed to provide a consistent and visually appealing look and feel across all Syncfusion components. The themes available are:
16+
17+
* Material 3 Theme
18+
* Fluent 2 Theme
19+
20+
## CSS themes - Syncfusion Vue components
21+
22+
[Material 3](https://m3.material.io/) and [Fluent 2](https://fluent2.microsoft.design/get-started/whatisnew) themes have been introduced across all EJ2 Controls, featuring both `light` and `dark` variants. This themes utilizes `CSS variables` to allow easy customization of control colors in CSS format. With this implementation, users can seamlessly switch between light and dark color schemes, providing a flexible solution to meet their preferences and application needs.
23+
24+
> Kindly note that in the Material 3 theme, CSS variables with rgb() values are used for color variables. The use of hex values in this context may lead to improper functionality. For example, in previous versions of the Material theme or other themes, the primary color variable was defined as follows: $primary: #6200ee;. However, in the Material 3 theme, the primary color variable is defined as follows: --color-sf-primary: 98, 0, 238;.
25+
26+
### Utilization of CSS variables in modern themes
27+
28+
Modern themes like Material 3 and Fluent 2 incorporate support for CSS variables, where `Material 3` utilizes `rgb()` values for customizing colors and `Fluent 2` uses `hex` values for color customization. For more information you can refer this [documentation](./theme#syncfusion-material-3-theme) for color variables of our themes. The examples below shows CSS variables with their values used for the respective themes.
29+
30+
{% tabs %}
31+
{% highlight ts tabtitle="material3.css" %}
32+
{% include code-snippet/common/css-value-cs1/material3.css %}
33+
{% endhighlight %}
34+
{% highlight ts tabtitle="fluent2.css" %}
35+
{% include code-snippet/common/css-value-cs1/fluent2.css %}
36+
{% endhighlight %}
37+
{% endtabs %}
38+
39+
### How to get these themes?
40+
41+
To access themes provided by Syncfusion, you have two primary options,
42+
43+
* Package
44+
* CDN links
45+
46+
| | Light | Dark |
47+
|-----------|---------|--------|
48+
|Package | [Material 3 Light](https://www.npmjs.com/package/@syncfusion/ej2-material3-theme) | [Material 3 Dark](https://www.npmjs.com/package/@syncfusion/ej2-material3-dark-theme) |
49+
| | [Fluent 2 Light](https://www.npmjs.com/package/@syncfusion/ej2-fluent2-theme) | [Fluent 2 Dark](https://www.npmjs.com/package/@syncfusion/ej2-fluent2-dark-theme) |
50+
| CDN | [Material 3 Light](https://cdn.syncfusion.com/ej2/24.2.8/material3.css) | [Material 3 Dark](https://cdn.syncfusion.com/ej2/24.2.8/material3-dark.css) |
51+
| | [Fluent 2 light](https://cdn.syncfusion.com/ej2/26.1.35/fluent2.css) | [Fluent 2 Dark](https://cdn.syncfusion.com/ej2/26.1.35/fluent2-dark.css) |
52+
53+
### Color Customization in themes
54+
55+
CSS variables allows you to dynamically change color values in real-time using JavaScript. This flexibility enables you to create interactive experiences where colors can adjust based on user interactions or other dynamic factors.
56+
57+
#### Customization using CSS
58+
59+
Here you can find the example for `Material 3` customization using CSS class.
60+
61+
{% tabs %}
62+
{% highlight html tabtitle="app.vue" %}
63+
{% include code-snippet/common/material3-cs2/app.vue %}
64+
{% endhighlight %}
65+
{% endtabs %}
66+
67+
{% previewsample "page.domainurl/code-snippet/common/material3-cs2" %}
68+
69+
**Default primary value**
70+
71+
![default primary value](images/material3-default.png)
72+
73+
**Customized primary value**
74+
75+
![customized primary value](images/material3-customize.png)
76+
77+
Example for `Fluent 2` customization using CSS class.
78+
79+
{% tabs %}
80+
{% highlight html tabtitle="app.vue" %}
81+
{% include code-snippet/common/fluent2-cs2/app.vue %}
82+
{% endhighlight %}
83+
{% endtabs %}
84+
85+
{% previewsample "page.domainurl/code-snippet/common/fluent2-cs2" %}
86+
87+
**Default primary value**
88+
89+
![default primary value](images/fluent2-default.png)
90+
91+
**Customized primary value**
92+
93+
![customized primary value](images/fluent2-customize.png)
94+
95+
With this CSS variable support, you can effortlessly customize the color variable values for Syncfusion Vue Components.
96+
97+
### Switching Light and Dark mode with CSS variables
98+
99+
Switching between modes has become easier with the updated modern themes, which offer Light and Dark variants. In both the `Material 3` and `Fluent 2` light themes, there are distinct class variables for light and dark modes in a `single file`, providing flexibility for seamless switching between the two modes within your application.
100+
101+
{% tabs %}
102+
{% highlight html tabtitle="app.vue" %}
103+
{% include code-snippet/common/material3-cs1/app.vue %}
104+
{% endhighlight %}
105+
{% endtabs %}
106+
107+
{% previewsample "page.domainurl/code-snippet/common/material3-cs1" %}
108+
109+
### Mode switching in Fluent 2 theme
110+
111+
Similar to `Material 3`, we offer both Light and Dark variants with `Fluent 2`. In the Fluent 2 theme, there are distinct class variables for light and dark modes, as shown in the preview below.
112+
113+
{% tabs %}
114+
{% highlight html tabtitle="app.vue" %}
115+
{% include code-snippet/common/fluent2-cs1/app.vue %}
116+
{% endhighlight %}
117+
{% endtabs %}
118+
119+
{% previewsample "page.domainurl/code-snippet/common/fluent2-cs1" %}
120+
121+
### How to switch dark mode?
122+
123+
To activate dark mode, just append the `e-dark-mode` class to the body section of your application for both `Material 3` and `Fluent 2` theme. Once applied, the theme seamlessly switches to dark mode. Please refer to the example image below for visual guidance.
124+
125+
`Material 3` dark mode
126+
127+
![dark mode](images/material3-dark.png)
128+
129+
`Fluent 2` dark mode
130+
131+
![dark mode](images/fluent2-dark.png)
132+
133+
### ThemeStudio Application
134+
135+
The ThemeStudio application now includes seamless integration with the Material 3 and Fluent 2 themes, offering a comprehensive solution for customization requirements. This enhancement enables users to effortlessly customize and personalize their themes.
136+
137+
Access the Syncfusion ThemeStudio application, featuring our themes, via the following link: [Link to Syncfusion ThemeStudio](https://ej2.syncfusion.com/themestudio/?theme=material3)
Loading
33.6 KB
Loading
38.6 KB
Loading
-58.2 KB
Loading
-86.8 KB
Loading
-56.2 KB
Loading

ej2-vue/appearance/material3.md

Lines changed: 0 additions & 114 deletions
This file was deleted.

0 commit comments

Comments
 (0)