1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/components/component-library/modal-overlay/README.mdx
George Marshall 419bf92282
Removing Box props description from TS component docs (#20451)
* Removing Box props description from TS component docs

* Making style utility prop comments more generic
2023-08-16 10:34:08 -07:00

39 lines
872 B
Plaintext

import { Story, Canvas, ArgsTable } from '@storybook/addon-docs';
import { ModalOverlay } from './modal-overlay';
# ModalOverlay
`ModalOverlay` is a transparent overlay that covers the entire screen. It is used to dim the background when a modal is open.
<Canvas>
<Story id="components-componentlibrary-modaloverlay--default-story" />
</Canvas>
## Props
<ArgsTable of={ModalOverlay} />
### On Click
Use the `onClick` prop to handle clicks on the overlay
<Canvas>
<Story id="components-componentlibrary-modaloverlay--on-click" />
</Canvas>
```jsx
import React, { useState } from 'react';
import { ModalOverlay } from '../../component-library';
const [open, setOpen] = useState(false);
const handleOnClick = () => {
setOpen(!open);
};
<button onClick={handleOnClick}>Show modal overlay</button>;
{
open && <ModalOverlay onClick={handleOnClick} />;
}
```