<!--- useLockScroll.stories.mdx --->

import { Meta } from '@storybook/addon-docs';

<Meta title="hooks/useLockScroll" />

# useLockScroll

This hook is used in order to display a notification in the admin panel.

## Usage

```
import { useLockScroll } from '@strapi/helper-plugin';

const Modal = ({ onToggle, isOpen }) => {
  // boolean required to activate locked scroll when modal is open
  useLockScroll(isOpen);

  if (!isOpen) {
    return null;
  }

  return (
    <Portal>
      <ModalWrapper>
        <FocusTrap onClose={onToggle}>
          <ModalContainer>
            Content of the modal
          </ModalContainer>
        </FocusTrap>
      </ModalWrapper>
    </Portal>
  );
};
```
