# pdb-modal

> modal component

Latest version **0.1.2** (published 2023-03-21) · 0 weekly downloads

## Install

```sh
npm install pdb-modal
pnpm add pdb-modal
yarn add pdb-modal
bun add pdb-modal
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2023-03-21 |
| First published | 2023-03-20 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Pascal Debailleul |
| Maintainers | foxest57 |
| Keywords | react, components, ui |

## Links

- npm: https://www.npmjs.com/package/pdb-modal
- Repository: https://github.com/FOXEST57/lib-jquery-react
- Homepage: https://github.com/FOXEST57/lib-jquery-react#readme
- Issues: https://github.com/FOXEST57/lib-jquery-react/issues
- npm.io page: https://npm.io/package/pdb-modal

## Dependencies (4)

- [web-vitals](https://npm.io/package/web-vitals.md) ^2.1.4
- [@testing-library/react](https://npm.io/package/@testing-library/react.md) ^13.4.0
- [@testing-library/jest-dom](https://npm.io/package/@testing-library/jest-dom.md) ^5.16.5
- [@testing-library/user-event](https://npm.io/package/@testing-library/user-event.md) ^13.5.0

## Alternatives

- [@progress/kendo-ooxml](https://npm.io/package/@progress/kendo-ooxml.md) — 152.1K weekly downloads
- [@progress/kendo-react-ripple](https://npm.io/package/@progress/kendo-react-ripple.md) — 8.0K weekly downloads
- [@progress/kendo-react-orgchart](https://npm.io/package/@progress/kendo-react-orgchart.md) — 4.3K weekly downloads
- [@praxisui/dynamic-fields](https://npm.io/package/@praxisui/dynamic-fields.md) — 2.4K weekly downloads
- [@progress/kendo-vue-listbox](https://npm.io/package/@progress/kendo-vue-listbox.md) — 932 weekly downloads

## Recent versions

- 0.1.2 (latest) — 2023-03-21
- 0.1.1 — 2023-03-20

## README

# pdb-modal

## Installation
To install, you can the command below:

    npm i --save pdb-modal

## Example

- you can return your component and the modal like this

```
    return (
        <div className="App">
            <button onClick={() => setIsOpen(true)}>Open modal</button>
            <Modal
                myModalButtonStyle={myModalButtonStyle}
                isOpen={isOpen}
                setIsOpen={setIsOpen}
            >
                <ModalTitle />
                <ModalContent />
            </Modal>
        </div>
    );
```
- OR like this

```
    return (
        <div className="App">
            <button onClick={() => setIsOpen(true)}>Open modal</button>
            <Modal
                myModalButtonStyle={myModalButtonStyle}
                isOpen={isOpen}
                setIsOpen={setIsOpen}
                modalTitle={<ModalTitle />}
                modalContent={<ModalContent />}
            />
        </div>
    );
```

- let's see a full example

```
    import { useState } from 'react';
    import { Modal } from 'pdb-modal';

    const ModalTitle = () => {
        return (
            <>
                <h2>Super Title</h2>
            </>
        )
    }

    const ModalContent = () => {
        return (
            <>
                <ul>
                    <p>pdb-modal</p>
                </ul>
            </>
        )
    }
    function App() {
        const myModalStyle = {
            background: "blue"
        }

        const myOverlayStyle = {
            background: "rgba(0,0,0,0.8)",
            position: "absolute",
            inset: 0,
            width: "auto",
            height: "auto"
        }

        const myModalButtonStyle = {
            color: "black",
            fontWeight: "bold",
            position: "absolute",
            right: "10px",
            top: "10px",
            border: "2px solid black",
            cursor: "pointer"
        }

        const [isOpen, setIsOpen] = useState(false)

        return (
            <div className="App">
                <button onClick={() => setIsOpen(true)}>Open modal</button>
                <Modal
                    myModalButtonStyle={myModalButtonStyle}
                    isOpen={isOpen}
                    setIsOpen={setIsOpen}
                    modalTitle={<ModalTitle />}
                    modalContent={<ModalContent />}
                />
            </div>
        );
    }

    export default App;
```

## Style

- You can style your modal as you want by using these attributes:

    - `myModalStyle`  
    - `myOverlayStyle` 
    - `myModalButtonStyle` 

which are javascript objects allowing you to style each part of the modal
Note: if not set up, the default styles will be applied

---
_Source: https://npm.io/package/pdb-modal · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
