Modal (Deprecated)
Modal is deprecated. Please use the Sheet component instead with the modal variant. This Sheet + modal variant automatically provides the default mobile experience that we want
React
import { Modal } from '@hoverinc/design-system-react-web';
Render the Modal component itself unconditionally using the isOpen and
onClose props to control its open state. The
useDisclosure hook is purpose-built to
manage the open state of overlays.
| Prop | Description |
|---|---|
size | Sets a specific size for the Modal. Valid values are small, medium, large, full or auto. See below for more information on sizing. |
header | Sets the heading content. The value can be a simple string, in which case it is rendered as the appropriate Heading style. A JSX fragment can also be provided. |
footer | Sets the footer content. When provided, footer content is wrapped in an HStack by default with the appropriate spacing. If the footer content is wrapped in a layout container (Box, Stack, etc.), it will be rendered as the footer element. |
isClosable | Defaults to true. |
Scrollable Content
By default, content will expand the modal to fill screen. When displaying
long-form content in a Modal, you likely want to restrict the height of the
scrollable container. Pass maxContentHeight to control the maximum height of
the scroll container.
Size
Full
Expand the Modal to fill the viewport in both dimensions.
Auto
Size the Modal to fit its content.
This size is useful for images and other media that have explicit dimensions or
if you want to control the size of the Modal manually by specifying width
and/or height on the children.
Bootstrap
To use the Bootstrap Modal you must have the Bootstrap JavaScript bundle installed. You do not need to initialize this component with your own JS. It should just work!
Here is an example of what a Bootstrap Modal looks like (we have overridden
a couple of things so you can see it without having to click a trigger to open
it). By default, you will get the size and typography shown. We offer 3 size
variants aligned to the Figma components. The class .modal-md is the same as
the default, as shown here. You can use .modal-lg or .modal-sm to get those
size variants. See Bootstrap's docs for Modal for more options and classes you
can use if the basics shown here don't cover your use case.
| Class | Description |
|---|---|
.modal-sm, .modal-lg | Apply to your <div class="modal"> wrapper to set a non-default size for your Modal. |