Text
The <x-xf::text> component is a reusable Blade input component for rendering standard text input fields. It supports default values, size control, labels, custom classes, and additional attributes — making it ideal for names, titles, and any general text input.
📄 <x-xf::text>
📘 Description
The <x-xf::text> component is a versatile Blade component for rendering text input fields in Laravel forms. It supports label display, field sizing, default values, and allows additional HTML attributes for fine control.
This component is perfect for general-purpose text fields such as name, username, title, or any free-form textual input.
✅ Usage Example
<x-xf::text
name="first_name"
label="First Name"
size="md"
value="John"
:attr="['required' => true, 'maxlength' => 100]"
class="mb-4"
/>
🔑 Props
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name |
string | ✅ | — | Name attribute for the input field, used during submission and model binding. |
attr |
array | ❌ | [] | Additional HTML attributes like placeholder, required, etc. |
size |
string | ❌ | 'md' |
Input size: options are sm, md, and lg. |
label |
string|null | ❌ | null | Label text to display above the input field. |
value |
string|null | ❌ | null | Pre-filled value for the input field. |
class |
string|null | ❌ | null | Custom CSS class to apply for styling. |
🛡 Features
- ✅ Clean and customizable text input field
- ✅ Works with model binding and
old()values - ✅ Optional label and responsive size support
- ✅ Extendable via additional HTML attributes and CSS classes