FormCard configuration
resources/js/Components/Mod/FormCard.vue is the existing Mod dashboard card renderer. It accepts a card object and a compatible dataStore, normally supplied by ShowPage/FormPanel. It is separate from v2 display-card types; see component patterns before migrating a layout.
Use page authoring for the surrounding tab, value and save workflow. Rendering a card does not register a route, create a resource or authorize an action.
Component context
| Prop | Current behavior |
|---|---|
card | Object selecting content and presentation; default empty object |
dataStore | Store used through storeToRefs for dataModel and through getModelValue for list lookup; default empty object is not a functional store |
flush | Layout behavior, default false |
dragHandleClass | Optional class for a rendered drag handle; it does not itself implement persistence of reordering |
The card emits updateValue and customEvent from selected child paths. Do not assume a generic custom component or every card type forwards all child events. Inspect the exact template branch and parent listener.
Supported card branches
Underscore/hyphen aliases are accepted for the paired names below. An omitted type selects the fields-list branch; an arbitrary unknown type is not a validated substitute for it.
| Type | Inputs/consumer and boundary |
|---|---|
fields_list / fields-list | fieldsList, title and card passed to FieldsList; missing fields use an empty array |
data_table / data-table | tableTitle, headers, options, list binding and createConfig passed to DataTable; use its actual header/request schema |
render_list / render-list | Resolves listKey and passes the resulting list as FieldsList definitions; not a generic per-row data template |
form_builder / form-builder | Passes card/store to the Mod FormBuilder wrapper |
tabs_list / tabs-list | Passes card/store/model to TabsList, including supported dynamic snippet additions |
info_card / info-card | Passes card, card-item model, store and options to InfoCard |
card_list / card-list | Uses FormPanel with this card as its tab definition and wrapperClassList for that nested panel |
inspector_layout / inspector-layout | Uses InspectorLayout with main cards, selection/panel configuration and shared page store |
carousel | Passes label and itemList to CarouselSpinner |
grid_view / grid-view | Passes tileList, gridData, card and store to GridView |
component | Renders card.component with card.props, card-item and data-store; no universal child update/custom-event listener is attached in this branch |
data_display / data-display | Passes fieldsList/title/store to FormDataDisplay |
button_group / button-group | Passes buttons/grouped/classes/current item/store to FormButtonGroup and forwards its custom event |
snippet | Resolves a named config fragment and recursively renders the resolved card; see below |
A component value must resolve through the actual Vue application/import context. Naming a component in JSON does not install or dynamically import arbitrary source code.
Layout and decoration
| Card property | Current interpretation |
|---|---|
cols, colsSm, colsMd, colsLg, colsXl | Bootstrap column classes, default/fallback starting at 12 and cascading through prior sizes; truthy fallback means zero is not a zero-width setting |
cardWrapperClassList | Outer wrapper classes; array is joined into a string, or a string can be supplied |
marginBottom | Adds mb-<value> only when truthy; there is no universal default margin of 4, and zero adds no margin class |
showCard | Applies card/body decoration and border; does not determine whether the card passes its visibility condition |
border | Adds border decoration independently of showCard |
classList, bodyClassList | Inner wrapper/body classes; use the expected array shape where spread by the template rather than assuming string/array equivalence everywhere |
spacerX, spacerY | Truthy values become MDB card-spacer CSS variables; provide suitable CSS values |
collapse | Local toggle using heading, label, showingByDefault (default true) and optional smooth presentation; not a saved state or authorization control |
footerButton | Renders a Link using its route value as href, text and optional icon/classes; supply a resolved URL rather than assuming it invokes a named-route helper |
A common title is not automatically printed by the commented-out generic heading. Specific branches receive title and render it according to their own component. Test the intended card type rather than expecting identical headings/decorations across the table, fields, component and info branches.
Visibility and access boundaries
The renderer checks feature/permission presentation and card conditions. Its condition helper receives the card and current data model when condition or nonempty conditionParams is present; otherwise the ordinary condition result is true.
There is a special outer fallback for the exact underscore type render_list: a truthy direct dataModel[card.listKey] with nonzero length can allow rendering even when the ordinary condition result is false. That fallback uses a direct key, whereas the actual list lookup has its own nested-path handling. This fallback bypasses the ordinary condition result only; the outer feature/permission presentation check still applies to the combined condition/list result. Do not rely on the condition to suppress a populated render list, or assume underscore/hyphen aliases have identical behavior in every outer gate.
The shared UI feature/permission checker also returns visible for super admins, missing restriction configuration and caught evaluation errors. Those are presentation choices. They are not a secure backend filter, and hidden/visible state is not evidence of allowed resource operations. Test the endpoint with permitted and denied principals independently.
List binding and DataTable input
listKey resolves through dataStore.getModelValue for the first dot-separated segment, then traverses subsequent properties. A later segment matching property[index] can index an array. Do not infer support for every JavaScript expression or every bracket syntax from this narrow parser.
For DataTable, a truthy explicit card.listData is passed as list data. Otherwise the nonpaginated branch uses the resolved list, while options.paginated directs the resolved value into paginatedItems. A card setting does not construct a paginator response or fetch backend records. Verify the actual list/paginator shape against DataTable and its schema.
The earlier example used string-only headers and an undefined data source while claiming pagination. Prefer a small fields card to verify composition before adding the table's separate contract:
{
"cardId": "details",
"type": "fields_list",
"cols": 12,
"showCard": true,
"fieldsList": [
{
"name": "heading",
"type": "text",
"label": "Heading",
"column": "custom_settings"
}
]
}
Place this card in a configured tab with the intended store. The value path is custom_settings.heading; persistence still needs the owning page's authorized save configuration. See the field schema.
Snippet cards and dynamic tabs
A v1 snippet placement has type: 'snippet' and a key, with optional overrides. The page's config-snippet store resolves the fragment; a resolved card is rendered recursively, preserving selected update/custom events. Missing resolution produces no normal card body in that snippet branch. Preserve store/version context and validate the fragment rather than treating a key as code loading or permission to access a resource.
For tabs-list cards, snippetRenderKey can address an array in the model. Nonempty string entries become additional snippet placements after static tabsList entries. This path filters to strings but does not promise deduplication, trimming or authorization of the referenced definitions. Verify resulting tabs and conditions in the intended page.
Inspector layout boundary
InspectorLayout renders main cards against the page store and a selected entity's panel against a sub-store. selectionKey defaults to inspector_selection; panel lookup uses the selection's kind, and panel configuration resolves the entity/cards. Its selected-panel autosave and action handling are a separate implementation from ShowPage's own save.
Configure a supported selection/entity resolver, panel fields and update route deliberately. Separate requests can have separate failures; a visible inspector or local field change does not prove an entity was persisted. The existing InspectorLayout tests stub FormCard to test pane/store/autosave/event behavior, so they do not establish real field rendering or backend route authorization.
Event forwarding and verification
Fields-list, render-list, form-builder and tabs-list paths forward their configured update events. Button-group, nested FormPanel, inspector and recursive snippet paths have their own custom-event forwarding. The renderer does not attach a universal event listener to all branches; store mutation and child emits are different integration paths.
For a new card or change:
- Confirm the renderer/type spelling, actual child props and compatible store.
- Verify default/empty/populated data and list/paginator shape.
- Check layout/conditions with ordinary and super-admin UI contexts without treating either as endpoint proof.
- Trace a field update or custom event to its owning store/page handler.
- Save through the intended endpoint, exercise validation/denial and reload to confirm the correct resource changed.
- For snippets, dynamic tabs or inspectors, test missing definitions/selections and partial request failure.
Current source entry points are FormCard, FieldsList, FormPanel, TabsList, FormButtonGroup, InspectorLayout, the config-snippet store and condition/visibility helpers. Per-child details retain their own references and acceptance scope. Detailed operator recovery remains separate from this public component guide.