--- title: Save bar description: >- Enable automatic save bar integration for HTML forms by adding the data-save-bar attribute to your form element. When form data changes, a save bar automatically appears, prompting users to save or api_name: app-home source_url: html: 'https://shopify.dev/docs/api/app-home/app-bridge-web-components/save-bar' md: 'https://shopify.dev/docs/api/app-home/app-bridge-web-components/save-bar.md' --- # Save bar Enable automatic save bar integration for HTML forms by adding the `data-save-bar` attribute to your form element. When form data changes, a save bar automatically appears, prompting users to save or discard their changes. Alternatively, use the [Save Bar API](https://shopify.dev/docs/api/app-home/apis/save-bar) for programmatic control over the save bar behavior. Programmatic control is available as `shopify.saveBar.show()`, `shopify.saveBar.hide()`, and `shopify.saveBar.toggle()`. **Note:** The save bar functionality requires the full App Bridge UI library to be loaded via a [script tag](https://shopify.dev/docs/api/polaris/using-polaris-web-components). #### Use cases * **Form change tracking:** Automatically detect unsaved form changes and display a save bar using the `data-save-bar` attribute. * **Save and discard:** Provide merchants with clear save and discard actions when form data has been modified. * **Discard confirmation:** Add a confirmation dialog before discarding changes to prevent accidental data loss. * **Form reset handling:** Listen for form submit and reset events to handle save and discard actions. *** ## Attributes Add these attributes to your `
``` ### Submit and reset handlers Handle form submission and reset using standard HTML form events. ## Submit and reset handlers  ## html ```html ``` ### Discard confirmation Add `data-discard-confirmation` to show a confirmation dialog when the discard button is clicked, preventing accidental data loss. ## Discard confirmation  ## html ```html ``` *** ## Best practices * **Always provide discard functionality**: Allow merchants to revert changes by handling the discard action or using form reset. * **Show loading states during save**: Use the [Loading API](https://shopify.dev/docs/api/app-home/apis/loading) to indicate when an async save operation is in progress. * **Use `data-discard-confirmation` for destructive forms**: Add a confirmation dialog when discarding changes would result in significant data loss. *** ## Limitations `data-save-bar` isn't supported inside modals. Forms inside modals should use the [Save Bar API](https://shopify.dev/docs/api/app-home/apis/save-bar) programmatically if save or discard functionality is needed. ***