File tree Expand file tree Collapse file tree 3 files changed +43
-3
lines changed
packages/web-components/src/components/textarea Expand file tree Collapse file tree 3 files changed +43
-3
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,29 @@ describe('cds-textarea', () => {
124124 expect ( skeleton ) . to . exist ;
125125 } ) ;
126126
127+ it ( 'should support hide-label on skeleton variant' , async ( ) => {
128+ const el = await fixture ( html `
129+ < cds-textarea-skeleton > </ cds-textarea-skeleton >
130+ ` ) ;
131+
132+ await el . updateComplete ;
133+
134+ const label = el . shadowRoot ?. querySelector ( `.cds--label.cds--skeleton` ) ;
135+ expect ( label ) . to . exist ;
136+
137+ const elHiddenLabel = await fixture ( html `
138+ < cds-textarea-skeleton hide-label > </ cds-textarea-skeleton >
139+ ` ) ;
140+
141+ await elHiddenLabel . updateComplete ;
142+
143+ // label should not render when hide-label is true
144+ const hiddenLabel = elHiddenLabel . shadowRoot ?. querySelector (
145+ `.cds--label.cds--skeleton`
146+ ) ;
147+ expect ( hiddenLabel ) . to . not . exist ;
148+ } ) ;
149+
127150 it ( 'should be accessible' , async ( ) => {
128151 const el = await fixture ( html `
129152 < cds-textarea
Original file line number Diff line number Diff line change 11/**
2- * Copyright IBM Corp. 2019, 2023
2+ * Copyright IBM Corp. 2019, 2025
33 *
44 * This source code is licensed under the Apache-2.0 license found in the
55 * LICENSE file in the root directory of this source tree.
66 */
77
88import { LitElement , html } from 'lit' ;
9+ import { property } from 'lit/decorators.js' ;
910import { prefix } from '../../globals/settings' ;
1011import styles from './textarea.scss?lit' ;
1112import { carbonElement as customElement } from '../../globals/decorators/carbon-element' ;
@@ -17,9 +18,18 @@ import { carbonElement as customElement } from '../../globals/decorators/carbon-
1718 */
1819@customElement ( `${ prefix } -textarea-skeleton` )
1920class CDSTextareaSkeleton extends LitElement {
21+ /**
22+ * Specify whether the label should be hidden, or not
23+ */
24+ @property ( { type : Boolean , reflect : true , attribute : 'hide-label' } )
25+ hideLabel = false ;
26+
2027 render ( ) {
28+ const { hideLabel } = this ;
2129 return html `
22- < span class ="${ prefix } --label ${ prefix } --skeleton "> </ span >
30+ ${ hideLabel
31+ ? ''
32+ : html `< span class ="${ prefix } --label ${ prefix } --skeleton "> </ span > ` }
2333 < div class ="${ prefix } --skeleton ${ prefix } --text-area "> </ div >
2434 ` ;
2535 }
Original file line number Diff line number Diff line change @@ -191,12 +191,19 @@ export const Default = {
191191} ;
192192
193193export const Skeleton = {
194+ args,
195+ argTypes,
194196 parameters : {
195197 percy : {
196198 skip : true ,
197199 } ,
200+ controls : {
201+ include : [ 'hideLabel' ] ,
202+ } ,
198203 } ,
199- render : ( ) => html ` < cds-textarea-skeleton > </ cds-textarea-skeleton > ` ,
204+ render : ( { hideLabel } ) => html `
205+ < cds-textarea-skeleton ?hide-label =${ hideLabel } > </ cds-textarea-skeleton >
206+ ` ,
200207} ;
201208
202209export const WithAILabel = {
You can’t perform that action at this time.
0 commit comments