---
title: "UiSaveBar"
description: "Contextual save/discard bar. Wraps the App Bridge <ui-save-bar> web component."
canonical_url: "https://shopify.yan.ad/components/app-bridge-ui/ui-save-bar"
---
# UiSaveBar

> Contextual save/discard bar. Wraps the App Bridge <ui-save-bar> web component.

## Live preview

This component integrates with Shopify App Bridge and requires an authenticated Shopify admin host. It cannot run faithfully in a standalone documentation iframe. Use the [authenticated playground](https://github.com/yan-ad/nuxt-shopify/tree/main/playground) to try it with your development store.

## Shopify admin example

```vue
<script setup>
const shopify = useAppBridge()

function onFormChange() {
  shopify.saveBar.show('my-save-bar')
}

function handleSave() {
  // ...save logic
  shopify.saveBar.hide('my-save-bar')
}

function handleDiscard() {
  shopify.saveBar.hide('my-save-bar')
}
</script>

<template>
  <ShUiSaveBar
    id="my-save-bar"
    discard-confirmation
    :primary-action="{ label: 'Save', onClick: handleSave }"
    :secondary-action="{ label: 'Discard', onClick: handleDiscard }"
  />
</template>
```

## Props

<table>
<thead>
  <tr>
    <th>
      Prop
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Yes
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Unique identifier
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        discardConfirmation
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      No
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Show confirmation dialog on discard
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        primaryAction
      </code>
    </td>
    
    <td>
      <code>
        SaveBarAction
      </code>
    </td>
    
    <td>
      No
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Primary (save) button
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        secondaryAction
      </code>
    </td>
    
    <td>
      <code>
        SaveBarAction
      </code>
    </td>
    
    <td>
      No
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Secondary (discard) button
    </td>
  </tr>
</tbody>
</table>

```ts
interface SaveBarAction {
  label: string
  onClick: () => void
}
```

## Events

<table>
<thead>
  <tr>
    <th>
      Event
    </th>
    
    <th>
      Payload
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        show
      </code>
    </td>
    
    <td>
      <code>
        Event
      </code>
    </td>
    
    <td>
      Emitted when the save bar appears
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        hide
      </code>
    </td>
    
    <td>
      <code>
        Event
      </code>
    </td>
    
    <td>
      Emitted when the save bar is dismissed
    </td>
  </tr>
</tbody>
</table>

## App Bridge API

<table>
<thead>
  <tr>
    <th>
      Method
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        shopify.saveBar.show(id)
      </code>
    </td>
    
    <td>
      Shows the save bar
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        shopify.saveBar.hide(id)
      </code>
    </td>
    
    <td>
      Hides the save bar
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        shopify.saveBar.toggle(id)
      </code>
    </td>
    
    <td>
      Toggles save bar visibility
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        shopify.saveBar.leaveConfirmation()
      </code>
    </td>
    
    <td>
      Prompts confirmation before leaving with unsaved changes
    </td>
  </tr>
</tbody>
</table>

## App Bridge Element

Renders as `<ui-save-bar>`. See [App Bridge SaveBar docs](https://shopify.dev/docs/api/app-bridge-library/web-components/ui-save-bar).


## Sitemap

See the full [sitemap](https://shopify.yan.ad/sitemap.md) for all pages.
