Back to all questions

How can I lock scroll in my application?

Last updated

Mantine components use react-remove-scroll library to lock scroll. You can use it in your application to lock scroll. For your convenience, @mantine/core package exports RemoveScroll component:

import { RemoveScroll } from '@mantine/core';

function App() {
  return (
    <RemoveScroll>
      <div>Content</div>
    </RemoveScroll>
  );
}

The component supports all props that are supported by react-remove-scroll library, you can find the full list of props in the official documentation.