Skip to content

Commit 91a4790

Browse files
authored
refactor: rename button label wrap custom CSS property (#11864)
1 parent ed75baa commit 91a4790

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎dev/playground/button.html‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,14 @@ <h2 class="heading">Custom Layout</h2>
8686
<vaadin-icon icon="vaadin:reply" slot="prefix"></vaadin-icon>
8787
Reply
8888
</vaadin-button>
89-
<vaadin-button style="width: 10em;">
89+
<vaadin-button style="width: 10em; --vaadin-button-label-wrap: normal;">
9090
<vaadin-icon icon="vaadin:reply" slot="prefix"></vaadin-icon>
9191
A really long label that should wrap
9292
</vaadin-button>
93+
<vaadin-button style="width: 10em; --vaadin-button-label-wrap: nowrap;">
94+
<vaadin-icon icon="vaadin:reply" slot="prefix"></vaadin-icon>
95+
A really long label that should truncate
96+
</vaadin-button>
9397
</section>
9498
</body>
9599
</html>

‎packages/button/src/styles/vaadin-button-base-styles.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const buttonStyles = css`
1313
justify-content: center;
1414
text-align: center;
1515
gap: var(--vaadin-button-gap, 0 var(--vaadin-gap-s));
16-
white-space: var(--vaadin-button-white-space, normal);
16+
white-space: var(--vaadin-button-label-wrap, normal);
1717
-webkit-tap-highlight-color: transparent;
1818
-webkit-user-select: none;
1919
user-select: none;
@@ -47,7 +47,8 @@ export const buttonStyles = css`
4747
}
4848
4949
[part='label'] {
50-
display: inline-flex;
50+
overflow: hidden;
51+
text-overflow: ellipsis;
5152
}
5253
5354
:host(:is([focus-ring], :focus-visible)) {

‎packages/vaadin-lumo-styles/src/components/button.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Note, to make it work, the form fields should have the same "::before" pseudo-el
8282
}
8383

8484
[part='label'] {
85-
white-space: var(--vaadin-button-white-space, nowrap);
85+
white-space: var(--vaadin-button-label-wrap, nowrap);
8686
overflow: hidden;
8787
text-overflow: ellipsis;
8888
padding: calc(var(--lumo-button-size) / 6) 0;

0 commit comments

Comments
 (0)