File

src/tag/tag-operational.component.ts

Extends

Tag

Metadata

Index

Properties
Inputs
HostBindings
Accessors

Inputs

disabled
Type : boolean
Default value : false
class
Type : string
Default value : ""
Inherited from Tag
Defined in Tag:54
size
Type : "sm" | "md" | "lg"
Default value : "md"
Inherited from Tag
Defined in Tag:52

Tag render size

skeleton
Type : boolean
Default value : false
Inherited from Tag
Defined in Tag:56
type
Type : TagType
Default value : "gray"
Inherited from Tag
Defined in Tag:47

Type of the tag determines the styling

HostBindings

attr.class
Type : string
Inherited from Tag
Defined in Tag:32
attr.role
Type : string
Default value : "button"
attr.tabindex
Type : number
Default value : 0
attr.type
Type : string
Default value : "button"

Properties

buttonType
Type : string
Default value : "button"
Decorators :
@HostBinding('attr.type')
role
Type : string
Default value : "button"
Decorators :
@HostBinding('attr.role')
tabIndex
Type : number
Default value : 0
Decorators :
@HostBinding('attr.tabindex')

Accessors

attrClass
getattrClass()

Remove cds--tag--${this.size} in v7

import {
	ChangeDetectionStrategy,
	Component,
	HostBinding,
	Input
} from "@angular/core";
import { Tag } from "./tag.component";

@Component({
	selector: "cds-tag-operational, ibm-tag-operational",
	template: `
		<ng-container *ngIf="!skeleton">
			<ng-content select="[cdsTagIcon],[ibmTagIcon]"></ng-content>
			<span class="cds--tag__label">
				<ng-content></ng-content>
			</span>
		</ng-container>
	`,
	changeDetection: ChangeDetectionStrategy.OnPush
})
export class TagOperationalComponent extends Tag {
	@HostBinding("attr.role") role = "button";
	@HostBinding("attr.type") buttonType = "button";
	@HostBinding("attr.tabindex") tabIndex = 0;

	@Input() disabled = false;

	/**
	 * @todo
	 * Remove `cds--tag--${this.size}` in v7
	 */
	@HostBinding("attr.class") get attrClass() {
		const disabledClass = this.disabled ? "cds--tag--disabled" : "";
		const sizeClass = `cds--tag--${this.size} cds--layout--size-${this.size}`;
		const skeletonClass = this.skeleton ? "cds--skeleton" : "";

		return `cds--tag cds--tag--operational cds--tag--${this.type} ${disabledClass} ${sizeClass} ${skeletonClass} ${this.class}`;
	}
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""