FormSliderControl: option to hide the track

This commit is contained in:
Enrico Ros
2025-10-14 15:02:51 -07:00
parent 0be8ac7e09
commit 7fad41dc8a
@@ -1,10 +1,15 @@
import * as React from 'react';
import type { SxProps } from '@mui/joy/styles/types';
import { FormControl, Slider, VariantProp } from '@mui/joy';
import { FormLabelStart } from './FormLabelStart';
const _styleNoTrack = {
'--Slider-trackBackground': 'transparent'
} as const satisfies SxProps;
/**
* Slider Control
*/
@@ -18,6 +23,7 @@ export function FormSliderControl(props: {
value: number | number[] | null, onChange: (value: number) => void,
startAdornment?: React.ReactNode,
endAdornment?: React.ReactNode,
styleNoTrack?: boolean,
}) {
@@ -60,6 +66,7 @@ export function FormSliderControl(props: {
onChange={handleChange}
onChangeCommitted={handleChangeCommitted}
valueLabelDisplay={props.valueLabelDisplay}
sx={props.styleNoTrack ? _styleNoTrack : undefined}
// sx={{ py: 1, mt: 1.1 }}
/>
{props.endAdornment}