Skip to content

Commit 98b9efa

Browse files
authored
Merge pull request #6669 from IgniteUI/dkamburov/radio-group-api
docs(igxRadioGroup): Update API docs for igxRadioGroup directive
2 parents ab6d9b1 + ebfff8e commit 98b9efa

File tree

1 file changed

+87
-44
lines changed

1 file changed

+87
-44
lines changed

projects/igniteui-angular/src/lib/directives/radio/radio-group.directive.ts

+87-44
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,20 @@ const noop = () => { };
2020
let nextId = 0;
2121

2222
/**
23-
* **Ignite UI for Angular Radio Group** -
24-
* [Documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/radio_button.html)
23+
* Radio group directive renders set of radio buttons.
2524
*
25+
* @igxModule IgxRadioModule
26+
*
27+
* @igxTheme igx-radio-theme
28+
*
29+
* @igxKeywords radiogroup, radio, button, input
30+
*
31+
* @igxGroup Data Entry & Display
32+
*
33+
* @remarks
2634
* The Ignite UI Radio Group allows the user to select a single option from an available set of options that are listed side by side.
2735
*
28-
* Example:
36+
* @example:
2937
* ```html
3038
* <igx-radio-group name="radioGroup">
3139
* <igx-radio *ngFor="let item of ['Foo', 'Bar', 'Baz']" value="{{item}}">
@@ -42,22 +50,21 @@ let nextId = 0;
4250
export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAccessor, OnDestroy {
4351
/**
4452
* Returns reference to the child radio buttons.
53+
*
54+
* @example
4555
* ```typescript
4656
* let radioButtons = this.radioGroup.radioButtons;
4757
* ```
48-
* @memberof IgxRadioGroupDirective
4958
*/
5059
@ContentChildren(IgxRadioComponent, { descendants: true }) public radioButtons: QueryList<IgxRadioComponent>;
5160

5261
/**
5362
* Sets/gets the `value` attribute.
63+
*
64+
* @example
5465
* ```html
5566
* <igx-radio-group [value] = "'radioButtonValue'"></igx-radio-group>
5667
* ```
57-
* ```typescript
58-
* let value = this.radioGroup.value;
59-
* ```
60-
* @memberof IgxRadioGroupDirective
6168
*/
6269
@Input()
6370
get value(): any { return this._value; }
@@ -70,13 +77,11 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
7077

7178
/**
7279
* Sets/gets the `name` attribute of the radio group component. All child radio buttons inherits this name.
80+
*
81+
* @example
7382
* ```html
7483
* <igx-radio-group name = "Radio1"></igx-radio-group>
7584
* ```
76-
* ```typescript
77-
* let name = this.radioGroup.name;
78-
* ```
79-
* @memberof IgxRadioGroupDirective
8085
*/
8186
@Input()
8287
get name(): string { return this._name; }
@@ -89,14 +94,14 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
8994

9095
/**
9196
* Sets/gets whether the radio group is required.
97+
*
98+
* @remarks
9299
* If not set, `required` will have value `false`.
100+
*
101+
* @example
93102
* ```html
94103
* <igx-radio-group [required] = "true"></igx-radio-group>
95104
* ```
96-
* ```typescript
97-
* let isRequired = this.radioGroup.required;
98-
* ```
99-
* @memberof IgxRadioGroupDirective
100105
*/
101106
@Input()
102107
get required(): boolean { return this._required; }
@@ -109,10 +114,11 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
109114

110115
/**
111116
* An @Input property that allows you to disable the radio group. By default it's false.
112-
* ```html
117+
*
118+
* @example
119+
* ```html
113120
* <igx-radio-group [disabled]="true"></igx-radio-group>
114121
* ```
115-
* @memberof IgxRadioGroupDirective
116122
*/
117123
@Input()
118124
get disabled(): boolean { return this._disabled; }
@@ -125,14 +131,14 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
125131

126132
/**
127133
* Sets/gets the position of the `label` in the child radio buttons.
134+
*
135+
* @remarks
128136
* If not set, `labelPosition` will have value `"after"`.
137+
*
138+
* @example
129139
* ```html
130140
* <igx-radio-group labelPosition = "before"></igx-radio-group>
131141
* ```
132-
* ```typescript
133-
* let labelPosition = this.radioGroup.labelPosition;
134-
* ```
135-
* @memberof IgxRadioGroupDirective
136142
*/
137143
@Input()
138144
get labelPosition(): RadioLabelPosition | string { return this._labelPosition; }
@@ -145,11 +151,12 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
145151

146152
/**
147153
* Sets/gets the selected child radio button.
154+
*
155+
* @example
148156
* ```typescript
149157
* let selectedButton = this.radioGroup.selected;
150158
* this.radioGroup.selected = selectedButton;
151159
* ```
152-
* @memberof IgxRadioGroupDirective
153160
*/
154161
@Input()
155162
get selected() { return this._selected; }
@@ -162,52 +169,69 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
162169

