API Reference
Public provider, hook, facade, and exported types.
API Reference
@ilokesto/modal exports named values only.
Values
ModalProvider
Hosts modal rendering by wiring the modal adapter into @ilokesto/overlay.
<ModalProvider>{children}</ModalProvider>Optional prop:
store?→ custom overlay store, otherwise the default global modal store is used
useModal()
React command API returning:
{
open(options)
display<T>(options)
close(id, result?)
remove(id?)
clear()
}Important behavior:
open()returns aniddisplay()returns a promiseclose()begins the closing phaseremove()force-removes the item
modal
Module-level facade with the same command shape:
modal.open(options)
modal.display<T>(options)
modal.close(id, result?)
modal.remove(id?)
modal.clear()globalModalStore
The default overlay store used by the facade and by ModalProvider when no custom store is passed.
Types
ModalProps
Supported fields:
children?: ReactNodetransport?: 'inline' | 'top-layer'position?: ModalPositiondismissible?: booleanonDismiss?: () => voidclassName?: stringstyle?: React.CSSPropertiesbackdropClassName?: stringbackdropStyle?: React.CSSPropertiesautoFocus?: booleanrestoreFocus?: boolean
ModalPosition
'center'
| 'top'
| 'bottom'
| 'left'
| 'right'
| 'top-left'
| 'top-right'
| 'bottom-left'
| 'bottom-right'Other exported types
ModalProviderPropsUseModalOptionsModalFacadeOptionsModalAdapterProps