# @martidev/react-modal-ts

> How to use react-modal-ts:

Latest version **0.18.0** (published 2022-11-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @martidev/react-modal-ts
pnpm add @martidev/react-modal-ts
yarn add @martidev/react-modal-ts
bun add @martidev/react-modal-ts
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.18.0 |
| Published | 2022-11-22 |
| First published | 2022-11-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 21.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | laurent-martinez |
| Maintainers | martidev |

## Links

- npm: https://www.npmjs.com/package/@martidev/react-modal-ts
- npm.io page: https://npm.io/package/@martidev/react-modal-ts

## Dependencies (1)

- [styled-components](https://npm.io/package/styled-components.md) ^5.3.6

## Recent versions

- 0.18.0 (latest) — 2022-11-22
- 0.17.0 — 2022-11-22
- 0.16.0 — 2022-11-14
- 0.15.0 — 2022-11-14
- 0.14.0 — 2022-11-14
- 0.13.0 — 2022-11-11
- 0.12.0 — 2022-11-11
- 0.11.0 — 2022-11-10
- 0.10.0 — 2022-11-10
- 0.9.0 — 2022-11-10
- 0.8.0 — 2022-11-10
- 0.7.0 — 2022-11-10
- 0.6.0 — 2022-11-10
- 0.5.0 — 2022-11-09
- 0.4.0 — 2022-11-09
- … 3 more at https://npm.io/package/@martidev/react-modal-ts/versions

## README

<h1>How to use react-modal-ts:</h1>

<p>-1- npm i @martidev/react-modal-ts</p>
-2- import it where you want to display it

```javascript
import { MyModal } from '@martidev/react-modal-ts';
```

-3- create open variable

```typescript
const [open, setOpen] = useState<boolean>(false);
```

-4- create hideModal function

```javascript
        hideModal={async() => setOpen(false)}
```

<h2>Then you can custom it:</h2>
-1- you can custom the img by passing directly the address of the picture or importing one

```javascript
img = 'https://myPictureAddress';
```

-2- you can custom as well the closing modal button, there is a default css style but by adding another class you can customize it.

```jsx
closeBtnStyle = 'coloris';
```

and in a css file add your personal custom style

```css
.coloris {
  background-color: #1f2243;
  color: white;
}
```

-3- you can also add a lot of content via the children props :

```jsx
        <button type="button" onClick={() => setOpen(false)}>
          ok
        </button>
        <p>
          Lorem, ipsum dolor sit amet consectetur adipisicing elit. Doloribus
          omnis blanditiis veniam veritatis ullam officiis accusantium deserunt
          in repellat autem excepturi quidem temporibus magnam reiciendis est
          accusamus, adipisci provident quasi.
        </p>
```

-4- you can style the content you add into your modal:

```css
.content {
  text-align: center;
  padding: 15px;
}
```

add your style via the css as you did with the closeBtnSyle.

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