{% macro govukButton(params) %}
{% from "govuk_frontend_jinja/macros/attributes.html" import govukAttributes %}
{#- Set classes for this component #}
{%- set classNames = "govuk-button" -%}
{%- if params.classes %}
{% set classNames = classNames ~ " " ~ params.classes %}
{% endif %}
{%- if params.isStartButton %}
{% set classNames = classNames ~ " govuk-button--start" %}
{% endif %}
{%- macro _startIcon() %}
{#- The SVG needs `focusable="false"` so that Internet Explorer does not
treat it as an interactive element - without this it will be
'focusable' when using the keyboard to navigate. #}
{%- endmacro -%}
{#- Define common attributes that we can use across all element types #}
{%- set commonAttributes %} class="{{ classNames }}" data-module="govuk-button" {{- govukAttributes(params.attributes) -}} {% if params.id %} id="{{ params.id }}"{% endif %}{% endset %}
{#- Actually create a button... or a link! #}
{%- if params.href %}
{{ params.html | safe | trim | indent(2) if params.html else params.text }}
{{- _startIcon() | safe if params.isStartButton }}
{%- else %}
{%- endif %}
{% endmacro %}