Skip to content

Drawers ​

useOokoDrawer opens a nested component in the application poppable host.

ts
import { useOokoDrawer } from "ooko-ui/drawer";

const drawer = useOokoDrawer();
drawer.open({ title: "Filters", placement: "end", component: FilterPanel });

Render one <OPoppableHost /> near the application root. Drawers share the same LIFO queue as dialogs, and the controller is isolated to its Vue application for SSR safety.

API reference ​

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

ts
function useOokoDrawer(): OokoDrawerController

Parameters ​

ParameterTypeRequiredDefaultDescription
nonenonenonenonenone

Returns ​

MemberTypeDescription
open(options: OokoDrawerOptions) => OokoPoppableHandleOpens a drawer and returns a handle for closing it.
flush() => voidCloses the active dialog or drawer and clears suspended entries.
TypeDefinition
ODrawerPlacementtype ODrawerPlacement = "start" | "end";
OokoDrawerControllerinterface OokoDrawerController { /** Opens a drawer and returns a handle for closing it. */ open: (options: OokoDrawerOptions) => OokoPoppableHandle; /** Closes the active dialog or drawer and clears suspended entries. */ flush: () => void; }
OokoDrawerOptionsinterface OokoDrawerOptions extends OokoPoppableOptions { /** Side from which the drawer enters. Defaults to end. */ placement?: ODrawerPlacement; }
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; }