logonpix

Modal

Example
Props

Open

Static backdrop

Installation
npx npix@latest add Modal
Usage
<>
  <Button onClick={()=>r(!e)}>
    Try me
  </Button>
  <Modal
    onCancel={()=>r(!1)}
  >
    <div className="space-y-4">
      <header>
        <ModalTitle>
          Sign up for our newsletter
        </ModalTitle>
        <ModalDescription>
          You will get a 10% coupon on sign up.
        </ModalDescription>
      </header>
      <main className="space-y-2 text-sm">
        <label htmlFor="email">
          Enter your email
        </label>
        <Input
          id="email"
          placeholder="Email"
          type="email"
        />
      </main>
      <footer className="flex space-x-4 justify-end">
        <Button onClick={()=>r(!1)}>
          Close
        </Button>
        <Button
          onClick={()=>r(!1)}
          type="primary"
        >
          Confirm
        </Button>
      </footer>
    </div>
  </Modal>
</>
API

open

boolean

Whether the modal is open or not


onCancel

Function

What to do when the user clicks the 'X' button


staticBackdrop

boolean

If true, the modal can only be closed by clicking on one of the buttons


children

React.ReactNode

Body content of the modal


FieldDescriptionType
openWhether the modal is open or notboolean
onCancelWhat to do when the user clicks the 'X' buttonFunction
staticBackdropIf true, the modal can only be closed by clicking on one of the buttonsboolean
childrenBody content of the modalReact.ReactNode