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.

SaveBar ​

Before you start, see Install; for open, see Modal.

SaveBar renders ui-save-bar. As the ui-save-bar types describe, "the button with variant primary is the Save button and the button without a variant is the Discard button":

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

const dirty = ref(false)

function save(): void {
  dirty.value = false
}
function discard(): void {
  dirty.value = false
}
</script>

<template>
  <SaveBar id="settings-save-bar" v-model:open="dirty" discard-confirmation>
    <button variant="primary" @click="save">Save</button>
    <button @click="discard">Discard</button>
  </SaveBar>
</template>

open, v-model:open, show/hide and hiding on unmount work as for Modal. discardConfirmation ("whether to show a confirmation dialog when the discard button is clicked") is set as the element's discardConfirmation property.

For a form, the data-save-bar attribute in the embedded-app guide needs no component.

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