@@ -49,14 +49,14 @@ export type IgxInputGroupTheme = keyof typeof IgxInputGroupThemeEnum;
49
49
selector : 'igx-input-group' ,
50
50
templateUrl : 'input-group.component.html' ,
51
51
providers : [
52
- { provide : IgxInputGroupBase , useExisting : IgxInputGroupComponent }
52
+ { provide : IgxInputGroupBase , useExisting : IgxInputGroupComponent } ,
53
53
] ,
54
54
} )
55
55
export class IgxInputGroupComponent extends DisplayDensityBase
56
56
implements IgxInputGroupBase , AfterContentInit {
57
57
private _type : IgxInputGroupType = null ;
58
58
private _filled = false ;
59
- private _variant : IgxInputGroupTheme = 'material' ;
59
+ private _variant : IgxInputGroupTheme ;
60
60
61
61
/**
62
62
* An @Input property that sets the value of `id` attribute. If not provided it will be automatically generated.
@@ -215,7 +215,31 @@ export class IgxInputGroupComponent extends DisplayDensityBase
215
215
return this . _type || this . _inputGroupType || 'line' ;
216
216
}
217
217
218
- /** @hidden @internal */
218
+ /**
219
+ * Sets the theme of the input.
220
+ * Allowed values of type IgxInputGroupTheme.
221
+ * ```typescript
222
+ * @ViewChild ("MyInputGroup")
223
+ * public inputGroup: IgxInputGroupComponent;
224
+ * ngAfterViewInit() {
225
+ * let inputTheme = 'fluent';
226
+ * }
227
+ */
228
+ @Input ( )
229
+ public set theme ( variant : IgxInputGroupTheme ) {
230
+ this . _variant = variant ;
231
+ }
232
+
233
+ /**
234
+ * Returns the theme of the input.
235
+ * The returned value is of tyep IgxInputGroupType.
236
+ * ```typescript
237
+ * @ViewChild ("MyInputGroup")
238
+ * public inputGroup: IgxInputGroupComponent;
239
+ * ngAfterViewInit() {
240
+ * let inputTheme = this.inputGroup.theme;
241
+ * }
242
+ */
219
243
public get theme ( ) : IgxInputGroupTheme {
220
244
return this . _variant ;
221
245
}
@@ -253,11 +277,13 @@ export class IgxInputGroupComponent extends DisplayDensityBase
253
277
}
254
278
255
279
ngAfterContentInit ( ) {
256
- const variant = this . document . defaultView
257
- . getComputedStyle ( this . element . nativeElement )
258
- . getPropertyValue ( '--igx-input-group-variant' )
259
- . trim ( ) ;
260
- this . _variant = variant as IgxInputGroupTheme ;
280
+ if ( ! this . theme ) {
281
+ const variant = this . document . defaultView
282
+ . getComputedStyle ( this . element . nativeElement )
283
+ . getPropertyValue ( '--igx-input-group-variant' )
284
+ . trim ( ) ;
285
+ this . _variant = variant as IgxInputGroupTheme ;
286
+ }
261
287
}
262
288
/**
263
289
* Returns whether the `IgxInputGroupComponent` has hints.
0 commit comments