--- 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 `
` element: ```html
``` * data-discard-confirmation boolean * data-save-bar boolean * onreset (event: Event) => void * onsubmit (event: SubmitEvent) => void Examples ## Preview ![](https://shopify.dev/images/templated-apis-screenshots/admin/app-bridge-web-components/forms-alt.png) ### Examples * #### Form with automatic save bar ##### Default ```html
``` * #### 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
Submit Reset
``` ## 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)