1.2.6 • Published 1 year ago

react-modal-alert v1.2.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

React-Modal-Alert

Version code style: prettier npm download

react-modal-alert library.

Demo

Edit react-modal-alert

Installation

Install it from npm (using NPM).

npm i --save react-modal-alert

or:

yarn add react-modal-alert

Usage

Using react modal alert hook!!

import React, { useState } from 'react';
import  {useModalAlert}  from 'hooks/useModalAlert';

function Page() {
    const { AlertContainer, modalAlert, setIsStart } = useModalAlert();
    const onClick = async () => {
        modalAlert({
          body: <div>custom body</div>,
          button: <div onClick={()=>setIsStart(false)}>custom button</div>
        });
    };
  return (
    <div>
      <div>
        <button type='button' onClick={onClick}>
          modal-alert-test-button
        </button>
      </div>
      {AlertContainer({
        isFirstRender: true,
        autoClose: 3000,
        body: <div>React-modal-alert Hook!!</div>,
        alertStyle: { borderRadius: '8px' },
      })}
    </div>
  );
}

Options

   AlertContainer({
    body: null || <div></div> || <BodyComponent />, //default: null(required)
    isFirstRender?: true | false, //default: false
    autoClose?: 3000, //default null
    button?: null || <div></div> || <ButtonComponent />, //default: null
    alertStyle?: {height:300,width:300},  //inline css styles,
    containerStyle?: {position: 'fixed'}, //inline css styles,
    zIndex?: 999, // default: 999
    backGroundColor?: '#020202' //default: rgba(0, 0, 0, 0.5)
   })
    modalAlert({
      body?:  null || <div></div> || <BodyComponent />, //default: parent (AlertContainer({body}))
      button?: null || <div></div> || <ButtonComponent />,  //default: parent (AlertContainer({button}))
      autoClose?: null,  //default: parent (AlertContainer({autoClose}))
    });

License

MIT

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago