2.9.1 • Published 2 years ago

react-smart-popup v2.9.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

react-smart-popup

this is a smart popup created by react and typeScrypt

Installation

The package can be installed via npm:

npm install react-smart-popup --save

Or via yarn:

yarn add react-smart-popup

Example

import React, { useState, useCallback } from 'react';
import { popup } from 'react-smart-popup';

const App = () => {
  const [isOpenDialog, setIsOpenDialog] = useState < boolean > false;

  const openPopupFunc = useCallback(() => {
    setIsOpenDialog(true);
  }, [setIsOpenDialog]);
  const handleSubmitFunc = useCallback(() => {
    console.log('submit');
  }, []);
  const handleCloseFunc = useCallback(() => {
    console.log('close');
  }, []);

  return (
    <div>
      <button onClick={openPopupFunc}>Open popup </button>
      <Popup
        isOpen={isOpenDialog}
        setIsOpen={setIsOpenDialog}
        handleSubmit={handleSubmitFunc}
        handleClose={handleCloseFunc}
      >
        hello world
      </Popup>
    </div>
  );
};

Props

PropertytypeDefault ValueDescription
isOpenBooleanfalsestate of popup
setIsOpenFuncchange state of popup
childrenReactNodesome children to show in popup body
handleSubmitFuncon press submit button handler
handleCloseFuncon press close button handler
closeOnPressEscapeBooleantrueclose active popup when press esc key
closeOnClickAwayBooleantrueclose popup when click outside
widthString'50%'popup width
heightString'50%'popup height
headerStringpopup header
2.9.1

2 years ago

2.8.2

2 years ago

2.8.1

2 years ago

2.8.0

2 years ago

2.7.2

2 years ago

2.7.1

2 years ago

2.6.0

2 years ago

2.5.0

2 years ago

2.4.0

2 years ago

2.3.0

2 years ago

2.1.0

2 years ago

2.0.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago