Browse documentation

Text inputs

Collect free-form text with single-line, multiline, search, password, numeric, and tag controls.

Import

Load the optional component layer before using the examples below.

Ruby
require "zaniah/ui"

Basic fields

Use a visible label for form fields. TextField supports a placeholder, error, counter, prefix, suffix, and clear action.

Rendered example
Labeled text, multiline, search, password, number, and tag inputs.
Rendered by Zaniah's headless backend.
Ruby
Zaniah::UI::TextField.new("Ruby", label: "Name", clearable: true)
Zaniah::UI::TextArea.new("Several lines", label: "Notes", rows: 3)
Zaniah::UI::SearchInput.new("", placeholder: "Search")

Specialized fields

PasswordInput masks its value. NumberInput enforces optional bounds and increments. TagInput reports a list of tags.

Ruby
Zaniah::UI::PasswordInput.new("", label: "Password")
Zaniah::UI::NumberInput.new(4, min: 0, max: 10)
Zaniah::UI::TagInput.new(%w[ruby ui], placeholder: "Tags")

API summary

Constructor options and behaviors are drawn from the component reference.

ComponentConstructor and methodsVariants or behavior
TextField(value, placeholder:, label:, prefix:, suffix:, error:, max_length:, clearable:)IME, selection, counter
TextAreaTextField plus rows:multiline/wrapped
SearchInputTextField optionssearch + clear icons
PasswordInputTextField optionsmasked display
NumberInputTextField plus min:, max:, step:; increment, decrementnumeric
TagInput(tags, separator:, ...); on_tags_changebadge list + editor

Accessibility

Labels and errors are associated with their fields. Multiline input exposes a multiline textbox; search exposes a searchbox.

ComponentSemantic role
TextFieldtextbox
TextAreatextbox/multiline
SearchInputsearchbox
PasswordInputtextbox
NumberInputtextbox
TagInputtextbox