src/tag/tag.component.ts
Component that represents a tag for labelling/categorizing using keywords. Get started with importing the module:
import { TagModule } from 'carbon-components-angular';| selector | cds-tag, ibm-tag |
| template | |
Inputs |
HostBindings |
Accessors |
| class | |
Type : string
|
|
Default value : ""
|
|
|
Defined in src/tag/tag.component.ts:47
|
|
| size | |
Type : "sm" | "md"
|
|
Default value : "md"
|
|
|
Defined in src/tag/tag.component.ts:45
|
|
|
Tag render size |
|
| type | |
Type : TagType
|
|
Default value : "gray"
|
|
|
Defined in src/tag/tag.component.ts:40
|
|
|
Type of the tag determines the styling |
|
| attr.class |
Type : string
|
|
Defined in src/tag/tag.component.ts:49
|
| attrClass |
getattrClass()
|
|
Defined in src/tag/tag.component.ts:49
|
import {
Component,
Input,
HostBinding
} from "@angular/core";
/**
* Supported tag types for carbon v10
*/
export type TagType = "red" |
"magenta" |
"purple" |
"blue" |
"cyan" |
"teal" |
"green" |
"gray" |
"cool-gray" |
"warm-gray" |
"high-contrast" |
"outline";
/**
* Component that represents a tag for labelling/categorizing using keywords. Get started with importing the module:
*
* ```typescript
* import { TagModule } from 'carbon-components-angular';
* ```
*
* [See demo](../../?path=/story/components-tag--basic)
*/
@Component({
selector: "cds-tag, ibm-tag",
template: `<ng-content></ng-content>`
})
export class Tag {
/**
* Type of the tag determines the styling
*/
@Input() type: TagType = "gray";
/**
* Tag render size
*/
@Input() size: "sm" | "md" = "md";
@Input() class = "";
@HostBinding("attr.class") get attrClass() {
return `cds--tag cds--tag--${this.type} cds--tag--${this.size} cds--layout--size-${this.size} ${this.class}`;
}
}