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(): OokoPoppableContextParameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| none | none | none | none | none |
Returns
| Member | Type | Description |
|---|---|---|
kind | OokoPoppableKind | Kind of the surrounding poppable. |
footerTarget | Readonly<Ref<HTMLElement | null, HTMLElement | null>> | DOM target used by OPoppableFooter. |
close | (options?: OokoPoppableCloseOptions) => void | Closes the surrounding poppable. |
Related types
| Type | Definition |
|---|---|
OokoPoppableContext | interface 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; } |