Reputation: 101
Basically I want to change the text inside of the value. In this example I want to change the 41 to say '41°'.
Upvotes: 2
Views: 1992
Reputation: 2245
According to the docs https://material-ui.com/api/slider/#main-content
valueLabelFormat
The format function the value label's value. When a function is provided, it should have the following signature:
- {number} value The value label's value to format - {number} index The value label's index to format
So, Just add valueLabelFormat={valuetext}
Upvotes: 4
Reputation: 51
According to Material-UI documentation, you should use ValueLabelComponent attribute.
Create a functional component:
function ValueLabelComponent(props) {
const { children, open, value } = props;
return (
<Tooltip open={open} enterTouchDelay={0} placement="top" title={`${value}`C}>
{children}
</Tooltip>
);
}
And then assign it:
<Slider
ValueLabelComponent={ValueLabelComponent}
/>
Upvotes: 2