> ## Documentation Index > Fetch the complete documentation index at: https://www.canva.dev/docs/apps/llms.txt > Use this file to discover all available pages before exploring further. # overlay.registerOnCanOpen API reference for the overlay.registerOnCanOpen method. Registers a callback that runs when the `canOpen` state of an overlay target changes. ## Usage ### Register overlay handler ```typescript import { overlay } from "@canva/design"; overlay.registerOnCanOpen({ target: 'image_selection', onCanOpen: async (event) => { if (event.canOpen) { // Can open overlay for selected image } } }); ``` ### Open image editing overlay ```typescript import { overlay } from "@canva/design"; overlay.registerOnCanOpen({ target: 'image_selection', onCanOpen: async (event) => { if (event.canOpen) { const processId = await event.open({ launchParameters: { mode: 'edit' } }); // Overlay process started, with `processId` } } }); ``` ### Open overlay with filters ```typescript import { overlay } from "@canva/design"; overlay.registerOnCanOpen({ target: 'image_selection', onCanOpen: async (event) => { if (event.canOpen) { await event.open({ launchParameters: { mode: 'edit', filters: ['brightness', 'contrast', 'saturation'] } }); } } }); ``` ### Handle overlay unavailability ```typescript import { overlay } from "@canva/design"; overlay.registerOnCanOpen({ target: 'image_selection', onCanOpen: async (event) => { if (!event.canOpen) { // Cannot open overlay, handle specific reasons switch (event.reason) { case 'no_selection': // No image is selected break; case 'invalid_selection': // Selected content cannot be edited break; } } } }); ``` ## Parameters Options for configuring the callback. Properties of opts}> The target to check the `canOpen` state of. The only valid value is `"image_selection"`. A callback that runs when the `canOpen` state of the specified target changes. This callback fires immediately. **Parameters** Information about whether or not an overlay can be opened for the specified target. Information about an overlay that can't be opened for the specified target. Indicates that the overlay can't be opened for the specified target. The only valid value is `false`. Indicates the reason the overlay can't be opened for the specified target. Indicates that the overlay can be opened for the selected image. The only valid value is `true`. Opens an overlay for the selected image. **Parameters** Properties of options}> Parameters to pass to the overlay when it opens. This can be any type of structured data. **Returns** A unique identifier that references an app runtime process. `Promise` **Returns** `void` ## Returns () => `void`