Input
An input field for forms.
Install
Run the following command to install the input component:
npx acc-nuxt add InputExamples
Default
With info
This is an info message
Custom error
This is an error message
Loading
Password
Numeric
Numeric String
The value will be a string but only numbers, minus and dot are allowed.
File
Disabled
Left Icon
Right Icon
Custom Password Icon
Use the iconRight slot with showOrHidePassword and showPassword props to customize the password visibility toggle.
Custom styling
Use the class prop to add custom class to the input wrapper. Then select the class inside the .lev-input-wrapper to change the value of the CSS variables
Display formatter
Use the displayFormatter prop to format the underlying value for display. The input becomes read-only while keeping the raw value (e.g. an ISO date string) as the model.
Form
The input component can be used in a form
Form Text
Form default values
Form Email
Form Custom Regex
Form Number
Form Number String
The value will be a string but only numbers, minus and dot are allowed.
Form disappearing
If the input unmounts, the value will be lost. But we can use keepValueOnUnmount prop to keep the value.
Form Input with label
Form Display formatter
The displayFormatter prop works inside a form too. The raw value (e.g. an ISO date string) is what vee-validate stores, while the input shows the formatted date.
Slots
The input component provides the following slots for customization.
Props
The input component accepts the following props to customize its behavior.
CSS Variables
The input component can be customized using the following CSS variables.