Skip to content

Text input, Date input and text area components should support readonly in a similar way to disabled #275

@sussexrick

Description

@sussexrick

Currently the only way to specify the readonly attribute for 'Text input' is to add input-readonly="readonly". On 'Textarea' it's textarea-readonly="readonly". On 'Date input' you can add the tag helpers for the individual fields and add readonly="readonly".

In Razor there isn't a way to choose whether to render input-readonly or textarea-readonly dynamically - you have to have two versions of the <govuk-input /> or <govuk-textarea /> tag with and without the attribute, and repeat any logic required to build up child tags.

The implementation of the disabled attribute is better - you can specify a boolean value and have the attribute render or not render. It would be useful if there was a similar readonly=bool attribute across these components. The readonly attribute does not apply to other components.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions