Skip to content
On this page

NProForm

Advanced form is used to quickly build form views. Using pro-form requires the use of defineForm functions.

Advanced forms are based on the principles of functional programming and abstract the form data into a JavaScript object. By manipulating and encapsulating this object, the form data becomes more reusable and maintainable.

Props

NameTypeDefaultDescription
instanceProFormInstance-The instance of the component
gridbooleantrueEnables grid layout
colsnumber | ResponsiveDescription24The number of grid columns to display
x-gapnumber | ResponsiveDescription0The horizontal gap between slots
y-gapnumber | ResponsiveDescription0The vertical gap between slots

For more parameters, please refer to the attributes of n-form and n-grid.

Form Methods

NameTypeDescription
validate(paths?: string[]) => Promise<void>Validates the form items, passing paths

filters the parameters to be validated | | resetValidate | (paths?: string[]) => void | Resets the validation, passing paths filters the parameters to be reset | | resetFields | (paths?: string[]) => void | Resets the form data to its initial values, passing paths filters the parameters to be reset |

Field Methods

NameTypeDescription
withConfig(config) => WithConfigFieldCarries and returns a new configuration
preventDefault() => WithConfigFieldSets the label and rules to empty
preventRequired() => WithConfigFieldRemoves the required rule from the rules
preventAutofill() => WithConfigFieldPrevents browser autofill
clone() => WithConfigFieldShallow clones the field
cloneDeep() => WithConfigFieldDeep clones the field

Field Types

NameDescription
date-pickerDate picker
auto-completeAuto-complete
cascaderCascading selector
inputInput field
input-numberNumber input field
rateRating
time-pickerTime picker
mentionMention
selectSelector
switchSwitch
sliderSlider
radioRadio button
checkboxCheckbox
textareaTextarea

Slots

NameTypeDescription
toolbars()Content of the toolbar. This slot is automatically enabled when using the toolbar mode.

Released under the MIT License.