24 lines
820 B
HTML
24 lines
820 B
HTML
{% from "components/icon.html" import Icon %}
|
|
{% from "components/tooltip.html" import Tooltip %}
|
|
|
|
{% macro TextInput(field, tooltip='', placeholder='') -%}
|
|
<div class='usa-input {% if field.errors %}usa-input--error{% endif %}'>
|
|
<label for={{field.name}}>
|
|
{{ field.label | striptags }} {% if tooltip %}{{ Tooltip(tooltip) }}{% endif %}
|
|
|
|
{% if field.description %}
|
|
<span class='usa-input__help'>{{ field.description | safe }}</span>
|
|
{% endif %}
|
|
|
|
{% if field.errors %} <span class="icon-validation">{{ Icon('alert') }}</span>{% endif %}
|
|
</label>
|
|
|
|
{{ field(placeholder=placeholder) | safe }}
|
|
|
|
{% if field.errors %}
|
|
{% for error in field.errors %}
|
|
<span class='usa-input__message'>{{ error }}</span>
|
|
{% endfor %}
|
|
{% endif %}
|
|
</div>
|
|
{%- endmacro %} |