Modal
Modals provide a way to display dialogs to your users.
Examples
import React from 'react';
import ReactDOM from 'react-dom';
import { ModalCenter, Modal, ModalSection, Button } from 'furl-components';
const modalCenterRef = React.createRef();
ReactDOM.render(
<div>
<ModalCenter ref={modalCenterRef} />
<Button color='primary' onClick={() => {
modalCenterRef.current.setContent(
<Modal>
<ModalSection>
<h5>Howdy, there!</h5>
<p>Nice to see you here. You can learn more about our website by visiting more pages.</p>
<Button color='primary' onClick={() => modalCenterRef.current.hide()}>Take me back</Button>
</ModalSection>
</Modal>
);
modalCenterRef.current.show();
}}>Open modal dialog</Button>
</div>,
document.getElementById('root')
);API
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| ref | modal center ref | React Ref | |||
| isOpen | modal center open state | boolean | false | ||
| Method | Description | ||
|---|---|---|---|
| setContent() | set content of the modal center | ||
| show() | show content of the modal center | ||
| hide() | hide content of the modal center | ||
| Property | Description | Type | Default | ||
|---|---|---|---|---|---|
| media | modal section media url | string | |||
| height | modal section height | int/string | 'auto' | ||
Notes
- It is highly recommended to provide a
reffor yourModalCentervia the use ofReact.createRef().ModalCentershould only be used once in your app and it should be reused viaref.currentfor multiple modal dialogs. - A
ModalCenteronly accepts children of theModalcomponent type, set either normally or via thesetContentmethod. - A
Modalonly accepts children of theModalSectioncomponent type. - The
ModalSection’sheightaccepts any valid CSS value, including CSS variables, and will only be applied ifmediais specified. - If a
ModalSectionhas amediaprop specified, it should not have any children.
