File

src/link/link.directive.ts

Description

A convinence directive for applying styling to a link.

See demo

Example:

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

See the vanilla carbon docs for more detail.

../../iframe.html?id=link--basic

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()
setdisabled(disabled: boolean)

Set to true to disable link.

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

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


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

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

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

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

	private _disabled;
}

result-matching ""

    No results matching ""