Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for text param for Inset text #1113

Merged
merged 7 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

:new: **New features**

- Adds `text` param for Inset text ([PR 1113](https://github.com/nhsuk/nhsuk-frontend/pull/1113))

:wrench: **Fixes**

- Fix appearance of the select element for more consistency between browsers and OS ([Issue 527](https://github.com/nhsuk/nhsuk-service-manual-community-backlog/issues/527))
Expand Down
3 changes: 2 additions & 1 deletion packages/components/inset-text/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ The inset text Nunjucks macro takes the following arguments:

| Name | Type | Required | Description |
| -------------- | ------ | -------- | ------------------------------------------------------------------------------------------------- |
| **html** | string | Yes | HTML content to be used within the inset text component. |
| **html** | string | No | HTML content to be used within the inset text component. |
| **text** | string | No | Text content to be used within the inset text component. |
| **classes** | string | No | Optional additional classes to add to the inset text container. Separate each class with a space. |
| **attributes** | object | No | Any extra HTML attributes (for example data attributes) to add to the inset text container. |

Expand Down
6 changes: 5 additions & 1 deletion packages/components/inset-text/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@
{{- nhsukAttributes(params.attributes) }}>
<span class="nhsuk-u-visually-hidden">Information: </span>
{# params.HTML supported for backwards compatibility - see issue #950 #}
{{ (params.html or params.HTML) | safe }}
{% if params.html or params.HTML %}
{{ (params.html or params.HTML) | safe }}
{% else %}
<p>{{ params.text }}</p>
{% endif %}
</div>
Loading