Skip to content

Commit 65c212b

Browse files
authored
Merge pull request #6721 from IgniteUI/sstoychev/badge-api-9.0
docs(badge): updating igxBadge API docs for new guidelines - 9.0.x
2 parents 5742458 + 82ebfbc commit 65c212b

File tree

1 file changed

+71
-44
lines changed

1 file changed

+71
-44
lines changed

projects/igniteui-angular/src/lib/badge/badge.component.ts

Lines changed: 71 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import { IgxIconModule } from '../icon/index';
44

55
let NEXT_ID = 0;
66

7+
/**
8+
* Determines the igxBadge type
9+
*/
710
export enum IgxBadgeType {
811
PRIMARY = 'primary',
912
INFO = 'info',
@@ -12,28 +15,26 @@ export enum IgxBadgeType {
1215
ERROR = 'error'
1316
}
1417
/**
15-
* **Ignite UI for Angular Badge** -
16-
* [Documentation](https://www.infragistics.com/products/ignite-ui-angular/angular/components/badge.html)
18+
* Badge provides visual notifications used to decorate avatars, menus, etc.
19+
*
20+
* @igxModule IgxBadgeModule
21+
*
22+
* @igxTheme igx-badge-theme
1723
*
24+
* @igxKeywords badge, icon, notification
25+
*
26+
* @igxGroup Data Entry & Display
27+
*
28+
* @remarks
1829
* The Ignite UI Badge is used to decorate avatars, navigation menus, or other components in the
1930
* application when visual notification is needed. They are usually designed as icons with a predefined
2031
* style to communicate information, success, warnings, or errors.
2132
*
22-
* Example:
33+
* @example
2334
* ```html
24-
* <igx-avatar icon="person" roundShape="true" size="small">
25-
* <igx-badge icon="check" type="success" class="badge-style">
26-
* </igx-badge>
35+
* <igx-avatar>
36+
* <igx-badge icon="check" type="success"></igx-badge>
2737
* </igx-avatar>
28-
* ```
29-
* The `badge-style` class is used to position the badge:
30-
* ```css
31-
* .badge-style {
32-
* position: absolute;
33-
* bottom: -6px;
34-
* right:-50px;
35-
* }
36-
* ```
3738
*/
3839
@Component({
3940
selector: 'igx-badge',
@@ -42,88 +43,113 @@ export enum IgxBadgeType {
4243
export class IgxBadgeComponent {
4344

4445
/**
45-
* An @Input property that sets the value of the `id` attribute.
46+
* Sets/gets the `id` of the badge.
47+
*
48+
* @remarks
49+
* If not set, the `id` will have value `"igx-badge-0"`.
50+
*
51+
* @example
4652
* ```html
47-
*<igx-badge id="igx-badge-2" icon="check" type="success" class="badge-style"></igx-badge>
53+
* <igx-badge id="igx-badge-2"></igx-badge>
4854
* ```
4955
*/
5056
@HostBinding('attr.id')
5157
@Input()
5258
public id = `igx-badge-${NEXT_ID++}`;
5359

5460
/**
55-
* An @Input property controlling the type of the badge.
61+
* Sets/gets the type of the badge.
62+
*
63+
* @remarks
5664
* Allowed values are `primary`, `info`, `success`, `warning`, `error`.
5765
* Providing an invalid value won't display a badge.
66+
*
67+
* @example
5868
* ```html
59-
*<igx-badge type="success" icon="check" class="badge-style"></igx-badge>
69+
* <igx-badge type="success"></igx-badge>
6070
* ```
6171
*/
6272
@Input()
6373
public type: string | IgxBadgeType = IgxBadgeType.PRIMARY;
6474

6575
/**
66-
* An @Input property that sets the value to be displayed inside the badge.
76+
* Sets/gets the value to be displayed inside the badge.
77+
*
78+
* @remarks
6779
* If an `icon` property is already set the `icon` will be displayed.
68-
* If neither a `value` nor an `icon` is set the contentent of the badge will be empty.
80+
* If neither a `value` nor an `icon` is set the content of the badge will be empty.
81+
*
82+
* @example
6983
* ```html
70-
*<igx-badge value="11" type="success" class="badge-style"></igx-badge>
84+
* <igx-badge value="11"></igx-badge>
7185
* ```
7286
*/
7387
@Input()
7488
public value = '';
7589

7690
/**
77-
* Set an icon for the badge from the material icons set.
91+
* Sets/gets an icon for the badge from the material icons set.
92+
*
93+
* @remarks
7894
* Has priority over the `value` property.
7995
* If neither a `value` nor an `icon` is set the content of the badge will be empty.
8096
* Providing an invalid value won't display anything.
97+
*
98+
* @example
8199
* ```html
82-
*<igx-badge icon="check" type="success" class="badge-style" value="11"></igx-badge>
100+
* <igx-badge icon="check"></igx-badge>
83101
* ```
84102
*/
85103
@Input()
86104
public icon: string;
87105

88106
/**
89-
* This allows you to set value to role attribute.
90-
*```html
91-
*@ViewChild("MyBadge", { read: IgxBadgeComponent })
92-
*public badge: IgxBadgeComponent;
93-
* //...
94-
*badge.label = "badge-status";
107+
* Sets/gets the role attribute value.
108+
*
109+
* @example
110+
* ```typescript
111+
* @ViewChild("MyBadge", { read: IgxBadgeComponent })
112+
* public badge: IgxBadgeComponent;
113+
*
114+
* badge.role = 'status';
95115
* ```
96116
*/
97117
@HostBinding('attr.role')
98118
public role = 'status';
99119

100120
/**
101-
* This allows you to disable igx-badge class. The default it's applied.
102-
*```html
103-
*@ViewChild("MyBadge", { read: IgxBadgeComponent })
104-
*public badge: IgxBadgeComponent;
105-
* //...
106-
*badge.cssClass = false;
121+
* Sets/gets the the css class to use on the badge.
122+
*
123+
* @example
124+
* ```typescript
125+
* @ViewChild("MyBadge", { read: IgxBadgeComponent })
126+
* public badge: IgxBadgeComponent;
127+
*
128+
* badge.cssClass = 'my-badge-class';
107129
* ```
108130
*/
109131
@HostBinding('class.igx-badge')
110132
public cssClass = 'igx-badge';
111133

112134
/**
113-
* This allows you to set value to aria-label attribute.
114-
*```html
115-
*@ViewChild("MyBadge", { read: IgxBadgeComponent })
116-
*public badge: IgxBadgeComponent;
117-
* //...
118-
*badge.label = "icon-badge";
135+
* Sets/gets the aria-label attribute value.
136+
*
137+
* @example
138+
* ```typescript
139+
* @ViewChild("MyBadge", { read: IgxBadgeComponent })
140+
* public badge: IgxBadgeComponent;
141+
*
142+
* badge.label = 'badge';
119143
* ```
120144
*/
121145
@HostBinding('attr.aria-label')
122146
public label = 'badge';
123147

124148
/**
149+
* Defines a human-readable, accessor, author-localized description for
150+
* the `type` and the `icon` or `value` of the element.
125151
* @hidden
126-
* Defines a human-readable, accessor, author-localized description for the `type` and the `icon` or `value` of the element.
152+
* @internal
127153
*/
128154
get roleDescription() {
129155
let message: string;
@@ -141,9 +167,10 @@ export class IgxBadgeComponent {
141167
}
142168

143169
/**
144-
* @hidden
145170
* Method which makes the name of the class more descriptive.
146171
* This helps the styling of the badges.
172+
* @hidden
173+
* @internal
147174
*/
148175
public setClasses() {
149176
let classes = {};

0 commit comments

Comments
 (0)