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.
@@ -0,0 +1,181 @@
1
+ # Integrating Ignite UI Web Components — Vue 3
2
+
3
+ ## Installation
4
+
5
+ ```bash
6
+ npm install igniteui-webcomponents
7
+ ```
8
+
9
+ ## Setup
10
+
11
+ ### Step 1 — Configure Vue to recognize custom elements
12
+
13
+ Vue needs to know which tags are custom elements so it does not warn about unknown components.
14
+
15
+ **With Vite** (`vite.config.ts`):
16
+
17
+ ```typescript
18
+ import { defineConfig } from 'vite';
19
+ import vue from '@vitejs/plugin-vue';
20
+
21
+ export default defineConfig({
22
+ plugins: [
23
+ vue({
24
+ template: {
25
+ compilerOptions: {
26
+ // Treat all igc-* tags as custom elements
27
+ isCustomElement: (tag) => tag.startsWith('igc-')
28
+ }
29
+ }
30
+ })
31
+ ]
32
+ });
33
+ ```
34
+
35
+ **With Vue CLI** (`vue.config.js`):
36
+
37
+ ```javascript
38
+ module.exports = {
39
+ chainWebpack: config => {
40
+ config.module
41
+ .rule('vue')
42
+ .use('vue-loader')
43
+ .tap(options => ({
44
+ ...options,
45
+ compilerOptions: {
46
+ isCustomElement: tag => tag.startsWith('igc-')
47
+ }
48
+ }));
49
+ }
50
+ };
51
+ ```
52
+
53
+ ### Step 2 — Register the theme and components
54
+
55
+ In `src/main.ts`, import a theme and register the components before mounting:
56
+
57
+ ```typescript
58
+ import { createApp } from 'vue';
59
+ import App from './App.vue';
60
+ import 'igniteui-webcomponents/themes/light/bootstrap.css';
61
+ import { defineComponents, IgcButtonComponent, IgcInputComponent } from 'igniteui-webcomponents';
62
+
63
+ defineComponents(IgcButtonComponent, IgcInputComponent);
64
+
65
+ createApp(App).mount('#app');
66
+ ```
67
+
68
+ ## Available Themes
69
+
70
+ | Theme | Light | Dark |
71
+ |-----------|--------------------------------------------------------|-------------------------------------------------------|
72
+ | Bootstrap | `igniteui-webcomponents/themes/light/bootstrap.css` | `igniteui-webcomponents/themes/dark/bootstrap.css` |
73
+ | Material | `igniteui-webcomponents/themes/light/material.css` | `igniteui-webcomponents/themes/dark/material.css` |
74
+ | Fluent | `igniteui-webcomponents/themes/light/fluent.css` | `igniteui-webcomponents/themes/dark/fluent.css` |
75
+ | Indigo | `igniteui-webcomponents/themes/light/indigo.css` | `igniteui-webcomponents/themes/dark/indigo.css` |
76
+
77
+ ## Usage in Components
78
+
79
+ ```vue
80
+ <template>
81
+ <div>
82
+ <igc-button variant="contained" @click="handleClick">
83
+ Click me
84
+ </igc-button>
85
+
86
+ <igc-input
87
+ :label="inputLabel"
88
+ placeholder="Enter your name"
89
+ :required="true"
90
+ @igcChange="handleChange">
91
+ </igc-input>
92
+ </div>
93
+ </template>
94
+
95
+ <script setup lang="ts">
96
+ import { ref } from 'vue';
97
+
98
+ const inputLabel = ref('Name');
99
+
100
+ const handleClick = () => {
101
+ console.log('Button clicked');
102
+ };
103
+
104
+ const handleChange = (event: CustomEvent) => {
105
+ console.log('Input changed', event.detail);
106
+ };
107
+ </script>
108
+ ```
109
+
110
+ ## Working with Complex Properties
111
+
112
+ Attributes only accept strings. Pass objects and arrays using a template ref:
113
+
114
+ ```vue
115
+ <template>
116
+ <igc-combo ref="comboRef"></igc-combo>
117
+ </template>
118
+
119
+ <script setup lang="ts">
120
+ import { ref, onMounted } from 'vue';
121
+
122
+ const comboRef = ref<HTMLElement | null>(null);
123
+
124
+ onMounted(() => {
125
+ if (comboRef.value) {
126
+ (comboRef.value as any).data = [
127
+ { value: 1, label: 'Item 1' },
128
+ { value: 2, label: 'Item 2' },
129
+ ];
130
+ }
131
+ });
132
+ </script>
133
+ ```
134
+
135
+ ## Key Considerations
136
+
137
+ | Concern | Details |
138
+ |---------|---------|
139
+ | **isCustomElement** | Required in Vite/CLI config so Vue doesn't treat `igc-*` tags as unresolved components |
140
+ | **Event binding** | Use `@igcInput`, `@igcChange`, etc. — not `@input` or `@change` |
141
+ | **Property binding** | Use `:property="value"` or `v-bind:property="value"` for reactive data |
142
+ | **Complex data** | Use a template ref and set the property in `onMounted` |
143
+
144
+ ## TypeScript Support
145
+
146
+ The `igniteui-webcomponents` package automatically registers all component types in `HTMLElementTagNameMap`. DOM queries are fully typed:
147
+
148
+ ```typescript
149
+ import { defineComponents, IgcButtonComponent } from 'igniteui-webcomponents';
150
+
151
+ defineComponents(IgcButtonComponent);
152
+
153
+ // Automatically typed as IgcButtonComponent | null
154
+ const button = document.querySelector('igc-button');
155
+ ```
156
+
157
+ ## Common Issues
158
+
159
+ ### Vue warns "Unknown custom element: igc-button"
160
+
161
+ Configure `isCustomElement` in `vite.config.ts` (or `vue.config.js`) so Vue skips resolution for `igc-*` tags.
162
+
163
+ ### Events not firing
164
+
165
+ Use Vue's `@igcInput` / `@igcChange` syntax. Ignite UI components emit prefixed custom events — standard DOM events like `input` or `change` behave differently.
166
+
167
+ ### No styles applied
168
+
169
+ Ensure you import a theme CSS file in `main.ts` before `createApp`. Without it, components render unstyled.
170
+
171
+ ### Complex data not reflecting
172
+
173
+ Set objects and arrays via a `ref` in `onMounted`. Do not bind them as HTML attributes — attributes only accept serialized strings.
174
+
175
+ ---
176
+
177
+ ## Next Steps
178
+
179
+ - [Optimize bundle size](../../igniteui-wc-optimize-bundle-size/) — import only the components you use
180
+ - [Customize themes](../../igniteui-wc-customize-component-theme/) — apply your brand colors
181
+ - [Component documentation](https://igniteui.github.io/igniteui-webcomponents) — full API reference