Skip to main content
Control what happens when a user clicks a link in the editor. By default, SuperDoc shows a built-in popover with the link URL and edit controls. With popoverResolver, you can replace it with your own UI in any framework.

Quick start

No configuration needed for the default behavior — click a link and the built-in popover appears. To customize, add a popoverResolver to the links module:

Configuration

Synchronous function called when a user clicks a link. Receives a context object and returns a resolution that determines which popover to show. Return null or undefined to use the default popover.
The resolver must be synchronous. Do not return a Promise. If the resolver throws, SuperDoc falls back to the default popover and calls onException.

Resolver context

The resolver receives a LinkPopoverContext object with all information about the clicked link:

Resolution types

The resolver returns one of four resolution types. Return null or undefined to use the default popover.

default

Show the built-in link popover with URL display and edit controls.

none

Suppress the popover entirely. Use this when the resolver handles the click itself (navigation, opening a modal, logging, etc.).

custom

Render a Vue component inside the built-in popover shell. editor and closePopover are automatically injected as props alongside any props you provide.
Your component receives editor, closePopover, and any additional props:

external

Mount framework-agnostic UI into a raw DOM container. Use this for React, Svelte, vanilla JS, or any non-Vue framework. SuperDoc creates a positioned <div> element and passes it to your render function. You mount your UI into that container. Return a { destroy } callback for cleanup when the popover closes.
The render function receives an ExternalPopoverRenderContext:
The popover automatically closes on click-outside and Escape key — matching the built-in popover behavior. Your destroy callback is called in both cases.

Framework examples

Use createRoot to mount a React component into the external container. Return destroy to unmount cleanly.
With the React wrapper:

Styling

External popovers use CSS custom properties with sensible defaults that match the built-in popover. Override them to match your design system.

Shared popover variables

These apply to both the built-in popover and external link popovers: Override just the external link popover without affecting other popovers: Example — dark theme for external link popovers:
The external popover container also has the class sd-external-link-popover for direct CSS targeting:

Behavior

  • Toggle off: Clicking a link while its popover is already open closes the popover.
  • Click outside: Clicking anywhere outside the popover closes it.
  • Escape key: Pressing Escape closes the popover.
  • Focus: When a popover closes, focus returns to the editor.
  • Error handling: If the resolver or render function throws, SuperDoc falls back to the default popover and calls the onException callback.
  • Cursor: The editor cursor moves to the clicked link position before the resolver runs.

Conditional resolution

Use resolver context to show different popovers based on link type, document mode, or any other condition: