Input

Base form input component used to render all input types with a consistent structure and behavior.

Basic Input

Creates a standard input field with a name and placeholder.

php
Options
The Input component supports various configuration options that can be passed to the attribute method (e.g. attribute('placeholder', 'Enter your username')).
  • autocomplete: HTML5 autocomplete attribute for form auto-filling
  • maxlength: Maximum allowed character length for the input
  • minlength: Minimum required character length for the input
  • pattern: Regular expression pattern for input validation
  • placeholder: Placeholder text displayed when the input is empty
  • value: Initial value of the input
  • icon: Optional icon element to be displayed with the input
  • iconPosition: Position of the icon ('left' or 'right')
Input Examples
Here are examples of different ways to use the text input component.

Input with Validation

Creates a an input with HTML5 validation attributes for email format.

php

Input with Icon

Creates an input with an icon positioned to the right.

php

Input with Label and Hint

Creates an input with a label and hint text for additional guidance.

Please provide your first and last name
php

Input with Required

Creates an input that is required for form submission.

php

Input with Disabled

Creates an input that is disabled and cannot be interacted with.

php

Input with Readonly

Creates an input that is readonly and cannot be edited.

php

Input with Custom Styling

Creates an input with custom CSS classes and styles.

php

Flatpickr Date Input

Creates a date picker input with custom date format and range constraints.

php

Flatpickr Multiple Dates

Creates a date picker that allows selecting multiple individual dates with a maximum selection limit.

php

Flatpickr Date Range

Creates a date picker for selecting a date range with start and end dates.

php

API

The alert component extends from HtmlElement so it has all its methods available. Using the methods from HtmlElement class you can add html attributes to the input, e.g. attribute('placeholder', 'Enter your username').
API PHP
API JS

Common alternative names: Text Field, Input Field, Text Box, Form Field, Input Box, Text Control

Types: Basic Text, Search Text, Password Text, Email Text, URL Text, Tel Text, Autocomplete Text, Rich Text


Principles

User Experience

Text inputs provide a simple and intuitive way for users to enter text data. They should be clearly labeled and appropriately sized for their expected content, with visual feedback for focus and validation states.

Validation

HTML5 validation attributes help ensure data quality and format conformance while providing immediate feedback to users. This reduces errors and improves data integrity.

Flexibility

Text components can be customized with various attributes, styles, and behaviors to suit different contexts and requirements while maintaining a consistent user experience.


Anatomy

Text Input Anatomy
  1. Container
  2. Outer wrapper div that holds all elements

  3. Label
  4. Optional text label describing the input's purpose

  5. Input Element
  6. The actual text input field

  7. Icon
  8. Optional icon element for visual enhancement or action

  9. Hint
  10. Optional helper text providing additional guidance

  11. Validation Feedback
  12. Visual indicators of validation status


Usage

Use text inputs for:

  • Single-line text entry
  • User information collection (names, emails, etc.)
  • Search functionality
  • Data filtering
  • Configuration settings
  • Form submissions
  • Command entry