`useModal` hook is used to utilize @adminjs-design-system `Modal` molecule embedded in AdminJS components structure. ### Where you might want to use it? The hook was designed to be used in three cases * display alert information (non blocking) * display confirm window * display any content in modal ## Examples Let's create simple React component with button to fire modal example. We will change `openModal` props to demonstrate modal usage ```javascript import { Box, Button, Input, Label, Text, TextArea } from '@adminjs/design-system' import { useModal } from 'adminjs' import React from 'react' const ModalPage = () => { const { openModal, closeModal } = useModal() const modalConfig = { // here we put modal config } return ( ) } ``` ### Alert To display alert modal we feed following object into `openModal` function ```javascript const modalConfig = { modalProps: { title: 'somethingHappened', variant: 'info' }, type: 'alert', } ``` ### Confirm Confirm modal require function `confirmAction` which will be fired after confirm, so example config can look like this ```javascript const modalConfig = { modalProps: { title: 'areYouSureToDoThis', variant: 'danger' }, type: 'confirm', confirmAction: () => { console.log('Confirmed !!!') }, } ``` ### Form We can display any content in our modal. For demo purposes we create simple form component ```javascript const feedbackForm = () => { return ( Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.