Input

Text field that allows users to enter and edit values.

Source Tailwind CSS

Your API key is encrypted and stored securely.

Installation

templui add input

Load the script once in your layout:

<head> @input.Script() </head>

Examples

Basic

Field

Choose a unique username for your account.

Disabled

This field is currently disabled.

Invalid

This field contains validation errors.

File

Select a picture to upload.

Inline

Grid

Required

This field must be filled out.

Badge

API Reference

Required parameter
Hover for description

Input

Text field that allows users to enter and edit values.

Name Type Default
ID

Unique identifier for the input element.

string
-
Class

Additional CSS classes to apply to the input.

string
-
Attributes

Additional HTML attributes to apply to the input element.

templ.Attributes
-
Name

Name attribute for the form input.

string
-
Type

Input type. Options: 'text', 'password', 'email', 'number', 'tel', 'url', 'search', 'date', 'time', 'file'.

Type
text
Placeholder

Placeholder text to display when input is empty.

string
-
Value

Current value of the input field.

string
-
Disabled

Whether the input is disabled and non-interactive.

bool
false
Readonly

Whether the input is read-only.

bool
false
FileAccept

Accepted file types for file inputs (e.g., '.jpg,.png').

string
-
HasError

Whether the input has a validation error.

bool
false