--- title: Forms 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 discard their changes. Alternatively, use the global `shopify.saveBar` API for programmatic control over the save bar behavior. Programmatic control of the save bar 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](/docs/api/app-home/using-polaris-components). api_name: app-home source_url: html: 'https://shopify.dev/docs/api/app-home/app-bridge-web-components/forms' md: 'https://shopify.dev/docs/api/app-home/app-bridge-web-components/forms.md' --- # Forms 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 global `shopify.saveBar` API for programmatic control over the save bar behavior. Programmatic control of the save bar 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/app-home/using-polaris-components). ## Enable save bar on forms Simply add `data-save-bar` to your `
``` * data-discard-confirmation boolean * data-save-bar boolean * onreset (event: Event) => void * onsubmit (event: SubmitEvent) => void ### Examples * #### Form with automatic save bar ##### Default ```html ``` ## Examples Quick examples of using the save bar with forms. ### Form integration examples Simple form with save bar Basic form with automatic save bar functionality. Programmatic save bar control Using the programmatic API for custom save logic. Form with onsubmit and onreset events Using the onsubmit and onreset events to handle form submission and reset. ### Examples * #### Simple form with save bar ##### Description Basic form with automatic save bar functionality. ##### Default ```html ``` * #### Programmatic save bar control ##### Description Using the programmatic API for custom save logic. ##### Default ```html ``` * #### Form with onsubmit and onreset events ##### Description Using the onsubmit and onreset events to handle form submission and reset. ##### Default ```html ``` ## Related [API - Save bar](https://shopify.dev/docs/api/app-bridge/apis/save-bar) [Guide - Form validation](https://shopify.dev/docs/api/app-bridge/guides/form-validation) [Guide - Data management](https://shopify.dev/docs/api/app-bridge/guides/data-management)