Skip to content

Latest commit

 

History

History
81 lines (54 loc) · 2.67 KB

File metadata and controls

81 lines (54 loc) · 2.67 KB

Button

GDS Button component

There are two tag helpers for the button component. <govuk-button> generates a <button> element; <govuk-button-link> generates an 'a' element.

Example - default button

<govuk-button type="submit">Save and continue</govuk-button>

Button

Example - secondary button

<govuk-button class="govuk-button--secondary">Cancel</govuk-button>

Button

Example - start button

<govuk-button-link is-start-button="true" href="/start">Start</govuk-button>

Button

Example - disabled

<govuk-button disabled="true">Save and continue</govuk-button>

Button

Example - link

<govuk-button-link href="/">Confirm</govuk-button>

Example - generated link

<govuk-button-link asp-controller="Home" asp-action="Confirm">Confirm</govuk-button>

Example - generated formaction

<govuk-button type="submit" asp-controller="Home" asp-action="Confirm">Confirm</govuk-button>

API

<govuk-button>

The content is the HTML to use within the generated button.

Attribute Type Description
disabled bool Whether the button should be disabled. The default is false.
id string The id attribute for the button.
is-start-button bool Whether this button is the main call to action on your service's start page. The default is false.
prevent-double-click bool Whether to prevent accidental double clicks on submit buttons from submitting forms multiple times. The default is false but can be configured globally by setting the DefaultButtonPreventDoubleClick property on GovUkFrontendAspNetCoreOptions.
type string The type attribute for the generated button element.
(link attributes) If specified generates a formaction attribute using the specified values. See documentation on links for more information.

<govuk-button-link>

The content is the HTML to use within the generated link.

Attribute Type Description
disabled bool Whether the button should be disabled. The default is false.
id string The id attribute for the button.
is-start-button bool Whether this button is the main call to action on your service's start page. The default is false.
(link attributes) If specified generates an href attribute using the specified values. See documentation on links for more information.