1. Reference
  2. Forms and input

<input>

A text field with a label, helper text, an icon and validation; type="code" draws one box per character.

Forms and input
input.ham
<column style="gap-16 w-full">
    <input name="email"
           label="Email"
           icon="mail"
           helper="We'll send the receipt here."
           value="maya@example.com"/>
    <input name="otp"
           type="code"
           length="6"
           inputmode="numeric"/>
</column>
The snippet drawn by Hype Apps on a phone, in light mode The snippet drawn by Hype Apps on a phone, in dark mode
This snippet as Hype Apps draws it on a phone. It follows this page's light or dark theme.

Attributes

NameWhat it doesDefault
autocapitalize On-screen keyboard auto-capitalization, same vocabulary as HTML.
off, none, on, sentences, words, characters
off
enterkeyhint The label of the keyboard's return key, as in HTML. Return fires submit: action-submit / @on.submit, with $event.value.
enter, done, go, next, previous, search, send
error Custom error message for validation failures
string
helper Helper text below input
string
icon Prefix icon name
string
inputmode
also input-mode
type="code": numeric takes digits only, with a number keyboard.
numeric
label Label (replaces placeholder as labelText when set)
string
length type="code": how many characters (1–12).
number
6
max Maximum value (number type)
number
max-length Maximum character length
number
min Minimum value (number type)
number
min-length Minimum character length
number
name Variable name for form scoping
string
pattern Regex validation pattern
string
placeholder Placeholder text
string
required Require a non-empty value. A failing rule stops the form's request: the field shows its message and takes focus.
boolean
false
style Style classes (bg-*, border-*, rounded-*, text-*, underlined, borderless, font-*)
string
type Input type. code: one box per character (length=), auto-advance, paste fills all, letters upper-cased; filling the last box fires complete (\$event.value).
text, password, email, number, hidden, code
text
value Initial value
string
variant outlined: a Material box with a floating label. underline: a hairline under the text. plain: no border and no floating label (the placeholder, or the label, is a hint), for a capsule you draw with style=.
outlined, underline, plain
outlined

Commands

NameWhat it does
blur Unfocus it (closes the keyboard).
clear Empty it and its name= variable.
focus Focus the field (opens the keyboard).

Readings

NameWhat it does
error The validation message for the text; empty when valid.
focused Whether the field has the keyboard focus.
length How many characters are in the field, live.
max_length The max-length= in force (a code input: its length=), in characters; empty when none.
valid Whether the text passes the field's rules (required, min-length, pattern …); true with no rules.
value The text in the field, live as it is typed.

Any tag also takes gestures: @on.tap, @on.longpress, @on.doubletap and @on.swipeleft (and right, up and down). @click runs on a tap too.

Guides and recipes that use it

This page is also Markdown, and all of HAM is in llms.txt.