The <x-xf::email> component is a custom Laravel Blade component for rendering an email input field. It provides a clean, reusable way to include email fields in your forms with support for labels, default values, sizes, and additional HTML attributes.
It works seamlessly with Laravel’s old() helper and supports custom styling and layout, making it ideal for consistent, maintainable form design.
📄 <x-xf::email>
📘 Description
The <x-xf::email> component is a reusable Laravel Blade component for rendering HTML email input fields. It simplifies form creation by providing a consistent structure, optional label support, default value binding, and easy customization via attributes and sizing.
It integrates well with Laravel's old() helper and supports validation error display, making it ideal for both simple and complex forms.
✅ Usage Example
<x-xf::email
name="user_email"
label="Email Address"
:attr="['placeholder' => 'Enter your email']"
size="lg"
value="example@example.com"
class="mb-4"
/>
🔑 Props
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
name |
string | ✅ | — | The name attribute of the input. Required for form submission and validation. |
attr |
array | ❌ | [] | Additional HTML attributes (e.g., placeholder, id, readonly). |
size |
string | ❌ | 'md' |
Input size: supports sm, md, or lg for styling purposes. |
label |
string | ❌ | null | Optional label displayed above the input field. |
value |
string|null | ❌ | null | Default value for the input field. Falls back to old(name) if not set. |
class |
string|null | ❌ | null | Custom CSS class for additional styling or layout adjustments. |
🛡 Features
- ✅ Supports value retention with
old() - ✅ Optional label for accessibility and clarity
- ✅ Responsive size variants (
sm,md,lg) - ✅ Fully customizable using extra attributes and classes
- ✅ Works seamlessly within
<x-xf::form>wrappers