+ {label && (
+
+
+
+ {({ state }) =>
+ state.values
+ .map((_, i) => state.getThumbValueLabel(i))
+ .join(' – ')
+ }
+
+
+ )}
+
+ {({ state }) => {
+ const numThumbs = state.values.length;
+
+ // Calculate track fill
+ let trackFillStyle: React.CSSProperties;
+ if (numThumbs === 1) {
+ // Single thumb: fill from start to thumb
+ const percent = state.getThumbPercent(0);
+ const isVertical = state.orientation === 'vertical';
+ trackFillStyle = isVertical
+ ? { bottom: 0, height: `${percent * 100}%` }
+ : { left: 0, width: `${percent * 100}%` };
+ } else {
+ // Range: fill between thumbs
+ const start = state.getThumbPercent(0);
+ const end = state.getThumbPercent(1);
+ const rangePercent = (end - start) * 100;
+ const isVertical = state.orientation === 'vertical';
+ trackFillStyle = isVertical
+ ? { bottom: `${start * 100}%`, height: `${rangePercent}%` }
+ : { left: `${start * 100}%`, width: `${rangePercent}%` };
+ }
+
+ return (
+ <>
+
+
+ {numThumbs > 1 && (
+
+ )}
+ >
+ );
+ }}
+
+
+
+ );
+}
+
+/** @public */
+export const Slider = forwardRef(SliderImpl) as (