igniteui-cli 14.10.0-alpha.2 → 14.10.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/SKILL.md +161 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/CHARTS-GRIDS.md +127 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/COMPONENT-CATALOGUE.md +301 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/EVENT-HANDLING.md +70 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/INSTALLATION.md +139 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/JSX-PATTERNS.md +187 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/REFS-FORMS.md +229 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/REVEAL-SDK.md +198 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/TROUBLESHOOTING.md +147 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/SKILL.md +182 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/reference/CSS-THEMING.md +265 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/reference/MCP-SERVER.md +75 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/reference/REVEAL-THEME.md +86 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/reference/SASS-THEMING.md +125 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/reference/TROUBLESHOOTING.md +35 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-optimize-bundle-size/SKILL.md +439 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__vscode/mcp.json +2 -2
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-choose-components/SKILL.md +358 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-customize-component-theme/SKILL.md +615 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-integrate-with-framework/SKILL.md +112 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-integrate-with-framework/references/angular.md +185 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-integrate-with-framework/references/react.md +116 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-integrate-with-framework/references/vanilla-js.md +118 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-integrate-with-framework/references/vue.md +181 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-optimize-bundle-size/SKILL.md +709 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__vscode/mcp.json +2 -2
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# CSS Theming
|
|
2
|
+
|
|
3
|
+
This guide covers theming Ignite UI for React using CSS custom properties — works in any project without additional build tooling.
|
|
4
|
+
|
|
5
|
+
## Pre-built Themes
|
|
6
|
+
|
|
7
|
+
Import a pre-built CSS file in your React entry point:
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
// main.tsx or index.tsx
|
|
11
|
+
import 'igniteui-webcomponents/themes/light/bootstrap.css';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
> **CRITICAL:** Theme CSS imports are **required** for components to render correctly.
|
|
15
|
+
|
|
16
|
+
**For grids**, you **must also** import the grid theme CSS:
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import 'igniteui-webcomponents/themes/light/bootstrap.css';
|
|
20
|
+
import 'igniteui-react-grids/grids/themes/light/bootstrap.css';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Available Pre-built CSS Files
|
|
24
|
+
|
|
25
|
+
| Import path | Theme |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `igniteui-webcomponents/themes/light/bootstrap.css` | Bootstrap Light |
|
|
28
|
+
| `igniteui-webcomponents/themes/dark/bootstrap.css` | Bootstrap Dark |
|
|
29
|
+
| `igniteui-webcomponents/themes/light/material.css` | Material Light |
|
|
30
|
+
| `igniteui-webcomponents/themes/dark/material.css` | Material Dark |
|
|
31
|
+
| `igniteui-webcomponents/themes/light/fluent.css` | Fluent Light |
|
|
32
|
+
| `igniteui-webcomponents/themes/dark/fluent.css` | Fluent Dark |
|
|
33
|
+
| `igniteui-webcomponents/themes/light/indigo.css` | Indigo Light |
|
|
34
|
+
| `igniteui-webcomponents/themes/dark/indigo.css` | Indigo Dark |
|
|
35
|
+
|
|
36
|
+
Grid theme CSS files follow the same pattern under `igniteui-react-grids/grids/themes/`.
|
|
37
|
+
|
|
38
|
+
### Next.js
|
|
39
|
+
|
|
40
|
+
In Next.js, import the theme CSS in each client component file or in a shared root layout:
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
// app/layout.tsx
|
|
44
|
+
import 'igniteui-webcomponents/themes/light/bootstrap.css';
|
|
45
|
+
import 'igniteui-react-grids/grids/themes/light/bootstrap.css';
|
|
46
|
+
|
|
47
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
48
|
+
return (
|
|
49
|
+
<html lang="en">
|
|
50
|
+
<body>{children}</body>
|
|
51
|
+
</html>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Custom Theme via CSS Custom Properties
|
|
57
|
+
|
|
58
|
+
After importing a pre-built theme, override individual design tokens with CSS custom properties.
|
|
59
|
+
|
|
60
|
+
### Global Overrides (in your CSS file)
|
|
61
|
+
|
|
62
|
+
```css
|
|
63
|
+
/* src/index.css */
|
|
64
|
+
:root {
|
|
65
|
+
--ig-primary-h: 211deg;
|
|
66
|
+
--ig-primary-s: 100%;
|
|
67
|
+
--ig-primary-l: 50%;
|
|
68
|
+
|
|
69
|
+
--ig-secondary-h: 33deg;
|
|
70
|
+
--ig-secondary-s: 100%;
|
|
71
|
+
--ig-secondary-l: 50%;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Import it in your entry point:
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
// main.tsx
|
|
79
|
+
import 'igniteui-webcomponents/themes/light/bootstrap.css'; // Theme first
|
|
80
|
+
import './index.css'; // Overrides — must come after the theme import
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Scoped Overrides
|
|
84
|
+
|
|
85
|
+
Use a CSS class to scope theme overrides to a specific container:
|
|
86
|
+
|
|
87
|
+
```css
|
|
88
|
+
/* src/AdminPanel.css */
|
|
89
|
+
.admin-panel {
|
|
90
|
+
--ig-primary-h: 260deg;
|
|
91
|
+
--ig-primary-s: 60%;
|
|
92
|
+
--ig-primary-l: 45%;
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
// AdminPanel.tsx
|
|
98
|
+
import './AdminPanel.css';
|
|
99
|
+
import { IgrButton, IgrInput } from 'igniteui-react';
|
|
100
|
+
|
|
101
|
+
function AdminPanel() {
|
|
102
|
+
return (
|
|
103
|
+
<div className="admin-panel">
|
|
104
|
+
<IgrInput label="Admin Search" />
|
|
105
|
+
<IgrButton>Save</IgrButton>
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### CSS Modules
|
|
112
|
+
|
|
113
|
+
```css
|
|
114
|
+
/* AdminPanel.module.css */
|
|
115
|
+
.panel {
|
|
116
|
+
--ig-primary-h: 260deg;
|
|
117
|
+
--ig-primary-s: 60%;
|
|
118
|
+
--ig-primary-l: 45%;
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
```tsx
|
|
123
|
+
import styles from './AdminPanel.module.css';
|
|
124
|
+
import { IgrButton } from 'igniteui-react';
|
|
125
|
+
|
|
126
|
+
function AdminPanel() {
|
|
127
|
+
return (
|
|
128
|
+
<div className={styles.panel}>
|
|
129
|
+
<IgrButton>Save</IgrButton>
|
|
130
|
+
</div>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Inline Styles on a Wrapper
|
|
136
|
+
|
|
137
|
+
For truly dynamic one-off overrides:
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
<div style={{ '--ig-primary-h': '260deg', '--ig-primary-s': '60%', '--ig-primary-l': '45%' } as React.CSSProperties}>
|
|
141
|
+
<IgrButton>Custom Color Button</IgrButton>
|
|
142
|
+
</div>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
> **Note:** TypeScript requires the `as React.CSSProperties` cast. Prefer CSS classes when possible.
|
|
146
|
+
|
|
147
|
+
## Component-Level Theming
|
|
148
|
+
|
|
149
|
+
Override individual component appearance using CSS custom properties.
|
|
150
|
+
|
|
151
|
+
```css
|
|
152
|
+
/* Target the Ignite UI web component tag name */
|
|
153
|
+
igc-avatar {
|
|
154
|
+
--ig-avatar-background: var(--ig-primary-500);
|
|
155
|
+
--ig-avatar-color: var(--ig-primary-500-contrast);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
igc-button {
|
|
159
|
+
--ig-button-foreground: var(--ig-secondary-500);
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
> **IMPORTANT — No Hardcoded Colors**
|
|
164
|
+
>
|
|
165
|
+
> ✅ **Right:** `--ig-avatar-background: var(--ig-primary-500);`
|
|
166
|
+
> ❌ **Wrong:** `--ig-avatar-background: #E91E63;`
|
|
167
|
+
|
|
168
|
+
### CSS `::part()` Selectors
|
|
169
|
+
|
|
170
|
+
Use `::part()` selectors to style shadow DOM internal elements:
|
|
171
|
+
|
|
172
|
+
```css
|
|
173
|
+
igc-input::part(input) {
|
|
174
|
+
font-size: 1.1rem;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
igc-card::part(header) {
|
|
178
|
+
padding: 1rem;
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
> **Note:** In CSS, use web component tag names (`igc-input`), not React component names (`IgrInput`).
|
|
183
|
+
|
|
184
|
+
## Layout Controls
|
|
185
|
+
|
|
186
|
+
### Sizing
|
|
187
|
+
|
|
188
|
+
```css
|
|
189
|
+
:root { --ig-size: 2; } /* 1 = small, 2 = medium, 3 = large */
|
|
190
|
+
igc-button { --ig-size: 1; }
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Spacing
|
|
194
|
+
|
|
195
|
+
```css
|
|
196
|
+
:root { --ig-spacing: 1; } /* 0.5 = compact, 1 = default, 2 = spacious */
|
|
197
|
+
.compact-section { --ig-spacing: 0.75; }
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Roundness
|
|
201
|
+
|
|
202
|
+
```css
|
|
203
|
+
:root { --ig-radius-factor: 1; } /* 0 = square, 1 = maximum radius */
|
|
204
|
+
igc-avatar { --ig-radius-factor: 0.5; }
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Switching Between Light and Dark Themes
|
|
208
|
+
|
|
209
|
+
### Approach 1: CSS class toggle
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
import { useState } from 'react';
|
|
213
|
+
import 'igniteui-webcomponents/themes/light/bootstrap.css';
|
|
214
|
+
import './theme-overrides.css';
|
|
215
|
+
|
|
216
|
+
function App() {
|
|
217
|
+
const [isDark, setIsDark] = useState(false);
|
|
218
|
+
|
|
219
|
+
return (
|
|
220
|
+
<div className={isDark ? 'dark-theme' : ''}>
|
|
221
|
+
<button onClick={() => setIsDark(!isDark)}>Toggle Theme</button>
|
|
222
|
+
</div>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
```css
|
|
228
|
+
/* theme-overrides.css */
|
|
229
|
+
.dark-theme {
|
|
230
|
+
--ig-surface-h: 0deg;
|
|
231
|
+
--ig-surface-s: 0%;
|
|
232
|
+
--ig-surface-l: 7%;
|
|
233
|
+
|
|
234
|
+
--ig-gray-h: 0deg;
|
|
235
|
+
--ig-gray-s: 0%;
|
|
236
|
+
--ig-gray-l: 100%;
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Approach 2: CSS media query
|
|
241
|
+
|
|
242
|
+
```css
|
|
243
|
+
@media (prefers-color-scheme: dark) {
|
|
244
|
+
:root {
|
|
245
|
+
--ig-surface-h: 0deg;
|
|
246
|
+
--ig-surface-s: 0%;
|
|
247
|
+
--ig-surface-l: 7%;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Approach 3: Dynamically swap theme stylesheet
|
|
253
|
+
|
|
254
|
+
```tsx
|
|
255
|
+
import { useEffect } from 'react';
|
|
256
|
+
|
|
257
|
+
function useTheme(variant: 'light' | 'dark', design = 'bootstrap') {
|
|
258
|
+
useEffect(() => {
|
|
259
|
+
const link = document.getElementById('igc-theme') as HTMLLinkElement;
|
|
260
|
+
if (link) {
|
|
261
|
+
link.href = `node_modules/igniteui-webcomponents/themes/${variant}/${design}.css`;
|
|
262
|
+
}
|
|
263
|
+
}, [variant, design]);
|
|
264
|
+
}
|
|
265
|
+
```
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Ignite UI Theming MCP Server
|
|
2
|
+
|
|
3
|
+
The Ignite UI Theming MCP server enables AI assistants to generate production-ready theming code. It must be configured in your editor before the theming tools become available.
|
|
4
|
+
|
|
5
|
+
> **AGENT INSTRUCTION — MCP Server Setup (REQUIRED)**
|
|
6
|
+
>
|
|
7
|
+
> Before using any theming tools, you MUST verify the MCP server is available
|
|
8
|
+
> by calling `detect_platform`. If the tool is not available or the call fails,
|
|
9
|
+
> configure it by following the setup steps below.
|
|
10
|
+
|
|
11
|
+
## VS Code Setup
|
|
12
|
+
|
|
13
|
+
Create or edit `.vscode/mcp.json` in your project:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"servers": {
|
|
18
|
+
"igniteui-theming": {
|
|
19
|
+
"command": "npx",
|
|
20
|
+
"args": ["-y", "igniteui-theming", "igniteui-theming-mcp"]
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Cursor Setup
|
|
27
|
+
|
|
28
|
+
Create or edit `.cursor/mcp.json`:
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"mcpServers": {
|
|
33
|
+
"igniteui-theming": {
|
|
34
|
+
"command": "npx",
|
|
35
|
+
"args": ["-y", "igniteui-theming", "igniteui-theming-mcp"]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Claude Desktop Setup
|
|
42
|
+
|
|
43
|
+
Edit the Claude Desktop config file:
|
|
44
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
45
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"igniteui-theming": {
|
|
51
|
+
"command": "npx",
|
|
52
|
+
"args": ["-y", "igniteui-theming", "igniteui-theming-mcp"]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## WebStorm / JetBrains IDEs Setup
|
|
59
|
+
|
|
60
|
+
1. Go to **Settings → Tools → AI Assistant → MCP Servers**
|
|
61
|
+
2. Click **+ Add MCP Server**
|
|
62
|
+
3. Set Command to `npx` and Arguments to `igniteui-theming igniteui-theming-mcp`
|
|
63
|
+
4. Click OK and restart the AI Assistant
|
|
64
|
+
|
|
65
|
+
## MCP Server Workflow
|
|
66
|
+
|
|
67
|
+
1. **Detect platform**: Call `detect_platform` — it will detect `webcomponents` from `package.json`
|
|
68
|
+
2. **Generate a theme**: Call `create_theme` with your desired colors and design system
|
|
69
|
+
3. **Customize components**: Call `get_component_design_tokens` first, then `create_component_theme` with palette token values
|
|
70
|
+
4. **Get color references**: Call `get_color` to get the correct CSS custom property for any palette shade
|
|
71
|
+
5. **Adjust layout**: Call `set_size`, `set_spacing`, or `set_roundness`
|
|
72
|
+
|
|
73
|
+
## File Safety Rule
|
|
74
|
+
|
|
75
|
+
> **IMPORTANT — File Safety Rule**: When generating theme code, **never overwrite existing style files directly**. Always propose changes as an update and let the user review before writing to disk.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Reveal SDK Theme Sync
|
|
2
|
+
|
|
3
|
+
When the project includes Reveal SDK (`reveal-sdk-wrappers-react`) alongside Ignite UI for React, the Reveal dashboard theme should be synced with the active Ignite UI theme.
|
|
4
|
+
|
|
5
|
+
> **⚠️ IMPORTANT:** Reveal SDK requires client runtime scripts (jQuery, Day.js, infragistics.reveal.js) to be loaded and initialization must happen in `useEffect` after mount. See [REVEAL-SDK.md](../../igniteui-react-components/reference/REVEAL-SDK.md) for full setup instructions.
|
|
6
|
+
|
|
7
|
+
## How It Works
|
|
8
|
+
|
|
9
|
+
Ignite UI themes expose CSS custom properties (`--ig-font-family`, `--ig-surface-500`, `--ig-gray-100`, etc.) on the page. The Reveal SDK has its own `$.ig.RevealTheme` object that controls dashboard appearance. The sync function reads the Ignite UI tokens from computed styles and maps them to Reveal's theme properties.
|
|
10
|
+
|
|
11
|
+
## Reveal Theme Sync Function
|
|
12
|
+
|
|
13
|
+
Call this function in `useEffect` when initializing a component that uses Reveal. Always guard against missing `$` and `$.ig`:
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { useEffect } from 'react';
|
|
17
|
+
|
|
18
|
+
declare const $: any;
|
|
19
|
+
|
|
20
|
+
function setRevealTheme() {
|
|
21
|
+
// Guard: Ensure Reveal runtime is loaded
|
|
22
|
+
if (typeof $ === 'undefined' || !$.ig) {
|
|
23
|
+
console.error('Reveal SDK runtime not loaded.');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const style = window.getComputedStyle(document.body);
|
|
28
|
+
const theme = new $.ig.RevealTheme();
|
|
29
|
+
|
|
30
|
+
// 1. Sync fonts with the Ignite UI --ig-font-family token
|
|
31
|
+
theme.regularFont = style.getPropertyValue('--ig-font-family')?.trim() || 'sans-serif';
|
|
32
|
+
theme.mediumFont = theme.regularFont;
|
|
33
|
+
theme.boldFont = theme.regularFont;
|
|
34
|
+
|
|
35
|
+
// 2. Auto-detect light/dark from surface color brightness
|
|
36
|
+
const color = style.getPropertyValue('--ig-surface-500').trim() || '#fff';
|
|
37
|
+
const [r, g, b] = [1, 3, 5].map(i => parseInt(color.substring(i, i + 2), 16));
|
|
38
|
+
const brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
39
|
+
|
|
40
|
+
theme.isDark = brightness < 128;
|
|
41
|
+
theme.fontColor = theme.isDark ? 'white' : 'black';
|
|
42
|
+
|
|
43
|
+
// 3. Sync background colors with Ignite UI palette tokens
|
|
44
|
+
theme.dashboardBackgroundColor = style.getPropertyValue('--ig-gray-100').trim();
|
|
45
|
+
theme.visualizationBackgroundColor = style.getPropertyValue('--ig-surface-500').trim();
|
|
46
|
+
|
|
47
|
+
$.ig.RevealSdkSettings.theme = theme;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Example usage in a component
|
|
51
|
+
function DashboardView() {
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
// Initialize theme sync after mount
|
|
54
|
+
setRevealTheme();
|
|
55
|
+
}, []);
|
|
56
|
+
|
|
57
|
+
// ... component implementation
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Token Mapping Reference
|
|
62
|
+
|
|
63
|
+
| Reveal Theme Property | Ignite UI CSS Token | Purpose |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| `regularFont`, `mediumFont`, `boldFont` | `--ig-font-family` | Font family |
|
|
66
|
+
| `isDark` | Computed from `--ig-surface-500` brightness | Light/dark mode detection |
|
|
67
|
+
| `fontColor` | Derived from `isDark` | Text color (white for dark, black for light) |
|
|
68
|
+
| `dashboardBackgroundColor` | `--ig-gray-100` | Dashboard background |
|
|
69
|
+
| `visualizationBackgroundColor` | `--ig-surface-500` | Individual visualization card background |
|
|
70
|
+
|
|
71
|
+
## Re-syncing After Theme Switch
|
|
72
|
+
|
|
73
|
+
When the user switches between light and dark Ignite UI themes, call `setRevealTheme()` again to update the Reveal dashboard:
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
function handleThemeToggle() {
|
|
77
|
+
// ... toggle Ignite UI theme (e.g., swap CSS imports)
|
|
78
|
+
|
|
79
|
+
// Re-sync Reveal theme after DOM updates
|
|
80
|
+
requestAnimationFrame(() => {
|
|
81
|
+
setRevealTheme();
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
See the [components skill](../../igniteui-react-components/reference/REVEAL-SDK.md) for full Reveal SDK setup instructions including installation, runtime scripts, and `$.ig.RevealView` initialization.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Sass Theming
|
|
2
|
+
|
|
3
|
+
> Requires Sass configured in the project (e.g., `sass` in `devDependencies` and Vite/webpack configured to handle `.scss` files).
|
|
4
|
+
|
|
5
|
+
## Basic Setup
|
|
6
|
+
|
|
7
|
+
```scss
|
|
8
|
+
// src/styles.scss
|
|
9
|
+
@use 'igniteui-theming' as *;
|
|
10
|
+
|
|
11
|
+
// 1. Define a palette
|
|
12
|
+
$my-palette: palette(
|
|
13
|
+
$primary: #1976D2,
|
|
14
|
+
$secondary: #FF9800,
|
|
15
|
+
$surface: #FAFAFA
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
// 2. Apply the palette
|
|
19
|
+
@include palette($my-palette);
|
|
20
|
+
|
|
21
|
+
// 3. Optional: Typography
|
|
22
|
+
@include typography($font-family: "'Roboto', sans-serif");
|
|
23
|
+
|
|
24
|
+
// 4. Optional: Elevations
|
|
25
|
+
@include elevations();
|
|
26
|
+
|
|
27
|
+
// 5. Optional: Spacing
|
|
28
|
+
@include spacing();
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Import in your React entry point:
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
// main.tsx
|
|
35
|
+
import './styles.scss';
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Dark Theme
|
|
39
|
+
|
|
40
|
+
For dark themes, use a dark surface color and a dark schema:
|
|
41
|
+
|
|
42
|
+
```scss
|
|
43
|
+
@use 'igniteui-theming' as *;
|
|
44
|
+
|
|
45
|
+
$dark-palette: palette(
|
|
46
|
+
$primary: #90CAF9,
|
|
47
|
+
$secondary: #FFB74D,
|
|
48
|
+
$surface: #121212
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
@include palette($dark-palette, $schema: $dark-material-schema);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
> **Important:** Use `@use 'igniteui-theming'` — not `igniteui-angular/theming` or Angular-specific `core()` / `theme()` mixins.
|
|
55
|
+
|
|
56
|
+
## Component-Level Theming with Sass
|
|
57
|
+
|
|
58
|
+
When Sass is configured, use component theme functions and the `tokens` mixin:
|
|
59
|
+
|
|
60
|
+
```scss
|
|
61
|
+
@use 'igniteui-theming' as *;
|
|
62
|
+
|
|
63
|
+
$custom-avatar: avatar-theme(
|
|
64
|
+
$schema: $light-material-schema,
|
|
65
|
+
$background: var(--ig-primary-500),
|
|
66
|
+
$color: var(--ig-primary-500-contrast)
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
igc-avatar {
|
|
70
|
+
@include tokens($custom-avatar);
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Light/Dark Toggle with Sass
|
|
75
|
+
|
|
76
|
+
```scss
|
|
77
|
+
@use 'igniteui-theming' as *;
|
|
78
|
+
|
|
79
|
+
$light-palette: palette($primary: #1976D2, $secondary: #FF9800, $surface: #FAFAFA);
|
|
80
|
+
$dark-palette: palette($primary: #90CAF9, $secondary: #FFB74D, $surface: #121212);
|
|
81
|
+
|
|
82
|
+
@include typography($font-family: "'Roboto', sans-serif");
|
|
83
|
+
@include elevations();
|
|
84
|
+
|
|
85
|
+
// Light is default
|
|
86
|
+
@include palette($light-palette, $schema: $light-material-schema);
|
|
87
|
+
|
|
88
|
+
// Dark via class on a container or <body>
|
|
89
|
+
.dark-theme {
|
|
90
|
+
@include palette($dark-palette, $schema: $dark-material-schema);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Theming Architecture
|
|
95
|
+
|
|
96
|
+
The Ignite UI theming system is built on four pillars:
|
|
97
|
+
|
|
98
|
+
| Concept | Purpose |
|
|
99
|
+
|---|---|
|
|
100
|
+
| **Palette** | Color system with primary, secondary, surface, gray, info, success, warn, error families, each with shades 50–900 + accents A100–A700 |
|
|
101
|
+
| **Typography** | Font family, type scale (h1–h6, subtitle, body, button, caption, overline) |
|
|
102
|
+
| **Elevations** | Box-shadow levels 0–24 for visual depth |
|
|
103
|
+
| **Schema** | Per-component recipes mapping palette colors to component tokens |
|
|
104
|
+
|
|
105
|
+
### Design Systems
|
|
106
|
+
|
|
107
|
+
Four built-in design systems are available:
|
|
108
|
+
|
|
109
|
+
- **Material** (default) — Material Design 3
|
|
110
|
+
- **Bootstrap** — Bootstrap-inspired
|
|
111
|
+
- **Fluent** — Microsoft Fluent Design
|
|
112
|
+
- **Indigo** — Infragistics Indigo Design
|
|
113
|
+
|
|
114
|
+
Each has light and dark variants (e.g., `$light-material-schema`, `$dark-fluent-schema`).
|
|
115
|
+
|
|
116
|
+
### Palette Shades
|
|
117
|
+
|
|
118
|
+
- Shades 50 = lightest, 900 = darkest for all chromatic colors
|
|
119
|
+
- Surface color must match the variant — light color for `light`, dark color for `dark`
|
|
120
|
+
|
|
121
|
+
## Key Rules
|
|
122
|
+
|
|
123
|
+
1. **Sass**: Use `@use 'igniteui-theming'` — not `igniteui-angular/theming`
|
|
124
|
+
2. **Sass**: Component themes use `@include tokens($theme)` inside a selector
|
|
125
|
+
3. **Never hardcode colors after palette generation** — use `var(--ig-<family>-<shade>)` palette tokens everywhere
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Theming Troubleshooting
|
|
2
|
+
|
|
3
|
+
## Issue: Theme overrides not taking effect
|
|
4
|
+
|
|
5
|
+
**Cause:** Override CSS is loaded before the theme CSS.
|
|
6
|
+
|
|
7
|
+
**Solution:** Make sure your custom CSS is imported *after* the theme:
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
// main.tsx
|
|
11
|
+
import 'igniteui-webcomponents/themes/light/bootstrap.css'; // Theme first
|
|
12
|
+
import './custom-overrides.css'; // Overrides second
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Issue: CSS custom properties not recognized by TypeScript in inline styles
|
|
16
|
+
|
|
17
|
+
**Solution:** Cast to `React.CSSProperties`:
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
<div style={{ '--ig-primary-h': '260deg' } as React.CSSProperties}>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Issue: Component-level CSS selectors don't match
|
|
24
|
+
|
|
25
|
+
**Cause:** Using React component name instead of web component tag name in CSS.
|
|
26
|
+
|
|
27
|
+
**Solution:** Use the underlying web component tag name in CSS selectors:
|
|
28
|
+
|
|
29
|
+
```css
|
|
30
|
+
/* ✅ Correct — web component tag */
|
|
31
|
+
igc-button { --ig-size: 1; }
|
|
32
|
+
|
|
33
|
+
/* ❌ Wrong — React wrapper name */
|
|
34
|
+
IgrButton { --ig-size: 1; }
|
|
35
|
+
```
|