Skip to content

DynamicForm Parameter Reference

NaiDynamicForm Props

PropDescriptionTypeDefaultRequired
formConfigNaive UI NForm configuration (e.g., labelPlacement / size / labelWidth, etc.)FormProps{ labelPlacement: 'left', size: 'medium' }No
gridConfigNGrid configuration used when preset="grid" (e.g., cols / xGap / responsive, etc.)GridProps{ responsive: 'screen', cols: 'xs:1 s:2 m:3 l:3 xl:4 2xl:4', xGap: 10 }No
rulesExtra form validation rules (merged with the built-in rules from items)FormRulesNo
presetLayout mode: fullRow = normal vertical form; grid = grid layout (with gridConfig)'fullRow' | 'grid''fullRow'No
itemsDynamic form item config array (each item is a DyFormItem)DyFormItem[]Yes

EleDynamicForm Props

PropDescriptionTypeDefaultRequired
formConfigElement Plus ElForm configuration (e.g., labelPosition / size / labelWidth, etc.)FormProps{ labelPosition: 'left', size: 'default' }No
rowConfigRowProps configuration used when preset="grid" (e.g., justify / align / gutter, etc.)RowProps{ gutter: 10, justify: 'start', align: 'top' }No
rulesExtra form validation rules (merged with the built-in rules from items)FormRulesNo
presetLayout mode: fullRow = normal vertical form; grid = grid layout (with gridConfig)'fullRow' | 'grid''fullRow'No
itemsDynamic form item config array (each item is a DyFormItem)DyFormItem[]Yes

preset validate

preset only allows fullRow or grid. Otherwise, an error message will be printed in the console and it will return false.

Expose

MethodParametersReturnDescription
reset(v?: any)v = null → reset the form datavoidReset form data
validator-Promise<object>Validate the form and return the result
getResult(t = 'res')t = 'res' → get the final result
t = 'ori' → get the original render array
object / arrayGet the internal form data structure

Slots

SlotParametersDescription
header-Named slot for the header/title
footer-Named slot for the footer/bottom area