igniteui-cli 14.10.0-alpha.2 → 14.10.0-alpha.3
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__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,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: igniteui-wc-integrate-with-framework
|
|
3
|
+
description: Integrate igniteui-webcomponents into React, Angular, Vue, or vanilla JS applications with framework-specific configurations
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Integrate with Framework
|
|
8
|
+
|
|
9
|
+
This skill helps users integrate Ignite UI Web Components into their application. It detects the framework or platform in use and loads the appropriate step-by-step integration reference.
|
|
10
|
+
|
|
11
|
+
## Example Usage
|
|
12
|
+
|
|
13
|
+
- "How do I use igniteui-webcomponents in my React app?"
|
|
14
|
+
- "Integrate the button component in Angular"
|
|
15
|
+
- "Set up igniteui-webcomponents in Vue 3"
|
|
16
|
+
- "Help me add web components to my vanilla JS project"
|
|
17
|
+
|
|
18
|
+
## Related Skills
|
|
19
|
+
|
|
20
|
+
- [igniteui-wc-optimize-bundle-size](../igniteui-wc-optimize-bundle-size/SKILL.md) - Reduce bundle size after integration
|
|
21
|
+
- [igniteui-wc-customize-component-theme](../igniteui-wc-customize-component-theme/SKILL.md) - Style components after setup
|
|
22
|
+
|
|
23
|
+
## When to Use
|
|
24
|
+
|
|
25
|
+
- User wants to add igniteui-webcomponents to a framework project
|
|
26
|
+
- User is experiencing framework-specific integration issues
|
|
27
|
+
- User needs help with component imports and registration
|
|
28
|
+
- User asks about React, Angular, Vue, or vanilla JS setup
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Framework Detection
|
|
33
|
+
|
|
34
|
+
Before loading a reference, identify the target framework from the project context. Check the following signals in order:
|
|
35
|
+
|
|
36
|
+
### 1. Detect React
|
|
37
|
+
|
|
38
|
+
**Evidence to look for:**
|
|
39
|
+
- `package.json` contains `"react"` or `"react-dom"` in `dependencies` or `devDependencies`
|
|
40
|
+
- Files with `.tsx` or `.jsx` extensions exist in `src/`
|
|
41
|
+
- Entry point imports `ReactDOM` or `createRoot`
|
|
42
|
+
- `vite.config.ts` uses `@vitejs/plugin-react` or `@vitejs/plugin-react-swc`
|
|
43
|
+
|
|
44
|
+
→ **Load:** [react.md](./references/react.md)
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### 2. Detect Angular
|
|
49
|
+
|
|
50
|
+
**Evidence to look for:**
|
|
51
|
+
- `package.json` contains `"@angular/core"` in `dependencies`
|
|
52
|
+
- `angular.json` file exists in the workspace root
|
|
53
|
+
- Files with `.component.ts`, `.module.ts`, or `.component.html` patterns exist
|
|
54
|
+
- Entry point calls `bootstrapApplication` or `platformBrowserDynamic`
|
|
55
|
+
|
|
56
|
+
→ **Load:** [angular.md](./references/angular.md)
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
### 3. Detect Vue 3
|
|
61
|
+
|
|
62
|
+
**Evidence to look for:**
|
|
63
|
+
- `package.json` contains `"vue"` in `dependencies` or `devDependencies`
|
|
64
|
+
- Files with `.vue` extensions exist in `src/`
|
|
65
|
+
- `vite.config.ts` uses `@vitejs/plugin-vue`
|
|
66
|
+
- Entry point calls `createApp`
|
|
67
|
+
|
|
68
|
+
→ **Load:** [vue.md](./references/vue.md)
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### 4. Vanilla JavaScript / HTML (fallback)
|
|
73
|
+
|
|
74
|
+
**Evidence to look for:**
|
|
75
|
+
- No major framework found in `package.json`
|
|
76
|
+
- Plain `.html` files reference a `<script type="module">`
|
|
77
|
+
- Entry point is a plain `.js` or `.ts` file with no framework imports
|
|
78
|
+
- User explicitly asks for vanilla JS or HTML integration
|
|
79
|
+
|
|
80
|
+
→ **Load:** [vanilla-js.md](./references/vanilla-js.md)
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## If the Framework Cannot Be Determined
|
|
85
|
+
|
|
86
|
+
Ask the user directly:
|
|
87
|
+
|
|
88
|
+
> "What framework or platform are you using? (React, Angular, Vue 3, or Vanilla JS / HTML)"
|
|
89
|
+
|
|
90
|
+
Then load the matching reference from the options above.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Framework Reference Files
|
|
95
|
+
|
|
96
|
+
| Framework / Platform | Reference |
|
|
97
|
+
|----------------------|-----------|
|
|
98
|
+
| React | [react.md](./references/react.md) |
|
|
99
|
+
| Angular | [angular.md](./references/angular.md) |
|
|
100
|
+
| Vue 3 | [vue.md](./references/vue.md) |
|
|
101
|
+
| Vanilla JS / HTML | [vanilla-js.md](./references/vanilla-js.md) |
|
|
102
|
+
|
|
103
|
+
Each reference covers:
|
|
104
|
+
|
|
105
|
+
- Installation
|
|
106
|
+
- Theme import (required for styling)
|
|
107
|
+
- Component registration
|
|
108
|
+
- Usage examples
|
|
109
|
+
- TypeScript support
|
|
110
|
+
- Platform-specific considerations
|
|
111
|
+
- Common issues and solutions
|
|
112
|
+
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# Integrating Ignite UI Web Components — Angular
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install igniteui-webcomponents
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
### Step 1 — Register the theme and components
|
|
12
|
+
|
|
13
|
+
In `src/main.ts`, import a theme and register the components before bootstrapping:
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
17
|
+
import { appConfig } from './app/app.config';
|
|
18
|
+
import { AppComponent } from './app/app.component';
|
|
19
|
+
import 'igniteui-webcomponents/themes/light/bootstrap.css';
|
|
20
|
+
import { defineComponents, IgcButtonComponent, IgcInputComponent } from 'igniteui-webcomponents';
|
|
21
|
+
|
|
22
|
+
defineComponents(IgcButtonComponent, IgcInputComponent);
|
|
23
|
+
|
|
24
|
+
bootstrapApplication(AppComponent, appConfig)
|
|
25
|
+
.catch((err) => console.error(err));
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Step 2 — Add `CUSTOM_ELEMENTS_SCHEMA`
|
|
29
|
+
|
|
30
|
+
Angular requires `CUSTOM_ELEMENTS_SCHEMA` to accept custom element tags in templates.
|
|
31
|
+
|
|
32
|
+
**Standalone components** — add the schema to each component that uses Ignite UI elements:
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
36
|
+
|
|
37
|
+
@Component({
|
|
38
|
+
selector: 'app-my-component',
|
|
39
|
+
standalone: true,
|
|
40
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
41
|
+
template: `
|
|
42
|
+
<igc-button variant="contained">Click me</igc-button>
|
|
43
|
+
`
|
|
44
|
+
})
|
|
45
|
+
export class MyComponent {}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**NgModule-based apps** — add the schema once to `AppModule` (or the relevant module):
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
52
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
53
|
+
import { AppComponent } from './app.component';
|
|
54
|
+
|
|
55
|
+
@NgModule({
|
|
56
|
+
declarations: [AppComponent],
|
|
57
|
+
imports: [BrowserModule],
|
|
58
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
59
|
+
bootstrap: [AppComponent]
|
|
60
|
+
})
|
|
61
|
+
export class AppModule {}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Available Themes
|
|
65
|
+
|
|
66
|
+
| Theme | Light | Dark |
|
|
67
|
+
|-----------|--------------------------------------------------------|-------------------------------------------------------|
|
|
68
|
+
| Bootstrap | `igniteui-webcomponents/themes/light/bootstrap.css` | `igniteui-webcomponents/themes/dark/bootstrap.css` |
|
|
69
|
+
| Material | `igniteui-webcomponents/themes/light/material.css` | `igniteui-webcomponents/themes/dark/material.css` |
|
|
70
|
+
| Fluent | `igniteui-webcomponents/themes/light/fluent.css` | `igniteui-webcomponents/themes/dark/fluent.css` |
|
|
71
|
+
| Indigo | `igniteui-webcomponents/themes/light/indigo.css` | `igniteui-webcomponents/themes/dark/indigo.css` |
|
|
72
|
+
|
|
73
|
+
## Usage in Templates
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import { Component, ViewChild, ElementRef, AfterViewInit, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
77
|
+
|
|
78
|
+
@Component({
|
|
79
|
+
selector: 'app-my-component',
|
|
80
|
+
standalone: true,
|
|
81
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
82
|
+
template: `
|
|
83
|
+
<igc-button
|
|
84
|
+
#myButton
|
|
85
|
+
variant="contained"
|
|
86
|
+
(click)="handleClick($event)">
|
|
87
|
+
Click me
|
|
88
|
+
</igc-button>
|
|
89
|
+
|
|
90
|
+
<igc-input
|
|
91
|
+
[label]="inputLabel"
|
|
92
|
+
[placeholder]="'Enter your name'"
|
|
93
|
+
[required]="true"
|
|
94
|
+
(igcChange)="handleChange($event)">
|
|
95
|
+
</igc-input>
|
|
96
|
+
`
|
|
97
|
+
})
|
|
98
|
+
export class MyComponent implements AfterViewInit {
|
|
99
|
+
@ViewChild('myButton') buttonRef!: ElementRef;
|
|
100
|
+
|
|
101
|
+
inputLabel = 'Name';
|
|
102
|
+
|
|
103
|
+
ngAfterViewInit() {
|
|
104
|
+
// Access the native element directly if needed
|
|
105
|
+
const button = this.buttonRef.nativeElement;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
handleClick(event: PointerEvent) {
|
|
109
|
+
console.log('Button clicked');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
handleChange(event: CustomEvent) {
|
|
113
|
+
console.log('Input changed', event.detail);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Working with Complex Properties
|
|
119
|
+
|
|
120
|
+
Use Angular property binding `[property]` to pass objects and arrays:
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
@Component({
|
|
124
|
+
selector: 'app-my-component',
|
|
125
|
+
standalone: true,
|
|
126
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
127
|
+
template: `
|
|
128
|
+
<igc-combo [data]="items"></igc-combo>
|
|
129
|
+
`
|
|
130
|
+
})
|
|
131
|
+
export class MyComponent {
|
|
132
|
+
items = [
|
|
133
|
+
{ value: 1, label: 'Item 1' },
|
|
134
|
+
{ value: 2, label: 'Item 2' },
|
|
135
|
+
];
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Key Considerations
|
|
140
|
+
|
|
141
|
+
| Concern | Details |
|
|
142
|
+
|---------|---------|
|
|
143
|
+
| **CUSTOM_ELEMENTS_SCHEMA** | Required in every module or standalone component that uses `igc-*` tags |
|
|
144
|
+
| **Event binding** | Use Angular syntax: `(igcChange)="handler($event)"` |
|
|
145
|
+
| **Property binding** | Use `[property]="value"` for reactive data and complex types |
|
|
146
|
+
| **Form integration** | Web components work with Angular Forms via `ngModel` or reactive form controls |
|
|
147
|
+
|
|
148
|
+
## TypeScript Support
|
|
149
|
+
|
|
150
|
+
The `igniteui-webcomponents` package automatically registers all component types in `HTMLElementTagNameMap`. DOM queries are fully typed:
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import { defineComponents, IgcButtonComponent } from 'igniteui-webcomponents';
|
|
154
|
+
|
|
155
|
+
defineComponents(IgcButtonComponent);
|
|
156
|
+
|
|
157
|
+
// Automatically typed as IgcButtonComponent | null
|
|
158
|
+
const button = document.querySelector('igc-button');
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Common Issues
|
|
162
|
+
|
|
163
|
+
### Angular template error: "Unknown element"
|
|
164
|
+
|
|
165
|
+
Add `CUSTOM_ELEMENTS_SCHEMA` to the component's `schemas` array (standalone) or to the module (NgModule).
|
|
166
|
+
|
|
167
|
+
### Events not firing
|
|
168
|
+
|
|
169
|
+
Use Angular's event binding syntax `(igcChange)="handler($event)"` — not `(change)`. Ignite UI components emit prefixed custom events (e.g., `igcInput`, `igcChange`).
|
|
170
|
+
|
|
171
|
+
### No styles applied
|
|
172
|
+
|
|
173
|
+
Ensure you import a theme CSS file in `main.ts` before bootstrapping.
|
|
174
|
+
|
|
175
|
+
### Properties not updating
|
|
176
|
+
|
|
177
|
+
Use `[property]="value"` binding for complex or reactive data. Attribute strings (e.g. `label="Name"`) work for primitive values only.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Next Steps
|
|
182
|
+
|
|
183
|
+
- [Optimize bundle size](../../igniteui-wc-optimize-bundle-size/) — import only the components you use
|
|
184
|
+
- [Customize themes](../../igniteui-wc-customize-component-theme/) — apply your brand colors
|
|
185
|
+
- [Component documentation](https://igniteui.github.io/igniteui-webcomponents) — full API reference
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Integrating Ignite UI Web Components — React
|
|
2
|
+
|
|
3
|
+
React integration uses the **`igniteui-react`** package, which provides React-native wrappers around Ignite UI Web Components:
|
|
4
|
+
|
|
5
|
+
- ✅ Native React event handling
|
|
6
|
+
- ✅ Full TypeScript types and IntelliSense for all props
|
|
7
|
+
- ✅ Automatic global type declarations (`HTMLElementTagNameMap`)
|
|
8
|
+
- ✅ camelCase props instead of kebab-case attributes
|
|
9
|
+
- ✅ Seamless complex data binding (objects and arrays work as props)
|
|
10
|
+
- ✅ React DevTools integration
|
|
11
|
+
|
|
12
|
+
Components use the `Igr` prefix (e.g. `IgrButton`, `IgrInput`, `IgrCombo`).
|
|
13
|
+
|
|
14
|
+
### Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install igniteui-react
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Setup
|
|
21
|
+
|
|
22
|
+
Import a theme in your application entry point (`src/main.tsx` or `src/index.tsx`):
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import 'igniteui-webcomponents/themes/light/bootstrap.css';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Available Themes
|
|
29
|
+
|
|
30
|
+
| Theme | Light | Dark |
|
|
31
|
+
|-----------|--------------------------------------------------------|-------------------------------------------------------|
|
|
32
|
+
| Bootstrap | `igniteui-webcomponents/themes/light/bootstrap.css` | `igniteui-webcomponents/themes/dark/bootstrap.css` |
|
|
33
|
+
| Material | `igniteui-webcomponents/themes/light/material.css` | `igniteui-webcomponents/themes/dark/material.css` |
|
|
34
|
+
| Fluent | `igniteui-webcomponents/themes/light/fluent.css` | `igniteui-webcomponents/themes/dark/fluent.css` |
|
|
35
|
+
| Indigo | `igniteui-webcomponents/themes/light/indigo.css` | `igniteui-webcomponents/themes/dark/indigo.css` |
|
|
36
|
+
|
|
37
|
+
### Usage
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { IgrButton, IgrInput } from 'igniteui-react';
|
|
41
|
+
|
|
42
|
+
function MyComponent() {
|
|
43
|
+
// onClick is a standard React mouse event
|
|
44
|
+
const handleClick = (e: React.MouseEvent) => console.log('Clicked');
|
|
45
|
+
|
|
46
|
+
// onChange receives the component's change event
|
|
47
|
+
const handleChange = (e: CustomEvent) => console.log(`Changed: ${e.detail}`);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<div>
|
|
51
|
+
<IgrButton variant="contained" onClick={handleClick}>
|
|
52
|
+
Click me
|
|
53
|
+
</IgrButton>
|
|
54
|
+
|
|
55
|
+
<IgrInput
|
|
56
|
+
label="Name"
|
|
57
|
+
placeholder="Enter your name"
|
|
58
|
+
required
|
|
59
|
+
onChange={handleChange}
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Complex Data
|
|
67
|
+
|
|
68
|
+
Objects and arrays bind directly as props with `igniteui-react`:
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
import { IgrCombo } from 'igniteui-react';
|
|
72
|
+
|
|
73
|
+
function MyComponent() {
|
|
74
|
+
const items = [
|
|
75
|
+
{ value: 1, label: 'Item 1' },
|
|
76
|
+
{ value: 2, label: 'Item 2' },
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
return <IgrCombo data={items} />;
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### TypeScript Support
|
|
84
|
+
|
|
85
|
+
The `igniteui-react` package ships with full type definitions. No extra configuration needed:
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
import { IgrButton } from 'igniteui-react';
|
|
89
|
+
|
|
90
|
+
// TypeScript knows about all IgrButton props
|
|
91
|
+
<IgrButton variant="contained">Click</IgrButton>
|
|
92
|
+
|
|
93
|
+
// DOM queries are also typed automatically (via igniteui-webcomponents peer)
|
|
94
|
+
const button = document.querySelector('igc-button'); // IgcButtonComponent | null
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Common Issues
|
|
100
|
+
|
|
101
|
+
### Components not rendering
|
|
102
|
+
|
|
103
|
+
The `igniteui-react` package registers components automatically on import. Ensure the package is installed and components are imported before the component tree renders.
|
|
104
|
+
|
|
105
|
+
### No styles applied
|
|
106
|
+
|
|
107
|
+
Ensure you import a theme CSS file in your entry point. Without it, components render unstyled.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Next Steps
|
|
112
|
+
|
|
113
|
+
- [Optimize bundle size](../../igniteui-wc-optimize-bundle-size/) — import only the components you use
|
|
114
|
+
- [Customize themes](../../igniteui-wc-customize-component-theme/) — apply your brand colors
|
|
115
|
+
- [igniteui-react on npm](https://www.npmjs.com/package/igniteui-react) — React wrapper documentation
|
|
116
|
+
- [Component documentation](https://igniteui.github.io/igniteui-webcomponents) — full API reference
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Integrating Ignite UI Web Components — Vanilla JavaScript / HTML
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install igniteui-webcomponents
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
In your main JavaScript/TypeScript entry file, import a theme and register the components you need:
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
// 1. Import a theme (required for correct styling)
|
|
15
|
+
import 'igniteui-webcomponents/themes/light/bootstrap.css';
|
|
16
|
+
|
|
17
|
+
// 2. Import and register specific components (recommended)
|
|
18
|
+
import { defineComponents, IgcButtonComponent, IgcInputComponent } from 'igniteui-webcomponents';
|
|
19
|
+
|
|
20
|
+
defineComponents(IgcButtonComponent, IgcInputComponent);
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
To register all components at once (increases bundle size):
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import 'igniteui-webcomponents/themes/light/bootstrap.css';
|
|
27
|
+
import { defineAllComponents } from 'igniteui-webcomponents';
|
|
28
|
+
|
|
29
|
+
defineAllComponents();
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Available Themes
|
|
33
|
+
|
|
34
|
+
| Theme | Light | Dark |
|
|
35
|
+
|-----------|--------------------------------------------------------|-------------------------------------------------------|
|
|
36
|
+
| Bootstrap | `igniteui-webcomponents/themes/light/bootstrap.css` | `igniteui-webcomponents/themes/dark/bootstrap.css` |
|
|
37
|
+
| Material | `igniteui-webcomponents/themes/light/material.css` | `igniteui-webcomponents/themes/dark/material.css` |
|
|
38
|
+
| Fluent | `igniteui-webcomponents/themes/light/fluent.css` | `igniteui-webcomponents/themes/dark/fluent.css` |
|
|
39
|
+
| Indigo | `igniteui-webcomponents/themes/light/indigo.css` | `igniteui-webcomponents/themes/dark/indigo.css` |
|
|
40
|
+
|
|
41
|
+
## Usage in HTML
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<!DOCTYPE html>
|
|
45
|
+
<html>
|
|
46
|
+
<head>
|
|
47
|
+
<script type="module" src="./main.js"></script>
|
|
48
|
+
</head>
|
|
49
|
+
<body>
|
|
50
|
+
<igc-button variant="contained">Click me</igc-button>
|
|
51
|
+
<igc-input label="Name" placeholder="Enter your name"></igc-input>
|
|
52
|
+
</body>
|
|
53
|
+
</html>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## TypeScript Support
|
|
57
|
+
|
|
58
|
+
The `igniteui-webcomponents` package automatically provides global type declarations for all components via `HTMLElementTagNameMap`. DOM queries are fully typed without any extra configuration:
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { defineComponents, IgcButtonComponent } from 'igniteui-webcomponents';
|
|
62
|
+
|
|
63
|
+
defineComponents(IgcButtonComponent);
|
|
64
|
+
|
|
65
|
+
// Automatically typed as IgcButtonComponent | null
|
|
66
|
+
const button = document.querySelector('igc-button');
|
|
67
|
+
button?.setAttribute('variant', 'outlined');
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
You can also import component types directly for annotations:
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import type { IgcButtonComponent } from 'igniteui-webcomponents';
|
|
74
|
+
|
|
75
|
+
const button = document.querySelector('igc-button') as IgcButtonComponent;
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Working with Complex Properties
|
|
79
|
+
|
|
80
|
+
Attributes only accept strings. For objects and arrays, set properties via JavaScript:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
// ❌ Wrong — attributes only accept strings
|
|
84
|
+
// <igc-combo data="[{...}]"></igc-combo>
|
|
85
|
+
|
|
86
|
+
// ✅ Correct — set via DOM property
|
|
87
|
+
const combo = document.querySelector('igc-combo');
|
|
88
|
+
combo.data = [
|
|
89
|
+
{ value: 1, label: 'Item 1' },
|
|
90
|
+
{ value: 2, label: 'Item 2' }
|
|
91
|
+
];
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Common Issues
|
|
95
|
+
|
|
96
|
+
### Components not rendering
|
|
97
|
+
|
|
98
|
+
Register components **before** they appear in the DOM:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
// ❌ Wrong
|
|
102
|
+
document.body.innerHTML = '<igc-button>Click</igc-button>';
|
|
103
|
+
defineComponents(IgcButtonComponent);
|
|
104
|
+
|
|
105
|
+
// ✅ Correct
|
|
106
|
+
defineComponents(IgcButtonComponent);
|
|
107
|
+
document.body.innerHTML = '<igc-button>Click</igc-button>';
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### No styles applied
|
|
111
|
+
|
|
112
|
+
Ensure you import a theme CSS file in your entry point. Without it, components render unstyled.
|
|
113
|
+
|
|
114
|
+
## Next Steps
|
|
115
|
+
|
|
116
|
+
- [Optimize bundle size](../../igniteui-wc-optimize-bundle-size/SKILL.md) — import only the components you use
|
|
117
|
+
- [Customize themes](../../igniteui-wc-customize-component-theme/) — apply your brand colors
|
|
118
|
+
- [Component documentation](https://igniteui.github.io/igniteui-webcomponents) — full API reference
|