UNPKG

@base-ui/react

Version:

Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.

36 lines (34 loc) 1.07 kB
'use client'; import * as React from 'react'; import { useRenderElement } from "../../internals/useRenderElement.js"; import { useSliderRootContext } from "../root/SliderRootContext.js"; import { sliderStateAttributesMapping } from "../root/stateAttributesMapping.js"; /** * Contains the slider indicator and represents the entire range of the slider. * Renders a `<div>` element. * * Documentation: [Base UI Slider](https://base-ui.com/react/components/slider) */ export const SliderTrack = /*#__PURE__*/React.forwardRef(function SliderTrack(componentProps, forwardedRef) { const { render, className, style, ...elementProps } = componentProps; const { state } = useSliderRootContext(); const element = useRenderElement('div', componentProps, { state, ref: forwardedRef, props: [{ style: { position: 'relative' } }, elementProps], stateAttributesMapping: sliderStateAttributesMapping }); return element; }); if (process.env.NODE_ENV !== "production") SliderTrack.displayName = "SliderTrack";