Skip to content

Commit

Permalink
Use paragraphs for error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhorsford committed Sep 24, 2024
1 parent 5180b17 commit 5f4f6d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/components/error-message/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ Find out more about the error message component and when to use it in the [NHS d
### HTML markup

```html
<span class="nhsuk-error-message">
<p class="nhsuk-error-message">
<span class="nhsuk-u-visually-hidden">Error:</span>
Error message about full name goes here
</span>
</p>
```

### Nunjucks macro
Expand Down
1 change: 1 addition & 0 deletions packages/components/error-message/_error-message.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
clear: both;
color: $nhsuk-error-color;
display: block;
margin-top: 0; // Reset any default browser margins for paragraphs
margin-bottom: nhsuk-spacing(3);
}
4 changes: 2 additions & 2 deletions packages/components/error-message/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

{% set visuallyHiddenText = params.visuallyHiddenText | default("Error") -%}

<span class="nhsuk-error-message
<p class="nhsuk-error-message
{%- if params.classes %} {{ params.classes }}{% endif %}"
{%- if params.id %} id="{{ params.id }}"{% endif %}
{{- nhsukAttributes(params.attributes) }}>
{% if visuallyHiddenText %}<span class="nhsuk-u-visually-hidden">{{ visuallyHiddenText }}:</span> {% endif -%}
{{ params.html | safe if params.html else params.text }}
</span>
</p>

0 comments on commit 5f4f6d6

Please sign in to comment.