MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / useIonPopover

Function useIonPopover

packages/react/src/hooks/useIonPopover.ts:19–36  ·  view source on GitHub ↗
(component: ReactComponentOrElement, componentProps?: any)

Source from the content-addressed store, hash-verified

17 * @returns Returns the present and dismiss methods in an array
18 */
19export function useIonPopover(component: ReactComponentOrElement, componentProps?: any): UseIonPopoverResult {
20 const controller = useOverlay<PopoverOptions, HTMLIonPopoverElement>(
21 'IonPopover',
22 popoverController,
23 defineCustomElement,
24 component,
25 componentProps
26 );
27
28 const present = useCallback(
29 (options: Omit<PopoverOptions, 'component' | 'componentProps'> & HookOverlayOptions = {}) => {
30 controller.present(options as any);
31 },
32 [controller.present]
33 );
34
35 return [present, controller.dismiss];
36}
37
38export type UseIonPopoverResult = [
39 (options?: Omit<PopoverOptions, 'component' | 'componentProps'> & HookOverlayOptions) => void,

Callers 1

PopoverHookFunction · 0.90

Calls 2

useOverlayFunction · 0.90
presentMethod · 0.65

Tested by

no test coverage detected