@developermafia/simple-alert-react
Version:
```bash npm i @developermafia/simple-alert-react ```
50 lines (39 loc) • 1.16 kB
Markdown
# simple-alert-react
```bash
npm i @developermafia/simple-alert-react
```
## Uso
```bash
import { useSimpleAlertReact } from '@developermafia/simple-alert-react';
```
```javascript
export function App() {
const { openAlert } = useSimpleAlertReact();
const createSimpleAlert = async () => {
const dialog = await openAlert({ content: 'Simple Alert' });
// console.log(dialog); get response user click
if (dialog === 'true') {
// Actions
}
};
return (
<div>
<button onClick={createSimpleAlert}>Click alert!</button>
</div>
);
}
export default App;
```
## Opciones de alerta
| PROP | TYPE |
| --------------- | --------------------- |
| acceptButton | boolean |
| cancelButton | boolean |
| content | string or JSX.Element |
| closeButton | boolean |
| opacityBackdrop | string (0.1 - 1) |
| colorBackdrop | string (Hexadecimal) |
| reverseButtons | boolean |
| textAccept | string |
| textCancel | string |
| closeOnEsc | boolean |