Skip to main content

Modal

caution

All props/parameters are optional unless they are marked with an asterisk ( * ).

caution

This component requires the use of the common module modal.

Example

import { common, components } from "replugged";
const { modal } = common;
const { Modal } = components;

modal.openModal((props) => (
<Modal.ModalRoot {...props}>
<Modal.ModalHeader>{/* Your components for the header here */}</Modal.ModalHeader>
<Modal.ModalContent>{/* Your components here */}</Modal.ModalContent>
<Modal.ModalFooter>{/* Your components for the footer here */}</Modal.ModalFooter>
</Modal.ModalRoot>
));

Subcomponents

ComponentDescription
Modal.ModalCloseButtonClose button component
Modal.ModalContentContains the content
Modal.ModalFooterContains the footer
Modal.ModalHeaderContains the header
Modal.ModalRootModal root component

Modal.ModalCloseButton

Props:

NameTypeDefaultDescription
classNamestringComponent class name
focusPropsRecord<string, unknown>Props for the FocusRing component
hideOnFullscreenbooleanfalseWhether the button is hidden when modal is in fullscreen
onClick* (): voidFunction ran when clicking the close button
withCircleBackgroundbooleanfalseWhether the button is in a circle

Modal.ModalContent

Props:

info

The props of this component extend the attributes of the div element.

NameTypeDefaultDescription
scrollbarType"auto" | "none" | "thin"thinScrollbar type
scrollerRefRef<unknown>Scroller ref

Modal.ModalFooter

Props:

NameTypeDefaultDescription
alignFlex.AlignFlex.Align.STRETCHFlexbox align
classNamestringComponent class name
directionFlex.DirectionFlex.Direction.HORIZONTAL_REVERSEFlexbox direction
justifyFlex.JustifyFlex.Justify.STARTFlexbox justify
wrapFlex.WrapFlex.Wrap.NO_WRAPFlexbox wrap

Modal.ModalHeader

Props:

NameTypeDefaultDescription
alignFlex.AlignFlex.Align.CENTERFlexbox align
classNamestringComponent class name
directionFlex.DirectionFlex.Direction.HORIZONTALFlexbox direction
justifyFlex.JustifyFlex.Justify.STARTFlexbox justify
separatorbooleanfalseWhether a divider is shown between the header and the modal content
wrapFlex.WrapFlex.Wrap.NO_WRAPFlexbox wrap

Modal.ModalRoot

Props:

info

The props of this component extend the attributes of the div element.

NameTypeDefaultDescription
classNamestringComponent class name
fullscreenOnMobilebooleantrueWhether the modal is in fullscreen if app is in mobile view
hideShadowbooleanfalseWhether the shadow is hidden
onAnimationEnd(): stringFunction ran when the modal stopped animating
returnRefRef<unknown>Returned ref
rolestringdialogModal element role
sizestringsmallModal size
transitionStatestringModal state