Form Group

Dynamic form groups built from STabs and SForm.

Form Group

SFormGroup wraps every array item in a tab and an independent SForm. Its tabs use the connected-card appearance by default; set tabs-type to use another STabs style without changing add or remove behavior. Above render-threshold, forms mount on first tab activation; unmounted items still participate in validateAll and validateFields through the headless rule engine. Context-menu actions can update the bound array directly; the group then prunes removed tabs, form instances, and validation state. The instance also exposes clearValidate, resetFields, and getErrors.

For validation outside the component, use the exported createFormValidator(model, { rules, items }). Its validate and validateField methods do not require a Vue component or DOM.

Basic usage

Drag the form tabs, or focus a tab and press Alt+Shift+Arrow, to change the bound array order. Existing field values, active form and validation identities are preserved. Set sortable to false to disable sorting.

Large-data validation

This example starts with 25 items. Every value is valid by default except item 20. Only the active form mounts initially, but Validate all still checks every item and activates the first invalid tab. Add items or right-click a tab to compare its current zero-based array index with its stable __index.

API

PROPS

Property
Type
Values
Description
default
Example
More
v-model
[]
Form data array
Each item owns one tab and one SForm; missing __index values are assigned automatically.
[]
—
get-form-setting
(data, index) =>
Function
Returns the inner SForm configuration for an item.
—
—
tab-label
String
Text
Default tab label prefix.
Item
—
get-tab-label
(data, index) => string
Function
Returns the complete label for an item.
—
—
get-context-menu-items
({ item, index, key, list }) => []
Function
Returns right-click menu items for a tab. index is the current array position; key is the stable __index.
—
—
sortable
Boolean
—
Enable tab sorting by default. Reorders the v-model array from Tabs sort events without passing order. Stable __index identities stay unchanged while array indexes follow the new order.
true
tabs-type
String
line / pill / card / connected-card / editable-card
Visual style passed to the inner STabs. Add and remove controls remain independent from this setting.
connected-card
—
editable
Boolean
true
Control the remove and add controls respectively.
false
—
show-add
Boolean
false
Control the remove and add controls respectively.
false
—
create-item
({ list }) => object | Promise<object>
Function
Creates a new form item synchronously or asynchronously.
—
—
max
Number
Positive number
Maximum number of form items.
Infinity
—
lazy-error-mark
Boolean
true / false
Mark invalid tabs without moving to the first invalid tab.
false
—
render-threshold
Number
Non-negative integer
Enables lazy tab content above this item count; force-render disables the optimization.
5
—

EVENTS

Event
Type
Description
default
Example
More
sort
(items: []) => void
Emits the final data array after updating the model order.
—
—
add
(item
Fires after a form item is added or removed.
—
—
remove
index)
Fires after a form item is added or removed.
—
—
change
(activeKey, index, item)
Fires when the active tab changes.
—
—
tab-contextmenu
(context, mouseEvent)
Fires when a tab is right-clicked. context contains item, index, key, and list.
—
—
context-menu-select
(menuItem, context)
Fires after selecting a built-in tab context-menu item.
—
—
validate
(index, valid)
Fires when one form finishes validation.
—
—
Last Updated: 2026-10-28, 06:17:56 UTC
Copied