@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.
34 lines (32 loc) • 954 B
JavaScript
'use client';
import * as React from 'react';
import { useMeterRootContext } from "../root/MeterRootContext.mjs";
import { useRenderElement } from "../../internals/useRenderElement.mjs";
/**
* Visualizes the position of the value along the range.
* Renders a `<div>` element.
*
* Documentation: [Base UI Meter](https://base-ui.com/react/components/meter)
*/
export const MeterIndicator = /*#__PURE__*/React.forwardRef(function MeterIndicator(componentProps, forwardedRef) {
const {
render,
className,
style,
...elementProps
} = componentProps;
const {
percentageValue
} = useMeterRootContext();
return useRenderElement('div', componentProps, {
ref: forwardedRef,
props: [{
style: {
insetInlineStart: 0,
height: 'inherit',
width: `${percentageValue}%`
}
}, elementProps]
});
});
if (process.env.NODE_ENV !== "production") MeterIndicator.displayName = "MeterIndicator";