Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 66f8bf7

Browse files
authored
feat(floating-label): Add max-width mixin (#2956)
1 parent a5bea1b commit 66f8bf7

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

packages/mdc-floating-label/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Mixin | Description
7979
`mdc-floating-label-shake-keyframes($modifier, $positionY, $positionX, $scale)` | Generates a CSS `@keyframes` at-rule for an invalid label shake. Used in conjunction with the `mdc-floating-label-shake-animation` mixin.
8080
`mdc-floating-label-shake-animation($modifier)` | Applies shake keyframe animation to label.
8181
`mdc-floating-label-float-position($positionY, $positionX, $scale)` | Sets position of label when floating.
82+
`mdc-floating-label-max-width($max-width)` | Sets the max width of the label.
8283

8384
## `MDCFloatingLabel` Properties and Methods
8485

packages/mdc-floating-label/_mixins.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,7 @@
6767
animation: mdc-floating-label-shake-float-above-#{$modifier} 250ms 1;
6868
}
6969
}
70+
71+
@mixin mdc-floating-label-max-width($max-width) {
72+
max-width: $max-width;
73+
}

packages/mdc-floating-label/mdc-floating-label.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@
3737
transform $mdc-floating-label-transition-duration $mdc-animation-standard-curve-timing-function,
3838
color $mdc-floating-label-transition-duration $mdc-animation-standard-curve-timing-function;
3939
line-height: 1.15rem;
40+
text-overflow: ellipsis;
41+
white-space: nowrap;
4042
cursor: text;
43+
overflow: hidden;
44+
// Force the label into its own layer to prevent visible layer promotion adjustments
45+
// when the ripple is activated behind it.
46+
will-change: transform;
4147

4248
@include mdc-rtl {
4349
/* @noflip */

0 commit comments

Comments
 (0)