+
Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/button-overflow-handling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@crowdstrike/glide-core': patch
---

Button can now truncate and show an ellipsis when the label overflows by adding the following to the host:

```css
max-width: 100%;
white-space: nowrap;
```
14 changes: 14 additions & 0 deletions src/button.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default [
font-weight: var(--glide-core-typography-weight-bold);
gap: var(--glide-core-spacing-base-xs);
justify-content: center;
max-inline-size: 100%;
padding-block: var(--glide-core-spacing-base-xs);
padding-inline: var(--glide-core-spacing-base-md);
transition-duration: var(--glide-core-duration-moderate-02);
Expand Down Expand Up @@ -144,6 +145,7 @@ export default [
font-size: var(--glide-core-typography-size-body-default);
font-weight: var(--glide-core-typography-weight-regular);
padding: 0;
text-align: start;

&.disabled {
color: var(--glide-core-color-interactive-text-link--disabled);
Expand All @@ -168,12 +170,24 @@ export default [
}
}

.tooltip {
max-inline-size: 100%;
white-space: inherit;
}

.prefix-icon-slot {
&.hidden {
display: none;
}
}

.label {
min-inline-size: 3ch;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Happy to pull this out if we don't think it should be there for Button.

overflow: hidden;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You'll notice some changes in the visual test report. I tracked it down to this line. For some reason, adding overflow: hidden causes a slight visual shift in CI, but not in a real browser. 🤔

Font smoothing/antialiasing thing in Linux maybe? That's about all I can think of.

text-overflow: ellipsis;
white-space: inherit;
}

.suffix-icon-slot {
&.hidden {
display: none;
Expand Down
3 changes: 2 additions & 1 deletion src/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export default class Button extends LitElement {

override render() {
return html`<glide-core-tooltip
class="tooltip"
label=${this.tooltip ?? ''}
?disabled=${!this.disabled || !this.tooltip}
>
Expand Down Expand Up @@ -147,7 +148,7 @@ export default class Button extends LitElement {
-->
</slot>

${this.label}
<span class="label">${this.label}</span>

<slot
class=${classMap({
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载