The GOV.UK design system now has nunjucks macros - you can find out more on github.
You should look to move to this instead.
This includes a selection form macros from GOV.UK elements, these are using nunjucks and provide a component that can be configured, this encapsulates - text, data, error state, classes and values.
This is a mirror of govuk-elelemt-marko in nunjucks.
Old style radio and checkboxes can be found under retired these can be used with GOV.UK elements v2.1.2 or GOV.UK Frontend Toolkit pre 4.17.0.
Tests can be ran by running 'npm run test' this will run xo linter and the specs against each component.
Components with defined schemas.
Current components:
- gov-checkboxes
- gov-date-input
- gov-error-summary
- gov-input
- gov-radio
- gov-select
- gov-textarea
Things to add/improve
- common approach to data-attributes
gov-input has the following inputs
name
id
label
hint
value
error
maxlength
This will need to be exposed in the nunjuck render and can be called like this:
{% from 'gov-input/macro.njk' import govInput %}
{{ govInput(name='input', label='This is a label') }}
Notice something wrong? Or a feature that is missing?
Feel free to open an issue, or fork and do a pull request.