Skip to content

Commit 810022d

Browse files
committed
Make label slot named for consistency
1 parent 8205bc8 commit 810022d

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/labs/ia-combo-box/ia-combo-box-story.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export class IAComboBoxStory extends LitElement {
172172
?disabled=${this.disabled}
173173
@change=${this.handleComboBoxChange}
174174
>
175-
${this.label}
175+
<span slot="label">${this.label}</span>
176176
</ia-combo-box>
177177
<div id="announcer">${this.announcerText}</div>
178178
</div>
@@ -320,7 +320,9 @@ export class IAComboBoxStory extends LitElement {
320320
...
321321
]}
322322
${bindingsStr}
323-
>${this.label}</ia-combo-box>
323+
>
324+
<span slot="label">${this.label}</span>
325+
</ia-combo-box>
324326
`
325327
.replace(/\n\s*\n/g, '\n')
326328
.replace(/\n {6}/g, '\n');

src/labs/ia-combo-box/ia-combo-box.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,14 @@ export class IAComboBox extends LitElement {
379379
/**
380380
* Template for the main label for the combo box.
381381
*
382-
* Uses the contents of the default (unnamed) slot as the label text.
382+
* Uses the contents of the `label` named slot as the label text.
383383
*/
384384
private get labelTemplate(): TemplateResult {
385-
return html`<label id="label" for="text-input"><slot></slot></label>`;
385+
return html`
386+
<label id="label" for="text-input">
387+
<slot name="label"></slot>
388+
</label>
389+
`;
386390
}
387391

388392
/**

0 commit comments

Comments
 (0)