UNPKG

carbon-components-angular

Version:
1,190 lines (1,067 loc) 61.2 kB
<!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"> </head> <body> <div class="navbar navbar-default navbar-fixed-top d-block d-sm-none"> <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 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="hidden-xs 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" > TextareaLabelComponent</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/textarea-label.component.ts</code> </p> <p class="comment"> <h3>Description</h3> </p> <p class="comment"> <p>Get started with importing the module:</p> <div><pre class="line-numbers"><code class="language-typescript">import { InputModule } from &#39;carbon-components-angular&#39;;</code></pre></div><div><pre class="line-numbers"><code class="language-html">&lt;cds-textarea-label&gt; Label &lt;textarea cdsTextArea class=&quot;textarea-field&quot;&gt; &lt;/cds-textarea-label&gt;</code></pre></div><p><a href="../../?path=/story/components-input-text-area--basic">See demo</a></p> </p> <p class="comment"> <h3>Implements</h3> </p> <p class="comment"> <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-textarea-label, ibm-textarea-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">&lt;label [for]&#x3D;&quot;labelInputID&quot; [attr.aria-label]&#x3D;&quot;ariaLabel&quot; class&#x3D;&quot;cds--label&quot; [ngClass]&#x3D;&quot;{ &#x27;cds--label--disabled&#x27;: disabled, &#x27;cds--skeleton&#x27;: skeleton }&quot;&gt; &lt;ng-template *ngIf&#x3D;&quot;labelTemplate; else labelContent&quot; [ngTemplateOutlet]&#x3D;&quot;labelTemplate&quot;&gt;&lt;/ng-template&gt; &lt;ng-template #labelContent&gt; &lt;ng-content&gt;&lt;/ng-content&gt; &lt;/ng-template&gt; &lt;/label&gt; &lt;div class&#x3D;&quot;cds--text-area__wrapper&quot; [ngClass]&#x3D;&quot;{ &#x27;cds--text-input__field-wrapper--warning&#x27;: warn }&quot; [attr.data-invalid]&#x3D;&quot;(invalid ? true : null)&quot; #wrapper&gt; &lt;svg *ngIf&#x3D;&quot;invalid&quot; cdsIcon&#x3D;&quot;warning--filled&quot; size&#x3D;&quot;16&quot; class&#x3D;&quot;cds--text-area__invalid-icon&quot;&gt; &lt;/svg&gt; &lt;svg *ngIf&#x3D;&quot;!invalid &amp;&amp; warn&quot; cdsIcon&#x3D;&quot;warning--alt--filled&quot; size&#x3D;&quot;16&quot; class&#x3D;&quot;cds--text-input__invalid-icon cds--text-input__invalid-icon--warning&quot;&gt; &lt;/svg&gt; &lt;ng-template *ngIf&#x3D;&quot;textAreaTemplate; else textAreaContent&quot; [ngTemplateOutlet]&#x3D;&quot;textAreaTemplate&quot;&gt;&lt;/ng-template&gt; &lt;ng-template #textAreaContent&gt; &lt;ng-content select&#x3D;&quot;[cdsTextArea],[ibmTextArea],textarea&quot;&gt;&lt;/ng-content&gt; &lt;/ng-template&gt; &lt;/div&gt; &lt;div *ngIf&#x3D;&quot;!skeleton &amp;&amp; helperText &amp;&amp; !invalid &amp;&amp; !warn&quot; class&#x3D;&quot;cds--form__helper-text&quot; [ngClass]&#x3D;&quot;{&#x27;cds--form__helper-text--disabled&#x27;: disabled}&quot;&gt; &lt;ng-container *ngIf&#x3D;&quot;!isTemplate(helperText)&quot;&gt;{{helperText}}&lt;/ng-container&gt; &lt;ng-template *ngIf&#x3D;&quot;isTemplate(helperText)&quot; [ngTemplateOutlet]&#x3D;&quot;helperText&quot;&gt;&lt;/ng-template&gt; &lt;/div&gt; &lt;div *ngIf&#x3D;&quot;invalid&quot; class&#x3D;&quot;cds--form-requirement&quot;&gt; &lt;ng-container *ngIf&#x3D;&quot;!isTemplate(invalidText)&quot;&gt;{{invalidText}}&lt;/ng-container&gt; &lt;ng-template *ngIf&#x3D;&quot;isTemplate(invalidText)&quot; [ngTemplateOutlet]&#x3D;&quot;invalidText&quot;&gt;&lt;/ng-template&gt; &lt;/div&gt; &lt;div *ngIf&#x3D;&quot;!invalid &amp;&amp; warn&quot; class&#x3D;&quot;cds--form-requirement&quot;&gt; &lt;ng-container *ngIf&#x3D;&quot;!isTemplate(warnText)&quot;&gt;{{warnText}}&lt;/ng-container&gt; &lt;ng-template *ngIf&#x3D;&quot;isTemplate(warnText)&quot; [ngTemplateOutlet]&#x3D;&quot;warnText&quot;&gt;&lt;/ng-template&gt; &lt;/div&gt; </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"></span> <a href="#labelClass" >labelClass</a> </li> <li> <span class="modifier">Static</span> <a href="#labelCounter" >labelCounter</a> </li> <li> <span class="modifier"></span> <a href="#textArea" >textArea</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="#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="#labelTemplate" >labelTemplate</a> </li> <li> <a href="#skeleton" >skeleton</a> </li> <li> <a href="#textAreaTemplate" >textAreaTemplate</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> </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="145" class="link-to-prism">src/input/textarea-label.component.ts:145</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="137" class="link-to-prism">src/input/textarea-label.component.ts:137</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="102" class="link-to-prism">src/input/textarea-label.component.ts:102</a></div> </td> </tr> <tr> <td class="col-md-4"> <div class="io-description"><p>Set to <code>true</code> for a disabled label.</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&lt;any&gt;</code> </td> </tr> <tr> <td class="col-md-2" colspan="2"> <div class="io-line">Defined in <a href="" data-line="117" class="link-to-prism">src/input/textarea-label.component.ts:117</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="125" class="link-to-prism">src/input/textarea-label.component.ts:125</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&lt;any&gt;</code> </td> </tr> <tr> <td class="col-md-2" colspan="2"> <div class="io-line">Defined in <a href="" data-line="121" class="link-to-prism">src/input/textarea-label.component.ts:121</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>&quot;ibm-textarea-&quot; + TextareaLabelComponent.labelCounter</code> </td> </tr> <tr> <td class="col-md-2" colspan="2"> <div class="io-line">Defined in <a href="" data-line="97" class="link-to-prism">src/input/textarea-label.component.ts:97</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 &#39;for&#39; attribute.</p> </div> </td> </tr> </tbody> </table> <table class="table table-sm table-bordered"> <tbody> <tr> <td class="col-md-4"> <a name="labelTemplate"></a> <b>labelTemplate</b> </td> </tr> <tr> <td class="col-md-4"> <i>Type : </i> <code>TemplateRef&lt;any&gt;</code> </td> </tr> <tr> <td class="col-md-2" colspan="2"> <div class="io-line">Defined in <a href="" data-line="112" class="link-to-prism">src/input/textarea-label.component.ts:112</a></div> </td> </tr> <tr> <td class="col-md-4"> <div class="io-description"><p>Helper input property for ease of migration Since we cannot pass ng-content down easily from label component, we will accept the templates</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="106" class="link-to-prism">src/input/textarea-label.component.ts:106</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="textAreaTemplate"></a> <b>textAreaTemplate</b> </td> </tr> <tr> <td class="col-md-4"> <i>Type : </i> <code>TemplateRef&lt;any&gt;</code> </td> </tr> <tr> <td class="col-md-2" colspan="2"> <div class="io-line">Defined in <a href="" data-line="113" class="link-to-prism">src/input/textarea-label.component.ts:113</a></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="129" class="link-to-prism">src/input/textarea-label.component.ts:129</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&lt;any&gt;</code> </td> </tr> <tr> <td class="col-md-2" colspan="2"> <div class="io-line">Defined in <a href="" data-line="133" class="link-to-prism">src/input/textarea-label.component.ts:133</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"> <i>Default value : </i><code>true</code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="145" class="link-to-prism">src/input/textarea-label.component.ts:145</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="180" class="link-to-prism">src/input/textarea-label.component.ts:180</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> </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="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="155" class="link-to-prism">src/input/textarea-label.component.ts:155</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="labelClass"></a> <span class="name"> <span class="modifier"></span> <span ><b>labelClass</b></span> <a href="#labelClass"><span class="icon ion-ios-link"></span></a> </span> </td> </tr> <tr> <td class="col-md-4"> <i>Default value : </i><code>true</code> </td> </tr> <tr> <td class="col-md-4"> <b>Decorators : </b> <br /> <code> @HostBinding(&#x27;class.cds--form-item&#x27;)<br /> </code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="145" class="link-to-prism">src/input/textarea-label.component.ts:145</a></div> </td> </tr> </tbody> </table> <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="92" class="link-to-prism">src/input/textarea-label.component.ts:92</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="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, {static: false})<br /> </code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="143" class="link-to-prism">src/input/textarea-label.component.ts:143</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&lt;HTMLDivElement&gt;</code> </td> </tr> <tr> <td class="col-md-4"> <b>Decorators : </b> <br /> <code> @ViewChild(&#x27;wrapper&#x27;, {static: false})<br /> </code> </td> </tr> <tr> <td class="col-md-4"> <div class="io-line">Defined in <a href="" data-line="140" class="link-to-prism">src/input/textarea-label.component.ts:140</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, ChangeDetectorRef } from &quot;@angular/core&quot;; import { TextArea } from &quot;./text-area.directive&quot;; /** * Get started with importing the module: * * &#x60;&#x60;&#x60;typescript * import { InputModule } from &#x27;carbon-components-angular&#x27;; * &#x60;&#x60;&#x60; * * &#x60;&#x60;&#x60;html * &lt;cds-textarea-label&gt; * Label * &lt;textarea cdsTextArea class&#x3D;&quot;textarea-field&quot;&gt; * &lt;/cds-textarea-label&gt; * &#x60;&#x60;&#x60; * * [See demo](../../?path&#x3D;/story/components-input-text-area--basic) */ @Component({ selector: &quot;cds-textarea-label, ibm-textarea-label&quot;, template: &#x60; &lt;label [for]&#x3D;&quot;labelInputID&quot; [attr.aria-label]&#x3D;&quot;ariaLabel&quot; class&#x3D;&quot;cds--label&quot; [ngClass]&#x3D;&quot;{ &#x27;cds--label--disabled&#x27;: disabled, &#x27;cds--skeleton&#x27;: skeleton }&quot;&gt; &lt;ng-template *ngIf&#x3D;&quot;labelTemplate; else labelContent&quot; [ngTemplateOutlet]&#x3D;&quot;labelTemplate&quot;&gt;&lt;/ng-template&gt; &lt;ng-template #labelContent&gt; &lt;ng-content&gt;&lt;/ng-content&gt; &lt;/ng-template&gt; &lt;/label&gt; &lt;div class&#x3D;&quot;cds--text-area__wrapper&quot; [ngClass]&#x3D;&quot;{ &#x27;cds--text-input__field-wrapper--warning&#x27;: warn }&quot; [attr.data-invalid]&#x3D;&quot;(invalid ? true : null)&quot; #wrapper&gt; &lt;svg *ngIf&#x3D;&quot;invalid&quot; cdsIcon&#x3D;&quot;warning--filled&quot; size&#x3D;&quot;16&quot; class&#x3D;&quot;cds--text-area__invalid-icon&quot;&gt; &lt;/svg&gt; &lt;svg *ngIf&#x3D;&quot;!invalid &amp;&amp; warn&quot; cdsIcon&#x3D;&quot;warning--alt--filled&quot; size&#x3D;&quot;16&quot; class&#x3D;&quot;cds--text-input__invalid-icon cds--text-input__invalid-icon--warning&quot;&gt; &lt;/svg&gt; &lt;ng-template *ngIf&#x3D;&quot;textAreaTemplate; else textAreaContent&quot; [ngTemplateOutlet]&#x3D;&quot;textAreaTemplate&quot;&gt;&lt;/ng-template&gt; &lt;ng-template #textAreaContent&gt; &lt;ng-content select&#x3D;&quot;[cdsTextArea],[ibmTextArea],textarea&quot;&gt;&lt;/ng-content&gt; &lt;/ng-template&gt; &lt;/div&gt; &lt;div *ngIf&#x3D;&quot;!skeleton &amp;&amp; helperText &amp;&amp; !invalid &amp;&amp; !warn&quot; class&#x3D;&quot;cds--form__helper-text&quot; [ngClass]&#x3D;&quot;{&#x27;cds--form__helper-text--disabled&#x27;: disabled}&quot;&gt; &lt;ng-container *ngIf&#x3D;&quot;!isTemplate(helperText)&quot;&gt;{{helperText}}&lt;/ng-container&gt; &lt;ng-template *ngIf&#x3D;&quot;isTemplate(helperText)&quot; [ngTemplateOutlet]&#x3D;&quot;helperText&quot;&gt;&lt;/ng-template&gt; &lt;/div&gt; &lt;div *ngIf&#x3D;&quot;invalid&quot; class&#x3D;&quot;cds--form-requirement&quot;&gt; &lt;ng-container *ngIf&#x3D;&quot;!isTemplate(invalidText)&quot;&gt;{{invalidText}}&lt;/ng-container&gt; &lt;ng-template *ngIf&#x3D;&quot;isTemplate(invalidText)&quot; [ngTemplateOutlet]&#x3D;&quot;invalidText&quot;&gt;&lt;/ng-template&gt; &lt;/div&gt; &lt;div *ngIf&#x3D;&quot;!invalid &amp;&amp; warn&quot; class&#x3D;&quot;cds--form-requirement&quot;&gt; &lt;ng-container *ngIf&#x3D;&quot;!isTemplate(warnText)&quot;&gt;{{warnText}}&lt;/ng-container&gt; &lt;ng-template *ngIf&#x3D;&quot;isTemplate(warnText)&quot; [ngTemplateOutlet]&#x3D;&quot;warnText&quot;&gt;&lt;/ng-template&gt; &lt;/div&gt; &#x60; }) export class TextareaLabelComponent implements AfterViewInit { /** * Used to build the id of the input item associated with the &#x60;Label&#x60;. */ static labelCounter &#x3D; 0; /** * The id of the input item associated with the &#x60;Label&#x60;. This value is also used to associate the &#x60;Label&#x60; with * its input counterpart through the &#x27;for&#x27; attribute. */ @Input() labelInputID &#x3D; &quot;ibm-textarea-&quot; + TextareaLabelComponent.labelCounter; /** * Set to &#x60;true&#x60; for a disabled label. */ @Input() disabled &#x3D; false; /** * Set to &#x60;true&#x60; for a loading label. */ @Input() skeleton &#x3D; false; /** * Helper input property for ease of migration * Since we cannot pass ng-content down easily from label component, we will accept the templates */ @Input() labelTemplate: TemplateRef&lt;any&gt;; @Input() textAreaTemplate: TemplateRef&lt;any&gt;; /** * Optional helper text that appears under the label. */ @Input() helperText: string | TemplateRef&lt;any&gt;; /** * Sets the invalid text. */ @Input() invalidText: string | TemplateRef&lt;any&gt;; /** * Set to &#x60;true&#x60; for an invalid label component. */ @Input() invalid &#x3D; false; /** * Set to &#x60;true&#x60; to show a warning (contents set by warningText) */ @Input() warn &#x3D; false; /** * Sets the warning text */ @Input() warnText: string | TemplateRef&lt;any&gt;; /** * Set the arialabel for label */ @Input() ariaLabel: string; // @ts-ignore @ViewChild(&quot;wrapper&quot;, { static: false }) wrapper: ElementRef&lt;HTMLDivElement&gt;; // @ts-ignore @ContentChild(TextArea, { static: false }) textArea: TextArea; @HostBinding(&quot;class.cds--form-item&quot;) labelClass &#x3D; true; /** * Creates an instance of Label. */ constructor(protected changeDetectorRef: ChangeDetectorRef) {} /** * Sets the id on the input item associated with the &#x60;Label&#x60;. */ ngAfterViewInit() { if (this.wrapper) { // Prioritize setting id to &#x60;textarea&#x60; over div const inputElement &#x3D; this.wrapper.nativeElement.querySelector(&quot;textarea&quot;); if (inputElement) { // avoid overriding ids already set by the user reuse it instead if (inputElement.id) { this.labelInputID &#x3D; inputElement.id; this.changeDetectorRef.detectChanges(); } inputElement.setAttribute(&quot;id&quot;, this.labelInputID); return; } const divElement &#x3D; this.wrapper.nativeElement.querySelector(&quot;div&quot;); if (divElement) { if (divElement.id) { this.labelInputID &#x3D; divElement.id; this.changeDetectorRef.detectChanges(); } divElement.setAttribute(&quot;id&quot;, this.labelInputID); } } } public isTemplate(value) { return value instanceof TemplateRef; } } </code></pre> </div> <div class="tab-pane fade " id="tree"> <div id="tree-container"></div> <div class="tree-legend"> <div class="title"> <b>Legend</b> </div> <div> <div class="color htmlelement"></div><span>Html element</span> </div> <div> <div class="color component"></div><span>Component</span> </div> <div> <div class="color directive"></div><span>Html element with directive</span> </div> </div> </div> </div> <script src="../js/libs/vis.min.js"></script> <script src="../js/libs/htmlparser.js"></script> <script src="../js/libs/deep-iterator.js"></script> <script> var COMPONENT_TEMPLATE = '<div><label [for]="labelInputID" [attr.aria-label]="ariaLabel" class="cds--label" [ngClass]="{ \'cds--label--disabled\': disabled, \'cds--skeleton\': skeleton }"> <ng-template *ngIf="labelTemplate; else labelContent" [ngTemplateOutlet]="labelTemplate"></ng-template> <ng-template #labelContent> <ng-content></ng-content> </ng-template></label><div class="cds--text-area__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-area__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 *ngIf="textAreaTemplate; else textAreaContent" [ngTemplateOutlet]="textAreaTemplate"></ng-template> <ng-template #textAreaContent> <ng-content select="[cdsTextArea],[ibmTextArea],textarea"></ng-content> </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> </div>' var COMPONENTS = [{'name': 'Accordion', 'selector': 'cds-accordion, ibm-accordion'},{'name': 'AccordionItem', 'selector': 'cds-accordion-item, ibm-accordion-item'},{'name': 'ActionableNotification', 'selector': 'cds-actionable-notification, ibm-actionable-notification'},{'name': 'AlertModal', 'selector': 'cds-alert-modal, ibm-alert-modal'},{'name': 'BaseIconButton', 'selector': ''},{'name': 'BaseNotification', 'selector': ''},{'name': 'BaseTabHeader', 'selector': ''},{'name': 'Breadcrumb', 'selector': 'cds-breadcrumb, ibm-breadcrumb'},{'name': 'BreadcrumbItemComponent', 'selector': 'cds-breadcrumb-item, ibm-breadcrumb-item'},{'name': 'ButtonSet', 'selector': 'cds-button-set, ibm-button-set'},{'name': 'Checkbox', 'selector': 'cds-checkbox, ibm-checkbox'},{'name': 'ClickableTile', 'selector': 'cds-clickable-tile, ibm-clickable-tile'},{'name': 'CodeSnippet', 'selector': 'cds-code-snippet, ibm-code-snippet'},{'name': 'ComboBox', 'selector': 'cds-combo-box, ibm-combo-box'},{'name': 'ContainedList', 'selector': 'cds-contained-list, ibm-contained-list'},{'name': 'ContainedListItem', 'selector': 'cds-contained-list-item, ibm-contained-list-item'},{'name': 'ContentSwitcher', 'selector': 'cds-content-switcher, ibm-content-switcher'},{'name': 'ContextMenuComponent', 'selector': 'cds-context-menu, ibm-context-menu'},{'name': 'ContextMenuDividerComponent', 'selector': 'cds-context-menu-divider, ibm-context-menu-divider'},{'name': 'ContextMenuGroupComponent', 'selector': 'cds-context-menu-group, ibm-context-menu-group'},{'name': 'ContextMenuItemComponent', 'selector': 'cds-context-menu-item, ibm-context-menu-item'},{'name': 'DatePicker', 'selector': 'cds-date-picker, ibm-date-picker'},{'name': 'DatePickerInput', 'selector': 'cds-date-picker-input, ibm-date-picker-input'},{'name': 'Dialog', 'selector': 'cds-dialog, ibm-dialog'},{'name': 'Documentation', 'selector': 'cds-documentation'},{'name': 'Dropdown', 'selector': 'cds-dropdown, ibm-dropdown'},{'name': 'DropdownList', 'selector': 'cds-dropdown-list, ibm-dropdown-list'},{'name': 'ExpandableTile', 'selector': 'cds-expandable-tile, ibm-expandable-tile'},{'name': 'FileComponent', 'selector': 'cds-file, ibm-file'},{'name': 'FileUploader', 'selector': 'cds-file-uploader, ibm-file-uploader'},{'name': 'Hamburger', 'selector': 'cds-hamburger, ibm-hamburger'},{'name': 'Header', 'selector': 'cds-header, ibm-header'},{'name': 'HeaderAction', 'selector': 'cds-header-action, ibm-header-action'},{'name': 'HeaderGlobal', 'selector': 'cds-header-global, ibm-header-global'},{'name': 'HeaderItem', 'selector': 'cds-header-item, ibm-header-item'},{'name': 'HeaderMenu', 'selector': 'cds-header-menu, ibm-header-menu'},{'name': 'HeaderNavigation', 'selector': 'cds-header-navigation, ibm-header-navigation'},{'name': 'IconButton', 'selector': 'cds-icon-button, ibm-icon-button'},{'name': 'InlineLoading', 'selector': 'cds-inline-loading, ibm-inline-loading'},{'name': 'Label', 'selector': 'cds-label, ibm-label'},{'name': 'ListColumn', 'selector': 'cds-list-column, ibm-list-column'},{'name': 'ListHeader', 'selector': 'cds-list-header, ibm-list-header'},{'name': 'ListRow', 'selector': 'cds-list-row, ibm-list-row'},{'name': 'Loading', 'selector': 'cds-loading, ibm-loading'},{'name': 'Modal', 'selector': 'cds-modal, ibm-modal'},{'name': 'ModalFooter', 'selector': 'cds-modal-footer, ibm-modal-footer'},{'name': 'ModalHeader', 'selector': 'cds-modal-header, ibm-modal-header'},{'name': 'Notification', 'selector': 'cds-notification, cds-inline-notification, ibm-notification, ibm-inline-notification'},{'name': 'NumberComponent', 'selector': 'cds-number, ibm-number'},{'name': 'OverflowMenu', 'selector': 'cds-overflow-