1. Component Guide
  2. Single page notification button
  3. With js enhancement
Single page notification button example

With js enhancement

If the js-enhancement flag is present, the component uses JavaScript to check if the user has already subscribed to email notifications on the current page and accordingly updates its tracking attribute and (optionally) button text.

How it looks (preview)

How to call this example

<%= render "govuk_publishing_components/components/single_page_notification_button", {
  base_path: "/current-page-path",
  js_enhancement: true
} %>