Skip to main content
@capgo/capacitor-native-loader UI & System Open source

Native Loader Capacitor plugin

Show native animated loaders, transparent overlays, Lottie assets, and WebView-resizing loading states from JavaScript or native code

Install

bun add @capgo/capacitor-native-loader bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-native-loader
  • pnpm add @capgo/capacitor-native-loader
  • yarn add @capgo/capacitor-native-loader

Guide

How to use Native Loader in Capacitor

Test on device

Download the Capgo app, then scan the QR code.

Native Loader plugin preview QR code

Using @capgo/capacitor-native-loader

@capgo/capacitor-native-loader renders loading states through native iOS and Android views. Use it when a loader needs to stay smooth while the WebView is busy, when transparent fullscreen effects are expensive in CSS, or when another native plugin needs to show loading UI before JavaScript is ready.

Install

npm install @capgo/capacitor-native-loader
npx cap sync

Fullscreen Native Loader

import { NativeLoader } from '@capgo/capacitor-native-loader';

const { id } = await NativeLoader.show({
  style: 'siri',
  placement: 'fullscreen',
  message: 'Preparing your session',
  colors: ['#71f6ff', '#8b5cf6', '#ff4ecd', '#fff7ad'],
  scrimColor: 'rgba(3, 7, 18, 0.42)',
  interactionMode: 'block',
});

await initializeAppData();
await NativeLoader.hide({ id });

Edge Loader With WebView Resize

await NativeLoader.setWebViewLayout({
  mode: 'inset',
  insets: { top: 96 },
  animated: true,
});

await NativeLoader.show({
  style: 'wave',
  placement: 'top',
  message: 'Syncing changes',
  interactionMode: 'passThrough',
});

When loading finishes, restore the WebView:

await NativeLoader.hideAll({ restoreWebView: true });

Chrome-Style Top Progress

Use the native top progress loader when you want a browser-like loading bar above the WebView without asking CSS to animate during heavy work.

const { id } = await NativeLoader.show({
  style: 'chrome',
  placement: 'top',
  colors: ['#4285f4', '#34a853', '#fbbc05', '#ea4335'],
  thickness: 4,
  interactionMode: 'passThrough',
  webView: {
    mode: 'resize',
    insets: { top: 12 },
    restoreOnHide: true,
  },
});

await NativeLoader.hide({ id, restoreWebView: true });

Siri V2 Edge Loader

Use siri-v2 for a native full-screen loader that moves color around the screen edge while the WebView remains visible.

const { id } = await NativeLoader.show({
  style: 'siri-v2',
  placement: 'fullscreen',
  colors: ['#71f6ff', '#8b5cf6', '#ff4ecd', '#fff7ad'],
  thickness: 10,
  scrimColor: 'rgba(3, 7, 18, 0.10)',
  interactionMode: 'passThrough',
});

await NativeLoader.hide({ id });

Lottie Loader

await NativeLoader.show({
  style: 'lottie',
  placement: 'center',
  asset: {
    type: 'lottie',
    source: 'loader.json',
    loop: true,
  },
});

Bundled assets are best for startup loaders because they are available before network requests and JavaScript initialization.

Native Plugin Calls

The plugin exposes public native APIs so another plugin can show or hide loaders directly.

Swift:

import CapgoCapacitorNativeLoader

let id = NativeLoader.shared.show(options: [
  "style": "orbit",
  "placement": "fullscreen",
  "message": "Opening secure session"
])

NativeLoader.shared.hide(id: id)

Kotlin:

import app.capgo.nativeloader.NativeLoader

val id = NativeLoader.show(
  activity = activity,
  options = mapOf(
    "style" to "orbit",
    "placement" to "fullscreen",
    "message" to "Loading profile",
  ),
  webView = bridge.webView,
)

NativeLoader.hide(id)

Keep going from Using @capgo/capacitor-native-loader

If you are using Using @capgo/capacitor-native-loader to plan native media and interface behavior, connect it with @capgo/capacitor-native-loader for implementation details, Getting Started for setup, Using @capgo/capacitor-native-navigation for native chrome and WebView layout, and Using @capgo/capacitor-transitions for WebView route motion.

FAQ

Native Loader plugin FAQ

How do I install the Native Loader plugin in a Capacitor app?

Run "bun add @capgo/capacitor-native-loader" (or "npm install @capgo/capacitor-native-loader"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-native-loader" in your app code.

Does @capgo/capacitor-native-loader work with React, Vue and Angular?

Yes. Native Loader is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-native-loader support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-native-loader free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-native-loader/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses Native Loader without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship Native Loader changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo