import * as React from 'react'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import Slider from '@mui/material/Slider'; function valueLabelFormat(value) { const units = ['KB', 'MB', 'GB', 'TB']; let unitIndex = 0; let scaledValue = value; while (scaledValue >= 1024 && unitIndex < units.length - 1) { unitIndex += 1; scaledValue /= 1024; } return `${scaledValue} ${units[unitIndex]}`; } function calculateValue(value) { return 2 ** value; } export default function NonLinearSlider() { const [value, setValue] = React.useState(10); const handleChange = (event, newValue) => { setValue(newValue); }; return ( Storage: {valueLabelFormat(calculateValue(value))} ); }