Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/micheld-dev/react-modal

React-modal is a simplest way to create dialog on your ReactJS site.
https://github.com/micheld-dev/react-modal

dialog modal react react-component react-component-library tailwindcss typescript

Last synced: 14 days ago
JSON representation

React-modal is a simplest way to create dialog on your ReactJS site.

Awesome Lists containing this project

README

        

# React-modal
[![npm package](https://img.shields.io/npm/v/@midly/react-modal)](https://www.npmjs.org/package/@midly/react-modal)
[![npm package](https://img.shields.io/bundlephobia/min/@midly/react-modal)](https://www.npmjs.org/package/@midly/react-modal)
[![npm package](https://img.shields.io/github/last-commit/micheld-dev/react-modal)](https://www.npmjs.org/package/@midly/react-modal)
[![npm package](https://img.shields.io/npm/dw/@midly/react-modal)](https://www.npmjs.org/package/@midly/react-modal)

React-modal is a simplest way to create dialog on your ReactJS site.

- Small (less than 45Kb)
- Mobile friendly
- Without dependencies

## Getting Started

Install this package:

```shell
npm i @midly/react-modal
```

Import the component (import modalRef type if TSX):

```jsx
//component.tsx
import {Modal} from '@midly/react-modal';
import {ModalRef} from '@midly/react-modal/dist/esm/Modal'

const modalRef = useRef(null)

Your content
```

You can then render the Modal component like any other React component in JSX/TSX.

```jsx
//component.tsx
const showModal = useCallback(() => modalRef.current?.open(), [])

Open modal
```