modal-nextjs

0.1.6 • Public • Published

Simple Modal component created for Next.js projects

A modal component built with Next.js using FontAwesome

Installation

npm i modal-nextjs

Or :

yarn add modal-nextjs

Or :

pnpm add modal-nextjs

Example of use

import { Modal } from 'modal-nextjs'
import { useState } from 'react'

const Example = () => {
  const [modalIsOpen, setModalIsOpen] = useState(false)

  const handleclick = () => {
    setModalIsOpen(true)
  }

  return (
    <main>
      <h1>Hello world</h1>
      <button onClick={handleclick}>Click to open modal</button>
      {modalIsOpen && (
        <Modal
          setModalIsOpen={setModalIsOpen}
          content={
            <div>
              <p className="p-class-example">Modal is open !</p>
            </div>
          }
        />
      )}
    </main>
  )
}

export default Example

props:

setModalIsOpen : This state function is mandatory and will allow the modal to close itself | Required

content : The React content (HTML/css) to display in the modal | Required

Additional informations:

Developper documentation

Author : Pierre-Yves Léglise

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.62latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.62
0.1.50
0.1.5-150
0.1.5-140
0.1.5-130
0.1.5-120
0.1.5-110
0.1.5-100
0.1.5-90
0.1.5-80
0.1.5-70
0.1.5-60
0.1.5-50
0.1.5-40
0.1.5-30
0.1.5-20
0.1.5-10
0.1.4-10
0.1.40
0.1.30
0.1.20
0.1.1-30
0.1.1-20
0.1.1-10
0.1.10
0.1.00
0.1.0-40
0.1.0-30
0.1.0-20
0.1.0-10
0.1.0-00

Package Sidebar

Install

npm i modal-nextjs

Weekly Downloads

2

Version

0.1.6

License

BSD-3-Clause

Unpacked Size

7.58 kB

Total Files

4

Last publish

Collaborators

  • axialdata