File

src/link/link.directive.ts

Description

A convinence directive for applying styling to a link.

Example:

<a href="#" ibmLink>A link</a>

See the vanilla carbon docs for more detail.

Metadata

selector [ibmLink]

Index

Properties
Inputs
HostBindings
Accessors

Inputs

disabled

Set to true to disable link.

Type: boolean

HostBindings

attr.tabindex
attr.tabindex:

Automatically set to -1 when link is disabled.

class.bx--link
class.bx--link:
Default value : true

Properties

Private _disabled
_disabled:

Accessors

disabled
getdisabled()
Returns : boolean
setdisabled(disabled: boolean)

Set to true to disable link.

Parameters :
Name Type Optional Description
disabled boolean
Returns : void
import {
	Directive,
	HostBinding,
	Input
} from "@angular/core";

/**
 * A convinence directive for applying styling to a link.
 *
 * Example:
 *
 * ```hmtl
 * <a href="#" ibmLink>A link</a>
 * ```
 *
 * See the [vanilla carbon docs](http://www.carbondesignsystem.com/components/link/code) for more detail.
 */
@Directive({
	selector: "[ibmLink]"
})

export class Link {
	@HostBinding("class.bx--link") baseClass = true;

	/**
	 * Automatically set to `-1` when link is disabled.
	 * @memberof Link
	 */
	@HostBinding("attr.tabindex") tabindex;

	/**
	 * Set to true to disable link.
	 * @memberof Link
	 */
	@Input()
	@HostBinding("attr.aria-disabled")
	set disabled(disabled: boolean) {
		this._disabled = disabled;
		this.tabindex = this.disabled ? -1 : null;
	}

	get disabled(): boolean {
		return this._disabled;
	}

	private _disabled;
}

results matching ""

    No results matching ""