163170
/**
164171
* An event that is emitted after the radio group `value` is changed.
172+
*
173+
* @remarks
165174
* Provides references to the selected `IgxRadioComponent` and the `value` property as event arguments.
166-
* @memberof IgxRadioGroupDirective
175+
*
176+
* @example
177+
* ```html
178+
* <igx-radio-group (change)="handler($event)"></igx-radio-group>
179+
* ```
167180
*/
168181
@Output()
169182
readonly change: EventEmitter<IChangeRadioEventArgs> = new EventEmitter<IChangeRadioEventArgs>();
170183

171184
/**
172-
*@hidden
185+
* The css class applied to the component.
186+
* @hidden
187+
* @internal
173188
*/
174189
@HostBinding('class.igx-radio-group')
175190
public cssClass = 'igx-radio-group';
176191

177192
/**
178-
*@hidden
193+
* @hidden
194+
* @internal
179195
*/
180196
private _onChangeCallback: (_: any) => void = noop;
181197
/**
182-
*@hidden
198+
* @hidden
199+
* @internal
183200
*/
184201
private _name = `igx-radio-group-${nextId++}`;
185202
/**
186-
*@hidden
203+
* @hidden
204+
* @internal
187205
*/
188206
private _value: any = null;
189207
/**
190-
*@hidden
208+
* @hidden
209+
* @internal
191210
*/
192211
private _selected: IgxRadioComponent | null = null;
193212
/**
194-
*@hidden
213+
* @hidden
214+
* @internal
195215
*/
196216
private _isInitialized = false;
197217
/**
198-
*@hidden
218+
* @hidden
219+
* @internal
199220
*/
200221
private _labelPosition: RadioLabelPosition | string = 'after';
201222
/**
202-
*@hidden
223+
* @hidden
224+
* @internal
203225
*/
204226
private _disabled = false;
205227
/**
206-
*@hidden
228+
* @hidden
229+
* @internal
207230
*/
208231
private _required = false;
209232
/**
210-
*@hidden
233+
* @hidden
234+
* @internal
211235
*/
212236
private destroy$ = new Subject<boolean>();
213237

@@ -220,8 +244,13 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
220244
}
221245

222246
/**
247+
* Sets the "checked" property value on the radio input element.
248+
*
249+
* @remarks
223250
* Checks whether the provided value is consistent to the current radio button.
224251
* If it is, the checked attribute will have value `true` and selected property will contain the selected `IgxRadioComponent`.
252+
*
253+
* @example
225254
* ```typescript
226255
* this.radioGroup.writeValue('radioButtonValue');
227256
* ```
@@ -231,12 +260,18 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
231260
}
232261

233262
/**
234-
*@hidden
263+
* Registers a function called when the control value changes.
264+
*
265+
* @hidden
266+
* @internal
235267
*/
236268
public registerOnChange(fn: (_: any) => void) { this._onChangeCallback = fn; }
237269

238270
/**
239-
*@hidden
271+
* Registers a function called when the control is touched.
272+
*
273+
* @hidden
274+
* @internal
240275
*/
241276
public registerOnTouched(fn: () => void) {
242277
if (this.radioButtons) {
@@ -247,15 +282,17 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
247282
}
248283

249284
/**
250-
*@hidden
285+
* @hidden
286+
* @internal
251287
*/
252288
public ngOnDestroy(): void {
253289
this.destroy$.next(true);
254290
this.destroy$.complete();
255291
}
256292

257293
/**
258-
*@hidden
294+
* @hidden
295+
* @internal
259296
*/
260297
private _initRadioButtons() {
261298
if (this.radioButtons) {
@@ -274,7 +311,8 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
274311
}
275312

276313
/**
277-
*@hidden
314+
* @hidden
315+
* @internal
278316
*/
279317
private _selectedRadioButtonChanged(args: IChangeRadioEventArgs) {
280318
if (this._selected !== args.radio) {
@@ -293,7 +331,8 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
293331
}
294332

295333
/**
296-
*@hidden
334+
* @hidden
335+
* @internal
297336
*/
298337
private _setRadioButtonNames() {
299338
if (this.radioButtons) {
@@ -304,7 +343,8 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
304343
}
305344

306345
/**
307-
*@hidden
346+
* @hidden
347+
* @internal
308348
*/
309349
private _selectRadioButton() {
310350
if (this.radioButtons) {
@@ -336,7 +376,8 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
336376
}
337377

338378
/**
339-
*@hidden
379+
* @hidden
380+
* @internal
340381
*/
341382
private _setRadioButtonLabelPosition() {
342383
if (this.radioButtons) {
@@ -347,7 +388,8 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
347388
}
348389

349390
/**
350-
*@hidden
391+
* @hidden
392+
* @internal
351393
*/
352394
private _disableRadioButtons() {
353395
if (this.radioButtons) {
@@ -358,7 +400,8 @@ export class IgxRadioGroupDirective implements AfterContentInit, ControlValueAcc
358400
}
359401

360402
/**
361-
*@hidden
403+
* @hidden
404+
* @internal
362405
*/
363406
private _setRadioButtonsRequired() {
364407
if (this.radioButtons) {

0 commit comments

Comments
 (0)