Skip to content

Commit eb3436f

Browse files
authored
feat(slider): support bottom aligned label and prevent line break
This PR encourages the slider label to appear in one line without breaking the word into new line especially when the last label contains more than one word and break into multiple line which make the label overlaps the slider track in some situations. This PR also supports to change the slider label position using `bottom aligned` flag in CSS class name which makes the label to be appeared below the slider track. Closes: #1625
1 parent 0c40022 commit eb3436f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/definitions/modules/slider.less

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,14 @@
195195

196196
.ui.labeled.slider > .labels .label {
197197
display: inline-flex;
198+
padding: @labelPadding;
198199
position: absolute;
199200
transform: translate(-50%, -100%);
201+
white-space: nowrap;
202+
}
203+
204+
.ui.bottom.aligned.labeled.slider > .labels .label {
205+
transform: translate(-50%, 100%);
200206
}
201207
& when (@variationSliderTicked) {
202208
.ui.labeled.ticked.slider > .labels .label:after {
@@ -208,6 +214,9 @@
208214
top: 100%;
209215
left: 50%;
210216
}
217+
.ui.bottom.aligned.labeled.ticked.slider > .labels .label:after {
218+
top: -100%;
219+
}
211220
.ui.labeled.ticked.slider > .labels .halftick.label:after {
212221
height: @labelHeight / 2;
213222
}

src/themes/default/modules/slider.variables

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
@labelHeight : @height;
5858
@labelWidth : 1px;
5959
@labelColor : @background;
60+
@labelPadding : 0.2em 0;
6061

6162
/* Hover */
6263
@hoverVarOpacity : 0;

0 commit comments

Comments
 (0)