Skip to main content

Base Modal Params

Every modal receives shared runtime props in addition to its own typed params.

Props

PropTypePurpose
closeModal() => voidCloses the current modal
onClose() => voidRuns when the modal is closed
closeOnClickOutsidebooleanAllows closing from backdrop click
closeOnPressEscbooleanAllows closing from the Escape key
positionstringControls placement and default body animation
blurbooleanApplies backdrop blur
backdrop{ className?: string; style?: CSSProperties }Backdrop class/style overrides
body{ className?: string; style?: CSSProperties }Body wrapper class/style overrides
animate{ animate?: TargetAndTransition; exit?: TargetAndTransition }Replaces default enter/exit animation

Typing helpers

Use these exported types when building modal components:

import type { ModalParams, Params } from 'react-motion-modal';
  • ModalParams<'SomeModal'>: modal-specific params plus closeModal
  • Params<'SomeModal'>: modal-specific params plus the full base modal param set