
"use client";
import * as React from 'react';
import { styled } from '@mui/material/styles';
import { Slider } from '@mui/material';
const CustomSlider = styled(Slider)(({ theme }) => ({
'& .MuiSlider-rail': {
height: '9px',
borderRadius: '9px',
opacity: '1',
backgroundColor: theme.palette.grey[200],
},
'& .MuiSlider-thumb': {
borderRadius: '50%',
backgroundColor: () => theme.palette.secondary.main,
width: '23px',
height: '23px',
},
'& .MuiSlider-track': {
height: '9px',
borderRadius: '9px',
},
}));
<CustomSlider defaultValue={[30]} />
"use client";
import React from 'react';
import { Slider } from '@mui/material';
import { IconVolume, IconVolume2 } from '@tabler/icons-react';
import { Stack } from "@mui/system";
import { styled } from '@mui/material/styles';
const CustomSlider = styled(Slider)(({ theme }) => ({
'& .MuiSlider-rail': {
height: '9px',
borderRadius: '9px',
opacity: '1',
backgroundColor: theme.palette.grey[200],
},
'& .MuiSlider-thumb': {
borderRadius: '50%',
backgroundColor: () => theme.palette.secondary.main,
width: '23px',
height: '23px',
},
'& .MuiSlider-track': {
height: '9px',
borderRadius: '9px',
},
}));
const [value, setValue] = React.useState(30);
const handleChange = (event, newValue) => {
setValue(newValue);
<Stack direction="row" spacing={1}>
<IconVolume2 width={20} />
<Slider aria-label="Volume" value={value} onChange={handleChange} />
<IconVolume width={20} />
</Stack>
"use client";
import React from 'react';
import Box from '@mui/material/Box';
import { styled } from '@mui/material/styles';
import { SliderValueLabelProps } from '@mui/material/Slider';
import {SliderThumb} from '@mui/material/Slider';
const CustomSlider = styled(Slider)(({ theme }) => ({
'& .MuiSlider-rail': {
height: '9px',
borderRadius: '9px',
opacity: '1',
backgroundColor: theme.palette.grey[200],
},
'& .MuiSlider-thumb': {
borderRadius: '50%',
backgroundColor: () => theme.palette.secondary.main,
width: '23px',
height: '23px',
},
'& .MuiSlider-track': {
height: '9px',
borderRadius: '9px',
},
}));
function AirbnbThumbComponent(props: SliderValueLabelProps) {
const { children, ...other } = props;
return (
<SliderThumb {...other}>
{children}
<Box
sx={{
height: 9,
width: '2px',
backgroundColor: '#fff',
}}
/>
<Box
sx={{
height: '14px',
width: '2px',
backgroundColor: '#fff',
ml: '2px',
}}
/>
<Box
sx={{
height: 9,
width: '2px',
backgroundColor: '#fff',
ml: '2px',
}}
/>
</SliderThumb>
);
}
<CustomRangeSlider
slots={{ thumb: AirbnbThumbComponent }}
getAriaLabel={(index) => (index === 0 ? 'Minimum price' : 'Maximum price')}
defaultValue={[20, 40]}
/>
"use client";
import * as React from 'react';
import { Slider } from '@mui/material';
<Slider defaultValue={30} />
"use client";
import * as React from 'react';
import { Slider } from '@mui/material';
<Slider disabled defaultValue={30} />
"use client";
import React from 'react';
import { Slider } from '@mui/material';
import { IconVolume, IconVolume2 } from '@tabler/icons-react';
import { Stack } from "@mui/system";
import { styled } from '@mui/material/styles';
const CustomSlider = styled(Slider)(({ theme }) => ({
'& .MuiSlider-rail': {
height: '9px',
borderRadius: '9px',
opacity: '1',
backgroundColor: theme.palette.grey[200],
},
'& .MuiSlider-thumb': {
borderRadius: '50%',
backgroundColor: () => theme.palette.secondary.main,
width: '23px',
height: '23px',
},
'& .MuiSlider-track': {
height: '9px',
borderRadius: '9px',
},
}));
const [value, setValue] = React.useState(30);
const handleChange = (event, newValue) => {
setValue(newValue);
<Stack direction="row" spacing={1}>
<IconVolume2 width={20} />
<Slider aria-label="Volume" value={value} onChange={handleChange} />
<IconVolume width={20} />
</Stack>
"use client";
import React from 'react';
import { Slider } from '@mui/material';
const valuetext = (value) => {value}°C;
<Slider
aria-label="Temperature"
defaultValue={30}
getAriaValueText={valuetext}
valueLabelDisplay="auto"
step={10}
marks
min={10}
max={110}
/>
"use client";
import React from 'react';
import { Slider } from '@mui/material';
function valuetext2(value) {
return {value}°C;
}
const [value2, setValue2] = React.useState([20, 37]);
const handleChange2 = (event2, newValue2) => {
setValue2(newValue2);
};
<Slider
getAriaLabel={() => 'Temperature range'}
value={value2}
onChange={handleChange2}
valueLabelDisplay="auto"
getAriaValueText={valuetext2}
/>