MCPcopy Create free account
hub / github.com/reactstrap/reactstrap / Example

Function Example

stories/examples/Modal/CustomCloseButtonExample.js:5–46  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

3import PropTypes from 'prop-types';
4
5function Example(props) {
6 const { className } = props;
7
8 const [modal, setModal] = useState(false);
9 const toggle = () => setModal(!modal);
10
11 const closeBtn = (
12 <button className="close" onClick={toggle} type="button">
13 &times;
14 </button>
15 );
16
17 return (
18 <div>
19 <Button color="danger" onClick={toggle}>
20 Click Me
21 </Button>
22 <Modal isOpen={modal} toggle={toggle} className={className}>
23 <ModalHeader toggle={toggle} close={closeBtn}>
24 Modal title
25 </ModalHeader>
26 <ModalBody>
27 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
28 eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
29 minim veniam, quis nostrud exercitation ullamco laboris nisi ut
30 aliquip ex ea commodo consequat. Duis aute irure dolor in
31 reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
32 pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
33 culpa qui officia deserunt mollit anim id est laborum.
34 </ModalBody>
35 <ModalFooter>
36 <Button color="primary" onClick={toggle}>
37 Do Something
38 </Button>{' '}
39 <Button color="secondary" onClick={toggle}>
40 Cancel
41 </Button>
42 </ModalFooter>
43 </Modal>
44 </div>
45 );
46}
47
48Example.propTypes = {
49 className: PropTypes.string,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…