Skip to content

Poppable context ​

useOokoPoppable returns the closest surrounding dialog or drawer so a nested component can close it deliberately.

ts
import { useOokoPoppable } from "ooko-ui/poppable";

const { close } = useOokoPoppable();

Call it only from a descendant of ODialog or ODrawer. The context is scoped to that component tree and has no browser or server-side global state.

API reference ​

Returns the closest surrounding dialog or drawer context.

ts
function useOokoPoppable(): OokoPoppableContext

Parameters ​

ParameterTypeRequiredDefaultDescription
nonenonenonenonenone

Returns ​

MemberTypeDescription
kindOokoPoppableKindKind of the surrounding poppable.
footerTargetReadonly<Ref<HTMLElement | null, HTMLElement | null>>DOM target used by OPoppableFooter.
close(options?: OokoPoppableCloseOptions) => voidCloses the surrounding poppable.
TypeDefinition
OokoPoppableContextinterface OokoPoppableContext { /** Kind of the surrounding poppable. */ kind: OokoPoppableKind; /** DOM target used by OPoppableFooter. */ footerTarget: Readonly<Ref<HTMLElement | null>>; /** Closes the surrounding poppable. */ close: (options?: OokoPoppableCloseOptions) => void; }