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. Note: Password fields never display values for security reasons.
The default value. Note: Password fields never display values for security reasons.
Whether to display validation errors below the input.
Whether to display the label. Set to
false to hide the label.Custom placeholder text for the input.
Automatically use the label as placeholder text when
true.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 Password Input
Required Password Field
Password Confirmation
With Placeholder
Floating Label
Inline Layout
Without Label
With Additional Attributes
With Help Text
Complete Registration Form
Change Password Form
Security Considerations
The Password component includes important security features:- Never displays values: Unlike other input components, password fields never pre-fill with values from models or defaults
- No old input: Password values are not preserved after validation errors
- Autocomplete support: Use
autocomplete="current-password"orautocomplete="new-password"attributes - Server-side validation: Always validate passwords on the server, not just client-side
Validation Error Display
When validation fails, the input automatically:- Adds the
is-invalidBootstrap class - Displays error messages below the input (if
showErrorsistrue) - Does NOT preserve the entered password value
Implementation Details
The Password component:- Extends the base Input component with type set to
password - Explicitly skips value assignment in the parent constructor for security
- Supports all standard HTML input attributes via attribute merging
- Integrates with Laravel’s validation error bag
/src/Views/Components/Password.php:12