Open links

Open URLs, deep links, and native screens from your app.

Open a page as a modal

Present another page over the current one without losing its state. Pass transition: "modal"; modal_style is sheet or fullscreen (default sheet), and modal_detent is large or medium (default large, sheets only). Close dismisses the whole modal; Back pops pages inside it.

Test session persistence and state synchronization in your own app on each platform. Do not assume closing behaviour from an ordinary browser history example.

try {
  await bdk.navigation.navigate({
    url: "https://example.com/checkout",
    transition: "modal",
    modal_style: "sheet",
    modal_detent: "medium"
  });
} catch {
  showNavigationUnavailable();
}

Older app builds open it as a normal page. Where the platform offers only fullscreen (Android today), a sheet request presents fullscreen.

Know when a modal closes

The page that opened the modal receives navigation.dismissed once after it closes. Subscribe before you call. The payload is a NavigationDismissedEvent.

try {
  bdk.on("navigation.dismissed", (event) => {
    console.log(event.reason, event.url);
  });

  await bdk.navigation.navigate({
    url: "https://example.com/checkout",
    transition: "modal",
    modal_style: "sheet",
    modal_detent: "medium"
  });
} catch {
  showNavigationUnavailable();
}

Fall back to web navigation

Choose native or web navigation at startup. Use the settled result in the user action.

// Client startup; keep navigation controls disabled until this settles.
let nativeReady = bdk.environment() === "native";
let detectionComplete = nativeReady;
if (detectionComplete) {
  enableNavigationControls();
} else {
  void bdk.ready(3000).then((info) => {
    nativeReady = info !== null;
    detectionComplete = true;
    enableNavigationControls();
  });
}

function openPage(path: string) {
  if (!detectionComplete) return;
  const url = new URL(path, window.location.origin).href;
  if (!nativeReady) {
    window.location.assign(url);
    return;
  }
  void bdk.navigation.openLink({ link: url, view: "website" })
    .catch(() => showNavigationUnavailable());
}

See every native feature with its demo on thebdk.com.