Button example

With form attribute

Buttons will usually be contained within their containing form, but sometimes it is desirable to have the button outside the form with the form attribute pointing to the ID of the form. See The Mozilla dev docs on a button’s form attribute for more information.

How it looks (preview)

How to call this example

<%= render "govuk_publishing_components/components/button", {
  text: "With `form` argument",
  form: "some_form_id"
} %>