@dialog-fn/react
createDialog<T, K, S>(Component, options?) => DialogInstance<T, K, S>
Param Type Description ComponentFC<DialogComponentProps<T,K,S>>Your dialog component. optionsDialogOptionsMount behavior (optional).
DialogInstance<T, K, S>
Member Type Description DialogFC<{ state?: S }>Render once to mount the dialog. showShowDialog<T, K>Open and await the result. close() => voidDismiss the dialog.
ShowDialog<T, K>
interface ShowDialog< T , K > {
( data ?: T ) : Promise < K | undefined >; // resolves confirm value, or undefined on dismiss
DialogComponentProps<T, K, S>
Prop Type isOpenbooleandataTonConfirm(value?: K) => voidonClose() => voidstateS
DialogOptions
Option Type Default forceUnmountbooleanfalsedelayUnmountnumber0
@dialog-fn/core
The framework-agnostic store both adapters are built on. Use it to write an adapter for
another framework.
createDialogStore<T, K>(options?) => DialogStore<T, K>
Returns { getState, subscribe, open, close, confirm, setData, showDialog, destroy }.
showDialog(data) resolves with the confirm value or undefined; subscribe(listener)
returns an unsubscribe function; destroy() settles any pending promise and clears listeners.