nf-form-item
A companion form item preserving native validation, label/error slots and collapse registration.
Import the components below; see the package README for standalone installation.
Examples
Basic usage
Loading example…
Basic usage
More examples 2
Loading example…
More examples 2
Props
Text props follow the library language when omitted; defaults below use this language.
| Parameter | Description | Type | Options | Default |
|---|---|---|---|---|
hidden | Exclude the item from collapsing when true; the item remains visible. | boolean | — | false |
prop | Field in the form model; required for validation and reset, supports path arrays. | string | string[] | — | undefined |
label | Label text. | string | — | undefined |
labelWidth | Label width, e.g. 50px; supports auto and inherits the form setting when omitted. | string | number | — | undefined |
labelPosition | Label position; inherits the form setting when omitted. | string | left / right / top | '' |
required | Whether required; determined by validation rules when omitted. | boolean | — | undefined |
rules | Validation rules using the Element Plus / async-validator format. | FormItemRule | FormItemRule[] | — | undefined |
error | Field error message; setting it immediately enters the error state and displays it. | string | — | undefined |
showMessage | Whether to show validation error messages. | boolean | — | true |
inlineMessage | Display validation messages inline. | boolean | — | undefined |
size | Control size; mini maps to small and medium to default. | string | mini / small / medium / default / large | undefined |
validateStatus | Field validation state. | string | error / validating / success | undefined |
for | Native label for attribute, referencing an input ID. | string | — | undefined |
Events
No component events. Listen to validate on the parent NfForm for validation results.
Slots
| Parameter | Description | Payload |
|---|---|---|
default | Form Item content: field controls or action buttons. | — |
label | Custom label content. | { label: string } |
error | Custom rendering of validation messages. | { error: string } |
Methods
| Name | Type | Description |
|---|---|---|
validate(trigger, callback?) / resetField() / clearValidate() | native | Element Plus field methods. |
Migration notes
Use with NfForm. hidden excludes the item from collapse; it does not hide it. Use Vue 3 v-model and Element Plus rules rather than private Element UI instance properties.
