Basic Usage
Attributes
The input name attribute. Used for form submission and error handling.
The label text displayed for the input. If empty, a label will be auto-generated from the name.
The model instance to bind to. The component will automatically fetch the value from the model using the name attribute.
The default value if no model value or old input exists.
Whether to display validation errors below the input.
Whether to display the label. Set to
false to hide the label.Mark the input as required. Adds HTML5 required attribute and displays a required indicator on the label.
Display the label and input inline (horizontal layout).
Enable Bootstrap floating label style.
Additional CSS classes for the inline label wrapper.
Additional CSS classes for the inline input wrapper.
Enable JavaScript-based error display for client-side validation.
Specify a custom framework theme. Defaults to the configured framework.
Examples
Basic Telephone Input
Required Field
With Model Binding
With Default Value
With Pattern Validation
Floating Label
Inline Layout
Without Label
International Format
With Input Mask
Multiple Phone Types
With Help Text
Contact Form
Value Resolution
The component resolves the input value in the following order:- Old input (from validation errors)
- Model value (if model is provided)
- Default value (if specified)
- Empty string
HTML5 Tel Input
The tel input type provides:- Optimized keyboard on mobile devices (numeric keypad with phone-specific keys)
- Better semantic meaning for screen readers
- Autocomplete support for phone numbers
- No built-in validation (unlike email or url types)
Pattern Validation
Use thepattern attribute for client-side validation:
Autocomplete Values
Use appropriate autocomplete values for better UX:tel- General phone numbertel-national- National phone numbertel-country-code- Country codetel-area-code- Area codetel-local- Local phone number
Validation Error Display
When validation fails, the input automatically:- Adds the
is-invalidBootstrap class - Displays error messages below the input (if
showErrorsistrue) - Preserves user input through Laravel’s old input
Implementation Details
The Tel component:- Extends the base Input component with type set to
tel - Does not include
placeholderandshowPlaceholderparameters (use standard attributes instead) - Supports all standard HTML input attributes via attribute merging
- Integrates with Laravel’s validation error bag
- Works seamlessly with Laravel’s old input helper
/src/Views/Components/Tel.php:12