<div class="n7-input-field gap-1 has-error">
<label for="" class="n7-input-field__label">
Text label
</label>
<div class="n7-input has-error">
<input id="" class="text-sm n7-input-placeholder pr-12" type="text" aria-describedBy="undefinedError" aria-invalid="true">
<svg class="n7-icon inline-block align-middle fill-current w-6 h-6 absolute right-4 n7-content-placeholder n7-content-error" aria-hidden="true" focusable="false" role="img">
<use href="../../icons.svg#outline--exclamation-circle" />
</svg>
</div>
<span class="n7-input-field__hint">
<span class="n7-input-field__error" id="Error" aria-live="assertive">
il campo *nome campo* non può essere vuoto
</span>
</span>
</div>
<div class="n7-input-field{% if gap %} {{ gap }}{% else %} gap-1{% endif %}{% if classes %} {{ classes }}{% endif %} {% if input.hasError %} has-error{% endif %}">
<label for="{{ input.id }}" class="n7-input-field__label{% if hiddenLabel %} n7-sr-only{% endif %}{% if labelClasses %} {{ labelClasses }}{% endif %}">
{{ label }}
{% if input.fieldRequired %}
<abbr class="n7-font-bold n7-no-underline" title="obbligatorio">*</abbr>
{% endif %}
</label>
{% block input %}
{% render '@input', input, true %}
{% endblock %}
{% if input.fieldRequired or input.ariaDescribedBy or input.hasErrorControl %}
<span class="n7-input-field__hint">
{% if input.fieldRequired or input.hasErrorControl %}
<span class="n7-input-field__error" id="{{ input.id }}Error" aria-live="assertive">
{{ errorDescription }}
</span>
{% endif %}
{% if inputDescription %}
<span class="n7-input-field__description" id="{{ input.ariaDescribedBy }}">
{{ inputDescription }}
</span>
{% endif %}
</span>
{% endif %}
</div>
{
"label": "Text label",
"inputId": "inputId",
"input": {
"type": "text",
"hasErrorControl": true,
"ariaInvalid": true,
"iconAlert": true,
"hasError": true
},
"errorDescription": "il campo *nome campo* non può essere vuoto"
}
/**
* INPUT FIELD
*
*/
@layer components {
.n7-input-field {
@apply grid content-start;
}
.n7-input-field__label {
@apply block text-sm font-bold n7-content-03;
}
legend:where(.n7-input-field__label) {
@apply mb-1;
}
.n7-input-field__error {
@apply n7-body-sm font-medium n7-content-error;
}
.n7-input-field__description {
@apply n7-body-sm font-medium n7-content-03;
}
.n7-input-field.has-error input {
@apply border-2 n7-border-error-dark;
}
/* INPUT FIELD INLINE */
.n7-field-inline {
@apply flex items-center gap-2;
}
.n7-field-inline .n7-input,
.n7-field-inline .n7-select {
@apply flex-1;
}
}
Composite input field component. Include input component, customized if needed with parameteres:
Blocks: