Skip to Content
Archi-ui 1.0.25 is released 🎉

Modal

The model component provides a solid foundation for creating dialogs, popovers, lightboxes, or whatever else.

The component renders its children node in front of backdrop component. The model offers important features:

  • Manages model stacking when one-at-a time just isn’t enough.
  • Creates a backdrop, for disabling interaction below the modal.
  • It disables scrolling of the page content while open.
  • It provides manages moving to the modal content, and keeping it there until the modal is closed.

Basic Modal

Usage

import { Modal, Typography } from 'archi-ui'
<Modal open={true}> <Typography variant='h2'>This is Modal</Typography> <Typography className="mt-2">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Ipsam culpa aliquam aperiam commodi ullam iure laboriosam animi magni asperiores. Rem ratione odit explicabo ut eveniet illo eum dicta reprehenderit unde.</Typography> </Modal>

Nested Modal

Modals can be nested, for example a Select within a dialog, but stacking of more than two models, or any two models with a backdrop is discouraged.

API reference docs for the React Modal component.

Props

NameTypeDefaultDescription
childrennode-A single child content element.
classNamestring-Override or extend the styles applied to the component
openbool-If true, the component is shown.
disableEscapeKeyDownboolfalseIf true, hitting escape will not fire the onClose callback.
maxWidth'xl' | 'lg' | 'md' | 'sm' | 'xs''sm'Determine the max-width of the modal. The modal width grows with the size of the screen.
onClosefunc-Callback fired when the component is requests to be closed.
Signature: function() => void.
onBackdropClickfunc-A function is triggred if provided when backdrop is been clicked.
BackdropPropsobject-Props applied to the Backdrop element.
hideBackdropboolfalseIf true, the backdrop is not rendered.
disableScrollLockboolfalseDisable the scroll lock behavior.
Last updated on