--- layout: layouts/page.njk title: Input description: Displays a form input field or a component that looks like an input field. toc: - label: Usage id: usage - label: Examples id: examples children: - label: Default id: example-default - label: Invalid id: example-invalid - label: Disabled id: example-disabled - label: With label id: example-with-label - label: With text id: example-with-text - label: With button id: example-with-button - label: Form id: example-form --- {% from "macros/code_preview.njk" import code_preview %} {% from "macros/code_block.njk" import code_block %} {% set code %}{% endset %} {{ code_preview("input", code) }}

Usage

Simply add the input class to your <input> element or have a parent with the form class (read more about form). You can also set the aria-invalid attribute to true to make the input invalid.

{{ code_block(code) }}

Examples

{{ code_preview("input-default", code) }}

Invalid

{% set code %}{% endset %} {{ code_preview("input-invalid", code) }}

Disabled

{% set code %}{% endset %} {{ code_preview("input-disabled", code) }}

With label

{% set code %}
{% endset %} {{ code_preview("input-with-label", code) }}

With text

{% set code %}

Fill in your email address.

{% endset %} {{ code_preview("input-with-text", code) }}

With button

{% set code %}
{% endset %} {{ code_preview("textarea-form", code) }}

Form

{% set code %}

This is your public display name.

{% endset %} {{ code_preview("input-form", code, "w-full max-w-sm") }}