File

src/input/input.directive.ts

Description

A directive for applying styling to an input element.

Example:

Example :
<input cdsText/>

See the vanilla carbon docs for more detail.

Metadata

Index

Properties
Inputs
HostBindings
Accessors

Inputs

invalid
Type : boolean
Default value : false
size
Type : "sm" | "md" | "lg"
Default value : "md"

Input field render size

skeleton
Type : boolean
Default value : false
theme
Type : "light" | "dark"
Default value : "dark"
warn
Type : boolean
Default value : false

HostBindings

attr.data-invalid
Type : boolean
class.cds--layout--size-lg
Type : boolean
class.cds--layout--size-md
Type : boolean
class.cds--layout--size-sm
Type : boolean
class.cds--text-input
Type : boolean
Default value : true
class.cds--text-input--lg
Type : boolean
class.cds--text-input--light
Type : boolean
class.cds--text-input--md
Type : boolean
class.cds--text-input--sm
Type : boolean

Properties

inputClass
Default value : true
Decorators :
@HostBinding('class.cds--text-input')

Accessors

isSizeSm
getisSizeSm()
isSizeMd
getisSizeMd()
isSizelg
getisSizelg()
sizeSm
getsizeSm()
sizeMd
getsizeMd()
sizelg
getsizelg()
isLightTheme
getisLightTheme()
getInvalidAttribute
getgetInvalidAttribute()
import { Directive, HostBinding, Input } from "@angular/core";

/**
 * A directive for applying styling to an input element.
 *
 * Example:
 *
 * ```html
 * <input cdsText/>
 * ```
 *
 * See the [vanilla carbon docs](http://www.carbondesignsystem.com/components/text-input/code) for more detail.
 */
@Directive({
	selector: "[cdsText], [ibmText]"
})
export class TextInput {
	/**
	 * @deprecated since v5 - Use `cdsLayer` directive instead
	 * `light` or `dark` input theme
	 */
	@Input() theme: "light" | "dark" = "dark";

	/**
	 * Input field render size
	 */
	@Input() size: "sm" | "md" | "lg" = "md";

	@HostBinding("class.cds--text-input") inputClass = true;

	/**
	 * @todo - remove `cds--text-input--${size}` classes in v12
	 */
	@HostBinding("class.cds--text-input--sm") get isSizeSm() {
		return this.size === "sm";
	}
	@HostBinding("class.cds--text-input--md") get isSizeMd() {
		return this.size === "md";
	}
	@HostBinding("class.cds--text-input--lg") get isSizelg() {
		return this.size === "lg";
	}

	// Size
	@HostBinding("class.cds--layout--size-sm") get sizeSm() {
		return this.size === "sm";
	}
	@HostBinding("class.cds--layout--size-md") get sizeMd() {
		return this.size === "md";
	}
	@HostBinding("class.cds--layout--size-lg") get sizelg() {
		return this.size === "lg";
	}

	@HostBinding("class.cds--text-input--invalid") @Input() invalid = false;
	@HostBinding("class.cds--text-input--warning") @Input() warn = false;
	@HostBinding("class.cds--skeleton") @Input() skeleton = false;
	@HostBinding("class.cds--text-input--light") get isLightTheme() {
		return this.theme === "light";
	}

	@HostBinding("attr.data-invalid") get getInvalidAttribute() {
		return this.invalid ? true : undefined;
	}

}

results matching ""

    No results matching ""