LOGO
Usage

How to usage

Start with simple modal


import React, { useState } from "react";
import { Modal } from "react-beautiful-modals";


const App = () => {
 const [open, setOpen] = useState(false);


 return (
   <Modal open={open} onClose={() => setOpen(false)}>
     <h1>Your content here</h1>
   </Modal>
 );
};


export default App;

Start with build in component modal


import React, { useState } from "react";
import {
 Modal,
 ModalCancelButton,
 ModalDescription,
 ModalFooter,
 ModalHeader,
 ModalSuccessButton,
 ModalTitle,
} from "react-beautiful-modals";


const App = () => {
 const [open, setOpen] = useState(false);


 return (
   <Modal open={open} onClose={() => setOpen(false)}>
     <ModalHeader>
       <ModalTitle>This is modal title</ModalTitle>
     </ModalHeader>
     <ModalDescription>This is modal Description</ModalDescription>
   </Modal>
 );
};


export default App;

Large Modal With Modal Control


import React, { useState } from "react";
import {
 Modal,
 ModalCancelButton,
 ModalDescription,
 ModalFooter,
 ModalHeader,
 ModalSuccessButton,
 ModalTitle,
} from "react-beautiful-modals";


const App = () => {
 const [open, setOpen] = useState(false);


 return (
   <Modal open={open} onClose={() => setOpen(false)}>
     <ModalHeader>
       <ModalTitle>This is modal title</ModalTitle>
     </ModalHeader>
     <ModalDescription>This is modal Description</ModalDescription>
   </Modal>
 );
};


export default App;

modal with button


import React, { useState } from "react";
import {
 Modal,
 ModalCancelButton,
 ModalDescription,
 ModalFooter,
 ModalHeader,
 ModalSuccessButton,
 ModalTitle,
} from "react-beautiful-modals";


const App = () => {
 const [open, setOpen] = useState(false);


 return (
   <Modal open={open} onClose={() => setOpen(false)}>
     <ModalHeader>
       <ModalTitle>This is modal title</ModalTitle>
     </ModalHeader>
      <ModalDivider/>
     <ModalDescription>This is modal Description</ModalDescription>
      <ModalDivider/>
     <ModalFooter>
       <ModalCancelButton onClose={() => setOpen(false)}>
         Cancel
       </ModalCancelButton>
       <ModalSuccessButton>Continue</ModalSuccessButton>
     </ModalFooter>
   </Modal>
 );
};


export default App;

Animated modal


import React, { useState } from "react";
import {
 Modal,
 ModalCancelButton,
 ModalDescription,
 ModalFooter,
 ModalHeader,
 ModalSuccessButton,
 ModalTitle,
} from "react-beautiful-modals";


const App = () => {
 const [open, setOpen] = useState(false);


 return (
   <Modal open={open} onClose={() => setOpen(false)} animationType="slide-up">
      <ModalHeader>
       <ModalTitle>This is modal title</ModalTitle>
     </ModalHeader>
     <ModalDescription>This is modal Description</ModalDescription>
     <ModalFooter>
       <ModalCancelButton  onClose={() => setOpen(false)}>
         Cancel
       </ModalCancelButton>
       <ModalSuccessButton>Continue</ModalSuccessButton>
     </ModalFooter>
   </Modal>
 );
};


export default App;

Loading button modal


import React, { useState } from "react";
import {
 Modal,
 ModalCancelButton,
 ModalDescription,
 ModalFooter,
 ModalHeader,
 ModalSuccessButton,
 ModalTitle,
} from "react-beautiful-modals";


const App = () => {
 const [open, setOpen] = useState(false);


 return (
   <Modal open={open} onClose={() => setOpen(false)} >
     <ModalHeader>
       <ModalTitle>This is modal title</ModalTitle>
     </ModalHeader>
     <ModalDescription>This is modal Description</ModalDescription>
     <ModalFooter>
       <ModalCancelButton  onClose={() => setOpen(false)}>
         Cancel
       </ModalCancelButton>
       <ModalSuccessButton>Continue</ModalSuccessButton>
     </ModalFooter>
   </Modal>
 );
};


export default App;

Icon Button Modal


import React, { useState } from "react";
import {
 Modal,
 ModalCancelButton,
 ModalDescription,
 ModalFooter,
 ModalHeader,
 ModalSuccessButton,
 ModalTitle,
} from "react-beautiful-modals";


const App = () => {
 const [open, setOpen] = useState(false);


 return (
   <Modal open={open} onClose={() => setOpen(false)} >
     <ModalHeader>
       <ModalTitle>This is modal title</ModalTitle>
     </ModalHeader>
     <ModalDescription>This is modal Description</ModalDescription>
     <ModalFooter>
       <ModalCancelButton endIcon={<Frown />  onClose={() => setOpen(false)}>
         Cancel
       </ModalCancelButton>
       <ModalSuccessButton startIcon={<Frown />>Continue</ModalSuccessButton>
     </ModalFooter>
   </Modal>
 );
};


export default App;

Modal With Divider Component


import React, { useState } from "react";
import {
 Modal,
 ModalCancelButton,
 ModalDescription,
 ModalFooter,
 ModalHeader,
 ModalSuccessButton,
 ModalTitle,
} from "react-beautiful-modals";


const App = () => {
 const [open, setOpen] = useState(false);


 return (
   <Modal open={open} onClose={() => setOpen(false)}>
     <ModalHeader>
       <ModalTitle>This is modal title</ModalTitle>
     </ModalHeader>
      <ModalDivider/>
     <ModalDescription>This is modal Description</ModalDescription>
      <ModalDivider/>
     <ModalFooter>
       <ModalCancelButton onClose={() => setOpen(false)}>
         Cancel
       </ModalCancelButton>
       <ModalSuccessButton>Continue</ModalSuccessButton>
     </ModalFooter>
   </Modal>
 );
};


export default App;
Copyright © saimundev