useScrollProgress
@hua-labs/hua/motion
bash
npm install @hua-labs/huatsx
import { useScrollProgress } from "@hua-labs/hua/framework";tsx
const { progress } = useScrollProgress();
return (
<div
className="fixed top-0 left-0 h-1 bg-primary"
style={{ width: `${progress}%` }}
/>
);| target | number | - | Total scroll height (defaults to document height) |
| offset | number | 0 | Scroll start offset in pixels |
| showOnMount | boolean | false | Show initial state on mount (SSR safety) |
| progress | number | Scroll progress percentage (0-100) |
| mounted | boolean | Whether component is mounted (hydration safety) |