Skip to content
5 changes: 4 additions & 1 deletion src/components/chip/chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface IgcChipComponentEventMap {
* @fires igcSelect - Emits event when the chip component is selected/deselected and any related animations and transitions also end.
*
* @csspart base - The base wrapper of the chip.
* @csspart content - The wrapper element around the default slot of the chip.
* @csspart prefix - The prefix container of the chip.
* @csspart suffix - The suffix container of the chip.
*/
Expand Down Expand Up @@ -222,7 +223,9 @@ export default class IgcChipComponent extends EventEmitterMixin<
@click=${this._handleSelect}
>
${this._renderPrefix()}
<slot></slot>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a nested <slot> here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the slot is not nested, it's just plain text in the DOM and I cannot target the text to place the padding on it.

<span part="content">
<slot></slot>
</span>
${this._renderSuffix()}
</button>
`;
Expand Down
2 changes: 1 addition & 1 deletion src/components/chip/themes/chip.base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
box-shadow: none;
cursor: pointer;
padding: 0 pad-inline(rem(2px), rem(6px), rem(12px));
gap: sizable(rem(3px), rem(6px), rem(8px));

&[disabled] {
pointer-events: none;
Expand Down Expand Up @@ -109,6 +108,7 @@
display: flex;
align-items: center;
justify-content: center;
gap: sizable(rem(3px), rem(6px), rem(8px));
}

::slotted(*) {
Expand Down
4 changes: 4 additions & 0 deletions src/components/chip/themes/shared/chip.common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ $theme: $material;
outline: none;
height: var-get($theme, 'size');

[part='content'] {
padding-inline: pad-inline(rem(3px), rem(6px), rem(8px));
}

&:focus {
background: var-get($theme, 'focus-background');
color: var-get($theme, 'focus-text-color');
Expand Down
2 changes: 1 addition & 1 deletion src/components/chip/themes/shared/chip.indigo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ $theme: $indigo;
@if $variant != 'warning' {
color: contrast-color($variant-color, 900);
}

@if $variant == 'warning' or $variant == 'info' {
background: color($variant-color, 500);
}
Expand Down
Loading