Skip to content

Commit d2d38f1

Browse files
feat(operational-tag): add parts to allow for external styling (#20007)
* feat: add part to cds-tag inside cds-operational-tag * test: add test on part
1 parent 13732e2 commit d2d38f1

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/web-components/src/components/tag/__tests__/tag-test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,14 @@ describe('cds-tag', function () {
296296

297297
await expect(el).dom.to.equalSnapshot();
298298
});
299+
300+
it('should expose part on tag', async () => {
301+
const operationalTag = html`<cds-operational-tag
302+
text="Tag content"></cds-operational-tag>`;
303+
const el = await fixture(operationalTag);
304+
305+
expect(el.shadowRoot.querySelector('[part="tag"]')).to.exist;
306+
});
299307
});
300308

301309
it('should render as a filter tag', async () => {

packages/web-components/src/components/tag/operational-tag.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ class CDSOperationalTag extends HostListenerMixin(FocusMixin(LitElement)) {
152152
closeOnActivation
153153
leave-delay-ms=${0}>
154154
<cds-tag
155+
part="tag"
155156
?aria-pressed="${selected}"
156157
size="${size}"
157158
?disabled="${disabled}"
@@ -166,6 +167,7 @@ class CDSOperationalTag extends HostListenerMixin(FocusMixin(LitElement)) {
166167
</cds-tooltip>`
167168
: html`
168169
<cds-tag
170+
part="tag"
169171
?aria-pressed="${selected}"
170172
size="${size}"
171173
?disabled="${disabled}"

0 commit comments

Comments
 (0)