@lukethegenius/next-ui-hooks
v0.1.0
Published
React/Next.js UI hooks: URL-synced state, hysteresis-based scroll shrink, SSR-safe animated counter.
Readme
@lukethegenius/next-ui-hooks
React/Next.js hooks: sync state to the URL query string, a hysteresis-based scroll-shrink hook for headers/nav bars, and an SSR-safe animated number counter.
Install
npm install @lukethegenius/next-ui-hooks react next framer-motionUsage
import { useURLState, useNavShrink, AnimatedNumber } from '@lukethegenius/next-ui-hooks'
const [period, setPeriod] = useURLState('period', '30d') // syncs to ?period=
const compact = useNavShrink() // boolean, 2-state hysteresis (down 64px / up 16px)
<AnimatedNumber value={12500} prefix="€" /> // counts up client-side, respects prefers-reduced-motionnavShrinkReducer + initialNavShrinkState are exported separately as pure functions for unit testing without React/DOM.
