Docs
useLockBodyScroll

Disable body scrolling with the useLockBodyScroll hook. Useful for modals and other components that require a fixed body.

Installation

pnpm dlx shadcn@latest add https://usekit.kiron.dev/k/use-lock-body-scroll

Usage

"use client"
 
import { useLockBodyScroll } from "@/hooks/use-lock-body-scroll"
 
export function Component() {
  useLockBodyScroll()
 
  return (
    <div style={{ height: "200vh" }}>
      <p>Scrolling is disabled</p>
    </div>
  )
}