Skip to content

Beta

These App Bridge components are new and have not yet been tested in a live Shopify admin. Their API may change in a minor release while in beta. If something doesn't work, please open an issue.

useAppBridge() ​

Before you start, see Install.

useAppBridge() returns the shopify global, typed as ShopifyGlobal:

vue
<script setup lang="ts">
import { useAppBridge } from 'polaris-vue-elements/app-bridge'

const shopify = useAppBridge()

function generate(): void {
  shopify.toast.show('Blog post template generated')
}
</script>

<template>
  <button @click="generate">Generate blog post</button>
</template>

As in @shopify/app-bridge-react:

  • On the server it returns an object that throws when you read any property. Call the APIs from onMounted() or an event handler.
  • In the browser it throws if shopify is not defined, which "likely means the App Bridge script tag was not added correctly to this page".

Using the shopify global directly, as the embedded-app guide does, works too.

Released under the MIT License. Vue logo by Evan You, CC BY-NC-SA 4.0.