Skip to content

Allow the warning text component to be callable #7082

@NickColley

Description

@NickColley

What

Make the warning text component be callable

Why

We added support to allow our components to use caller() and allow larger chunks of HTML to be passed.
#2734

We chose not to do this for warning text because it's only typically used for short sentences.

Warning text: The main text of this component is presented inside of a element, negating the usefulness of using a caller, as it's unlikely to ever be more than one line of text.

However, on the Design System website we do use it beyond a single line:
https://github.com/alphagov/govuk-design-system/blob/d58a6028fdbbbb56665ab2010dca108bc14a1498/src/get-started/production/index.md?plain=1#L15-L22

And more importantly promoting the use of caller is better for security as it reduces the risk of XSS attacks

Who needs to work on this

Developers

Who needs to review this

Developers

Done when

Warning text component:

  • accepts caller()
  • is documented to allow for caller()
  • has tests for caller()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions