@@ -49,14 +49,14 @@ export type IgxInputGroupTheme = keyof typeof IgxInputGroupThemeEnum;
4949 selector : 'igx-input-group' ,
5050 templateUrl : 'input-group.component.html' ,
5151 providers : [
52- { provide : IgxInputGroupBase , useExisting : IgxInputGroupComponent }
52+ { provide : IgxInputGroupBase , useExisting : IgxInputGroupComponent } ,
5353 ] ,
5454} )
5555export class IgxInputGroupComponent extends DisplayDensityBase
5656 implements IgxInputGroupBase , AfterContentInit {
5757 private _type : IgxInputGroupType = null ;
5858 private _filled = false ;
59- private _variant : IgxInputGroupTheme = 'material' ;
59+ private _variant : IgxInputGroupTheme ;
6060
6161 /**
6262 * 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
215215 return this . _type || this . _inputGroupType || 'line' ;
216216 }
217217
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+ */
219243 public get theme ( ) : IgxInputGroupTheme {
220244 return this . _variant ;
221245 }
@@ -253,11 +277,13 @@ export class IgxInputGroupComponent extends DisplayDensityBase
253277 }
254278
255279 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+ }
261287 }
262288 /**
263289 * Returns whether the `IgxInputGroupComponent` has hints.
0 commit comments