Skip to content

Dialogs ​

useOokoDialog opens a nested component in the application poppable host.

ts
import { useOokoDialog } from "ooko-ui/dialog";

const dialog = useOokoDialog();
const handle = dialog.open({ title: "Confirm", component: ConfirmDelete });

handle.close();

Render one <OPoppableHost /> near the application root. close() restores the preceding dialog or drawer; close({ flush: true }) and flush() discard the suspended queue. The controller is isolated to its Vue application and does not access browser APIs during server rendering.

API reference ​

Returns the application-scoped controller used to open dialogs programmatically.

ts
function useOokoDialog(): OokoDialogController

Parameters ​

ParameterTypeRequiredDefaultDescription
nonenonenonenonenone

Returns ​

MemberTypeDescription
open(options: OokoDialogOptions) => OokoPoppableHandleOpens a dialog and returns a handle for closing it.
flush() => voidCloses the active dialog or drawer and clears suspended entries.
TypeDefinition
OokoDialogControllerinterface OokoDialogController { /** Opens a dialog and returns a handle for closing it. */ open: (options: OokoDialogOptions) => OokoPoppableHandle; /** Closes the active dialog or drawer and clears suspended entries. */ flush: () => void; }
OokoDialogOptionstype OokoDialogOptions = OokoPoppableOptions;
OokoPoppableCloseOptionsinterface OokoPoppableCloseOptions { /** Removes every suspended poppable instead of restoring the preceding one. */ flush?: boolean; }
OokoPoppableHandleinterface OokoPoppableHandle { /** Stable identifier of the opened poppable. */ id: OokoPoppableId; /** Closes this poppable. By default, the preceding suspended poppable is restored. */ close: (options?: OokoPoppableCloseOptions) => void; }