Button helpers
In addition to the components, this gem also comes with button helpers that are frequently duplicated and reimplemented across projects.
Regular button
The govuk_button_to
helper wraps Rails’
button_to
directly, rendering a form that will POST
by default.
Link styled like a button
When using buttons for navigation, we usually want a link styled like a button instead.
Inverse buttons
Inverse buttons can be used to make buttons stand out on coloured backgrounds. They are frequently used on landing pages.
Other button styles
Disabled buttons
Disabled buttons are created using disabled: true
. They have poor
contrast and can confuse some users, so avoid them if possible.
Secondary buttons
Secondary buttons are created with secondary: true
. Pages usually have
one primary call to action so secondary buttons are used for other
operations.
Warning buttons
Warning buttons are created with warning: true
. They’re designed to make
users think carefully before they use them. They only work if used very
sparingly. Most services should not need one.