TextBox

Single-line text input with validation, character counting, presets for email and password fields, and JS event hooks.

Basic Inputs

Character Count

0/20
Type to see output...
PHP

PHP PHP Methods (Fluent)

Method / PropertyParametersDescription
$m->textbox($id)stringCreate a text input component.
->value($value)?stringSet the initial value.
->placeholder($text)stringSet placeholder text.
->name($name)stringForm field name.
->required($req)boolMark as required (default: true).
->minLength($len)intMinimum character length.
->maxLength($len)intMaximum character length.
->disabled($dis)boolDisable the input.
->type($type)stringHTML input type (text, email, password, etc.).
->email()Preset for email: sets type, autocomplete, inputmode.
->password($autocomplete)stringPreset for password field. Default: "current-password".
->autocomplete($value)stringSet the autocomplete attribute.
->pattern($pattern)stringRegex validation pattern.
->characterCount($max)intShow a live X/max character counter.

JS JS Methods

Method / PropertyParametersDescription
m.textbox(id, options)string, ?objectInitialise or get a textbox instance.
getValue()Get the current input value.
setValue(value)stringSet the value and fire a change event.
clear()Clear the input value.
focus()Focus the input element.
enable()Remove the disabled state.
disable()Add the disabled state.
validate()Run HTML5 checkValidity().
setError(message)stringShow an error message below the input.
clearError()Clear any error state.

JS JS Options

Method / PropertyParametersDescription
onChangefunction|stringCallback fired on the change event. Receives {value}.
onInputfunction|stringCallback fired on every input event. Receives {value}.
onFocusfunction|stringCallback fired on focus.
onBlurfunction|stringCallback fired on blur.
validateOnBlurbooleanAuto-validate on blur (default: true).