-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
/
EdgeLabelSlider.tsx
43 lines (41 loc) · 1.27 KB
/
EdgeLabelSlider.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import * as React from 'react';
import Box from '@mui/joy/Box';
import Slider, { sliderClasses } from '@mui/joy/Slider';
function valueText(value: number) {
return `$${value}`;
}
export default function EdgeLabelSlider() {
return (
<Box sx={{ width: 300 }}>
<Slider
defaultValue={[0, 10]}
max={10}
getAriaLabel={() => 'Amount'}
getAriaValueText={valueText}
marks
valueLabelDisplay="on"
sx={{
[`& .${sliderClasses.thumbStart} .${sliderClasses.valueLabel}`]: {
left: 'calc(var(--Slider-thumb-size) / 2 - 2px)', // 2px is the thumb border width
borderBottomLeftRadius: 0,
'&::before': {
left: 0,
transform: 'translateY(100%)',
borderLeftColor: 'currentColor',
},
},
[`& .${sliderClasses.thumbEnd} .${sliderClasses.valueLabel}`]: {
right: 'calc(var(--Slider-thumb-size) / 2 - 2px)', // 2px is the thumb border width
borderBottomRightRadius: 0,
'&::before': {
left: 'initial',
right: 0,
transform: 'translateY(100%)',
borderRightColor: 'currentColor',
},
},
}}
/>
</Box>
);
}