carbon-components-angular
Version:
Next generation components
1,314 lines (1,180 loc) • 75.4 kB
HTML
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>carbon-components-angular documentation</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
<link rel="stylesheet" href="../styles/style.css">
<link rel="stylesheet" href="../styles/dark.css">
<style>
footer.carbon {
position: absolute;
bottom: 0;
width: 100%;
z-index: 9999;
}
#root > div {
/*
* Subtracting the height of the footer to prevent
* overlaying the footer ontop of content
*/
height: calc(100vh - 48px);
}
</style>
</head>
<body>
<script>
// Blocking script to avoid flickering dark mode
// Dark mode toggle button
var useDark = window.matchMedia('(prefers-color-scheme: dark)');
var darkModeState = useDark.matches;
var $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
var $darkModeToggles = document.querySelectorAll('.dark-mode-switch');
var darkModeStateLocal = localStorage.getItem('compodoc_darkmode-state');
function checkToggle(check) {
for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
$darkModeToggleSwitchers[i].checked = check;
}
}
function toggleDarkMode(state) {
if (window.localStorage) {
localStorage.setItem('compodoc_darkmode-state', state);
}
checkToggle(state);
const hasClass = document.body.classList.contains('dark');
if (state) {
for (var i = 0; i < $darkModeToggles.length; i++) {
$darkModeToggles[i].classList.add('dark');
}
if (!hasClass) {
document.body.classList.add('dark');
}
} else {
for (var i = 0; i < $darkModeToggles.length; i++) {
$darkModeToggles[i].classList.remove('dark');
}
if (hasClass) {
document.body.classList.remove('dark');
}
}
}
useDark.addEventListener('change', function (evt) {
toggleDarkMode(evt.matches);
});
if (darkModeStateLocal) {
darkModeState = darkModeStateLocal === 'true';
}
toggleDarkMode(darkModeState);
</script>
<div class="navbar navbar-default navbar-fixed-top d-md-none p-0">
<div class="d-flex">
<a href="../" class="navbar-brand">carbon-components-angular documentation</a>
<button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
</div>
</div>
<div class="xs-menu menu" id="mobile-menu">
<div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
</div>
<div class="container-fluid main">
<div class="row main">
<div class="d-none d-md-block menu">
<compodoc-menu mode="normal"></compodoc-menu>
</div>
<!-- START CONTENT -->
<div class="content component">
<div class="content-data">
<ol class="breadcrumb">
<li class="breadcrumb-item">Components</li>
<li class="breadcrumb-item"
>
Label</li>
</ol>
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a href="#info" class="nav-link active"
role="tab" id="info-tab" data-bs-toggle="tab" data-link="info">Info</a>
</li>
<li class="nav-item">
<a href="#source" class="nav-link"
role="tab" id="source-tab" data-bs-toggle="tab" data-link="source">Source</a>
</li>
<li class="nav-item">
<a href="#tree" class="nav-link"
role="tab" id="tree-tab" data-bs-toggle="tab" data-link="dom-tree">DOM Tree</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade active in" id="info"><p class="comment">
<h3>File</h3>
</p>
<p class="comment">
<code>src/input/label.component.ts</code>
</p>
<p class="comment">
<h3>Description</h3>
</p>
<p class="comment">
<p>Get started with importing the module:</p>
<b>Example :</b><div><pre class="line-numbers"><code class="language-typescript">import { InputModule } from 'carbon-components-angular';</code></pre></div><p>To prevent attribute drilling, use <code>ibm-text-label</code> or <code>ibm-textarea-label</code> components</p>
<b>Example :</b><div><pre class="line-numbers"><code class="language-html"><cds-label>
Label
<input cdsText type="text" class="input-field">
</cds-label></code></pre></div><p><a href="../../?path=/story/components-input--basic">See demo</a></p>
</p>
<p class="comment">
<h3>Implements</h3>
</p>
<p class="comment">
<code>AfterContentInit</code>
<code>AfterViewInit</code>
</p>
<section data-compodoc="block-metadata">
<h3>Metadata</h3>
<table class="table table-sm table-hover metadata">
<tbody>
<tr>
<td class="col-md-3">selector</td>
<td class="col-md-9"><code>cds-label, ibm-label</code></td>
</tr>
<tr>
<td class="col-md-3">template</td>
<td class="col-md-9"><pre class="line-numbers"><code class="language-html"><ng-template #inputContentTemplate>
<ng-content select="input,textarea,div"></ng-content>
</ng-template>
<ng-template #labelContentTemplate>
<ng-content></ng-content>
</ng-template>
<ng-container [ngSwitch]="type">
<ng-container *ngSwitchCase="'TextArea'">
<cds-textarea-label
[labelInputID]="labelInputID"
[disabled]="disabled"
[skeleton]="skeleton"
[helperText]="helperText"
[invalid]="invalid"
[invalidText]="invalidText"
[warn]="warn"
[warnText]="warnText"
[ariaLabel]="ariaLabel"
[labelTemplate]="labelContentTemplate"
[textAreaTemplate]="inputContentTemplate">
</cds-textarea-label>
</ng-container>
<ng-container *ngSwitchCase="'TextInput'">
<cds-text-label
[labelInputID]="labelInputID"
[disabled]="disabled"
[skeleton]="skeleton"
[helperText]="helperText"
[invalid]="invalid"
[invalidText]="invalidText"
[warn]="warn"
[warnText]="warnText"
[ariaLabel]="ariaLabel"
[labelTemplate]="labelContentTemplate"
[textInputTemplate]="inputContentTemplate">
</cds-text-label>
</ng-container>
<ng-container *ngSwitchCase="'PasswordInput'">
<cds-password-label
[labelInputID]="labelInputID"
[disabled]="disabled"
[skeleton]="skeleton"
[helperText]="helperText"
[invalid]="invalid"
[invalidText]="invalidText"
[warn]="warn"
[warnText]="warnText"
[ariaLabel]="ariaLabel"
[labelTemplate]="labelContentTemplate"
[passwordInputTemplate]="inputContentTemplate">
</cds-password-label>
</ng-container>
<ng-container *ngSwitchDefault>
<ng-template [ngTemplateOutlet]="default"></ng-template>
</ng-container>
</ng-container>
<ng-template #default>
<label
[for]="labelInputID"
[attr.aria-label]="ariaLabel"
class="cds--label"
[ngClass]="{
'cds--label--disabled': disabled,
'cds--skeleton': skeleton
}">
<ng-template [ngTemplateOutlet]="labelContentTemplate"></ng-template>
</label>
<div
class="cds--text-input__field-wrapper"
[ngClass]="{
'cds--text-input__field-wrapper--warning': warn
}"
[attr.data-invalid]="(invalid ? true : null)"
#wrapper>
<svg
*ngIf="invalid"
cdsIcon="warning--filled"
size="16"
class="cds--text-input__invalid-icon">
</svg>
<svg
*ngIf="!invalid && warn"
cdsIcon="warning--alt--filled"
size="16"
class="cds--text-input__invalid-icon cds--text-input__invalid-icon--warning">
</svg>
<ng-template [ngTemplateOutlet]="inputContentTemplate"></ng-template>
</div>
<div
*ngIf="!skeleton && helperText && !invalid && !warn"
class="cds--form__helper-text"
[ngClass]="{'cds--form__helper-text--disabled': disabled}">
<ng-container *ngIf="!isTemplate(helperText)">{{helperText}}</ng-container>
<ng-template *ngIf="isTemplate(helperText)" [ngTemplateOutlet]="helperText"></ng-template>
</div>
<div *ngIf="invalid" class="cds--form-requirement">
<ng-container *ngIf="!isTemplate(invalidText)">{{invalidText}}</ng-container>
<ng-template *ngIf="isTemplate(invalidText)" [ngTemplateOutlet]="invalidText"></ng-template>
</div>
<div *ngIf="!invalid && warn" class="cds--form-requirement">
<ng-container *ngIf="!isTemplate(warnText)">{{warnText}}</ng-container>
<ng-template *ngIf="isTemplate(warnText)" [ngTemplateOutlet]="warnText"></ng-template>
</div>
</ng-template>
</code></pre></td>
</tr>
</tbody>
</table>
</section>
<section data-compodoc="block-index">
<h3 id="index">Index</h3>
<table class="table table-sm table-bordered index-table">
<tbody>
<tr>
<td class="col-md-4">
<h6><b>Properties</b></h6>
</td>
</tr>
<tr>
<td class="col-md-4">
<ul class="index-list">
<li>
<span class="modifier">Static</span>
<a href="#labelCounter" >labelCounter</a>
</li>
<li>
<span class="modifier"></span>
<a href="#passwordInput" >passwordInput</a>
</li>
<li>
<span class="modifier"></span>
<a href="#textArea" >textArea</a>
</li>
<li>
<span class="modifier"></span>
<a href="#textInput" >textInput</a>
</li>
<li>
<a href="#type" >type</a>
</li>
<li>
<span class="modifier"></span>
<a href="#wrapper" >wrapper</a>
</li>
</ul>
</td>
</tr>
<tr>
<td class="col-md-4">
<h6><b>Methods</b></h6>
</td>
</tr>
<tr>
<td class="col-md-4">
<ul class="index-list">
<li>
<span class="modifier">Public</span>
<a href="#isTemplate" >isTemplate</a>
</li>
<li>
<a href="#ngAfterContentInit" >ngAfterContentInit</a>
</li>
<li>
<a href="#ngAfterViewInit" >ngAfterViewInit</a>
</li>
</ul>
</td>
</tr>
<tr>
<td class="col-md-4">
<h6><b>Inputs</b></h6>
</td>
</tr>
<tr>
<td class="col-md-4">
<ul class="index-list">
<li>
<a href="#ariaLabel" >ariaLabel</a>
</li>
<li>
<a href="#disabled" >disabled</a>
</li>
<li>
<a href="#helperText" >helperText</a>
</li>
<li>
<a href="#invalid" >invalid</a>
</li>
<li>
<a href="#invalidText" >invalidText</a>
</li>
<li>
<a href="#labelInputID" >labelInputID</a>
</li>
<li>
<a href="#skeleton" >skeleton</a>
</li>
<li>
<a href="#warn" >warn</a>
</li>
<li>
<a href="#warnText" >warnText</a>
</li>
</ul>
</td>
</tr>
<tr>
<td class="col-md-4">
<h6><b>HostBindings</b></h6>
</td>
</tr>
<tr>
<td class="col-md-4">
<ul class="index-list">
<li>
<a href="#class.cds--form-item" >class.cds--form-item</a>
</li>
</ul>
</td>
</tr>
<tr>
<td class="col-md-4">
<h6><b>Accessors</b></h6>
</td>
</tr>
<tr>
<td class="col-md-4">
<ul class="index-list">
<li>
<a href="#labelClass" >labelClass</a>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</section>
<section data-compodoc="block-constructor">
<h3 id="constructor">Constructor</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<code>constructor(changeDetectorRef: ChangeDetectorRef)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="205" class="link-to-prism">src/input/label.component.ts:205</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Creates an instance of Label.</p>
</div>
<div>
<b>Parameters :</b>
<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Optional</td>
</tr>
</thead>
<tbody>
<tr>
<td>changeDetectorRef</td>
<td>
<code>ChangeDetectorRef</code>
</td>
<td>
No
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</section>
<section data-compodoc="block-inputs">
<h3 id="inputs">Inputs</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="ariaLabel"></a>
<b>ariaLabel</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
</td>
</tr>
<tr>
<td class="col-md-2" colspan="2">
<div class="io-line">Defined in <a href="" data-line="189" class="link-to-prism">src/input/label.component.ts:189</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Set the arialabel for label</p>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="disabled"></a>
<b>disabled</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Default value : </i><code>false</code>
</td>
</tr>
<tr>
<td class="col-md-2" colspan="2">
<div class="io-line">Defined in <a href="" data-line="161" class="link-to-prism">src/input/label.component.ts:161</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Set to <code>true</code> for disabled state.</p>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="helperText"></a>
<b>helperText</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code>string | TemplateRef<any></code>
</td>
</tr>
<tr>
<td class="col-md-2" colspan="2">
<div class="io-line">Defined in <a href="" data-line="169" class="link-to-prism">src/input/label.component.ts:169</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Optional helper text that appears under the label.</p>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="invalid"></a>
<b>invalid</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Default value : </i><code>false</code>
</td>
</tr>
<tr>
<td class="col-md-2" colspan="2">
<div class="io-line">Defined in <a href="" data-line="177" class="link-to-prism">src/input/label.component.ts:177</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Set to <code>true</code> for an invalid label component.</p>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="invalidText"></a>
<b>invalidText</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code>string | TemplateRef<any></code>
</td>
</tr>
<tr>
<td class="col-md-2" colspan="2">
<div class="io-line">Defined in <a href="" data-line="173" class="link-to-prism">src/input/label.component.ts:173</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Sets the invalid text.</p>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="labelInputID"></a>
<b>labelInputID</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Default value : </i><code>`cds-label-${Label.labelCounter++}`</code>
</td>
</tr>
<tr>
<td class="col-md-2" colspan="2">
<div class="io-line">Defined in <a href="" data-line="157" class="link-to-prism">src/input/label.component.ts:157</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>The id of the input item associated with the <code>Label</code>. This value is also used to associate the <code>Label</code> with
its input counterpart through the 'for' attribute.</p>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="skeleton"></a>
<b>skeleton</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Default value : </i><code>false</code>
</td>
</tr>
<tr>
<td class="col-md-2" colspan="2">
<div class="io-line">Defined in <a href="" data-line="165" class="link-to-prism">src/input/label.component.ts:165</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Set to <code>true</code> for a loading label.</p>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="warn"></a>
<b>warn</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Default value : </i><code>false</code>
</td>
</tr>
<tr>
<td class="col-md-2" colspan="2">
<div class="io-line">Defined in <a href="" data-line="181" class="link-to-prism">src/input/label.component.ts:181</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Set to <code>true</code> to show a warning (contents set by warningText)</p>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="warnText"></a>
<b>warnText</b>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code>string | TemplateRef<any></code>
</td>
</tr>
<tr>
<td class="col-md-2" colspan="2">
<div class="io-line">Defined in <a href="" data-line="185" class="link-to-prism">src/input/label.component.ts:185</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Sets the warning text</p>
</div>
</td>
</tr>
</tbody>
</table>
</section>
<section data-compodoc="block-properties">
<h3>HostBindings</h3> <table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="class.cds--form-item"></a>
<span class="name">
<span ><b>class.cds--form-item</b></span>
<a href="#class.cds--form-item"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="201" class="link-to-prism">src/input/label.component.ts:201</a></div>
</td>
</tr>
</tbody>
</table>
</section>
<section data-compodoc="block-methods">
<h3 id="methods">
Methods
</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="isTemplate"></a>
<span class="name">
<span class="modifier">Public</span>
<span ><b>isTemplate</b></span>
<a href="#isTemplate"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="modifier-icon icon ion-ios-reset"></span>
<code>isTemplate(value)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="254"
class="link-to-prism">src/input/label.component.ts:254</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description">
<b>Parameters :</b>
<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Optional</td>
</tr>
</thead>
<tbody>
<tr>
<td>value</td>
<td>
No
</td>
</tr>
</tbody>
</table>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/boolean" target="_blank" >boolean</a></code>
</div>
<div class="io-description">
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="ngAfterContentInit"></a>
<span class="name">
<span ><b>ngAfterContentInit</b></span>
<a href="#ngAfterContentInit"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>ngAfterContentInit()</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="215"
class="link-to-prism">src/input/label.component.ts:215</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Update wrapper class if a textarea is hosted.</p>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="ngAfterViewInit"></a>
<span class="name">
<span ><b>ngAfterViewInit</b></span>
<a href="#ngAfterViewInit"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>ngAfterViewInit()</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="228"
class="link-to-prism">src/input/label.component.ts:228</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Sets the id on the input item associated with the <code>Label</code>.</p>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
</div>
</td>
</tr>
</tbody>
</table>
</section>
<section data-compodoc="block-properties">
<h3 id="inputs">
Properties
</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="labelCounter"></a>
<span class="name">
<span class="modifier">Static</span>
<span ><b>labelCounter</b></span>
<a href="#labelCounter"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Default value : </i><code>0</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="152" class="link-to-prism">src/input/label.component.ts:152</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Used to build the id of the input item associated with the <code>Label</code>.</p>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="passwordInput"></a>
<span class="name">
<span class="modifier"></span>
<span ><b>passwordInput</b></span>
<a href="#passwordInput"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="../directives/PasswordInput.html" target="_self" >PasswordInput</a></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<b>Decorators : </b>
<br />
<code>
@ContentChild(PasswordInput, {static: false})<br />
</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="199" class="link-to-prism">src/input/label.component.ts:199</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="textArea"></a>
<span class="name">
<span class="modifier"></span>
<span ><b>textArea</b></span>
<a href="#textArea"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="../directives/TextArea.html" target="_self" >TextArea</a></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<b>Decorators : </b>
<br />
<code>
@ContentChild(TextArea)<br />
</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="193" class="link-to-prism">src/input/label.component.ts:193</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="textInput"></a>
<span class="name">
<span class="modifier"></span>
<span ><b>textInput</b></span>
<a href="#textInput"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code><a href="../directives/TextInput.html" target="_self" >TextInput</a></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<b>Decorators : </b>
<br />
<code>
@ContentChild(TextInput, {static: false})<br />
</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="196" class="link-to-prism">src/input/label.component.ts:196</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="type"></a>
<span class="name">
<span ><b>type</b></span>
<a href="#type"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code>"TextArea" | "TextInput" | "PasswordInput"</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="205" class="link-to-prism">src/input/label.component.ts:205</a></div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="wrapper"></a>
<span class="name">
<span class="modifier"></span>
<span ><b>wrapper</b></span>
<a href="#wrapper"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<i>Type : </i> <code>ElementRef<HTMLDivElement></code>
</td>
</tr>
<tr>
<td class="col-md-4">
<b>Decorators : </b>
<br />
<code>
@ViewChild('wrapper')<br />
</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="191" class="link-to-prism">src/input/label.component.ts:191</a></div>
</td>
</tr>
</tbody>
</table>
</section>
<section data-compodoc="block-accessors">
<h3 id="accessors">
Accessors
</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="labelClass"></a>
<span class="name"><b>labelClass</b><a href="#labelClass"><span class="icon ion-ios-link"></span></a></span>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="accessor"><b>get</b><code>labelClass()</code></span>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="201" class="link-to-prism">src/input/label.component.ts:201</a></div>
</td>
</tr>
</tbody>
</table>
</section>
</div>
<div class="tab-pane fade tab-source-code" id="source">
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {
Component,
Input,
AfterViewInit,
ElementRef,
HostBinding,
TemplateRef,
ViewChild,
ContentChild,
AfterContentInit,
ChangeDetectorRef
} from "@angular/core";
import { TextArea } from "./text-area.directive";
import { TextInput } from "./input.directive";
import { PasswordInput } from "./password.directive";
/**
* Get started with importing the module:
*
* ```typescript
* import { InputModule } from 'carbon-components-angular';
* ```
*
* To prevent attribute drilling, use `ibm-text-label` or `ibm-textarea-label` components
*
* ```html
* <cds-label>
* Label
* <input cdsText type="text" class="input-field">
* </cds-label>
* ```
*
* [See demo](../../?path=/story/components-input--basic)
*/
@Component({
selector: "cds-label, ibm-label",
template: `
<ng-template #inputContentTemplate>
<ng-content select="input,textarea,div"></ng-content>
</ng-template>
<ng-template #labelContentTemplate>
<ng-content></ng-content>
</ng-template>
<ng-container [ngSwitch]="type">
<ng-container *ngSwitchCase="'TextArea'">
<cds-textarea-label
[labelInputID]="labelInputID"
[disabled]="disabled"
[skeleton]="skeleton"
[helperText]="helperText"
[invalid]="invalid"
[invalidText]="invalidText"
[warn]="warn"
[warnText]="warnText"
[ariaLabel]="ariaLabel"
[labelTemplate]="labelContentTemplate"
[textAreaTemplate]="inputContentTemplate">
</cds-textarea-label>
</ng-container>
<ng-container *ngSwitchCase="'TextInput'">
<cds-text-label
[labelInputID]="labelInputID"
[disabled]="disabled"
[skeleton]="skeleton"
[helperText]="helperText"
[invalid]="invalid"
[invalidText]="invalidText"
[warn]="warn"
[warnText]="warnText"
[ariaLabel]="ariaLabel"
[labelTemplate]="labelContentTemplate"
[textInputTemplate]="inputContentTemplate">
</cds-text-label>
</ng-container>
<ng-container *ngSwitchCase="'PasswordInput'">
<cds-password-label
[labelInputID]="labelInputID"
[disabled]="disabled"
[skeleton]="skeleton"
[helperText]="helperText"
[invalid]="invalid"
[invalidText]="invalidText"
[warn]="warn"
[warnText]="warnText"
[ariaLabel]="ariaLabel"
[labelTemplate]="labelContentTemplate"
[passwordInputTemplate]="inputContentTemplate">
</cds-password-label>
</ng-container>
<ng-container *ngSwitchDefault>
<ng-template [ngTemplateOutlet]="default"></ng-template>
</ng-container>
</ng-container>
<ng-template #default>
<label
[for]="labelInputID"
[attr.aria-label]="ariaLabel"
class="cds--label"
[ngClass]="{
'cds--label--disabled': disabled,
'cds--skeleton': skeleton
}">
<ng-template [ngTemplateOutlet]="labelContentTemplate"></ng-template>
</label>
<div
class="cds--text-input__field-wrapper"
[ngClass]="{
'cds--text-input__field-wrapper--warning': warn
}"
[attr.data-invalid]="(invalid ? true : null)"
#wrapper>
<svg
*ngIf="invalid"
cdsIcon="warning--filled"
size="16"
class="cds--text-input__invalid-icon">
</svg>
<svg
*ngIf="!invalid && warn"
cdsIcon=&q