2.9.1 • Published 3 years ago
react-smart-popup v2.9.1
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 --saveOr via yarn:
yarn add react-smart-popupExample
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
| Property | type | Default Value | Description |
|---|---|---|---|
| isOpen | Boolean | false | state of popup |
| setIsOpen | Func | change state of popup | |
| children | ReactNode | some children to show in popup body | |
| handleSubmit | Func | on press submit button handler | |
| handleClose | Func | on press close button handler | |
| closeOnPressEscape | Boolean | true | close active popup when press esc key |
| closeOnClickAway | Boolean | true | close popup when click outside |
| width | String | '50%' | popup width |
| height | String | '50%' | popup height |
| header | String | popup header |
2.9.1
3 years ago
2.8.2
3 years ago
2.8.1
3 years ago
2.8.0
3 years ago
2.7.2
3 years ago
2.7.1
3 years ago
2.6.0
3 years ago
2.5.0
3 years ago
2.4.0
3 years ago
2.3.0
3 years ago
2.1.0
3 years ago
2.0.0
3 years ago
1.1.1
3 years ago
1.1.0
3 years ago
1.0.5
3 years ago
1.0.4
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago