1.0.4 • Published 7 months ago

zz-modal v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

React zz-modal npm package

React zz-modal is a easiest way to create and custom a dialog in your app.

  • Very small (less than 10Kb)
  • Mobile friendly
  • Without dependencies
  • Customizable

Installation

npm i zz-modal

Usage

import { Modal } from "zz-modal"
import { useState } from "react"

function App() {
  const [showModal, setShowModal] = useState(false)
  return (
    <div>
	 <button onClick={() => setShowModal(true)}>Show modal</button>
      <Modal active={showModal} setActive={setShowModal}>
        <p>Your content goes here !</p>
      </Modal>
    </div>
  )
}
  • Add your styles to the Modal component by passing additional props customClass:

Example :

<Modal active={showModal} setActive={setShowModal} customClass="myOwnClass">
        {children}
      </Modal>

Props

The Modal component accepts the following props:

  • active (boolean, required): Whether the modal is open or closed.
  • setActive (function, required) : Triggers active props value.
  • children (ReactNode) : Children passed to the modal body, your own content.
  • customClass (string, optional) : Custom CSS class name to be added to the modal for additional styling or customization in your usual way.

Prerequisites

npm

Node.js

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago