Skip to main content

CnInfoWidget

Renders label-value pairs in a responsive CSS grid. Supports two modes: manual (provide a fields array) or auto-generated from a JSON Schema object + data pair. Used in dashboard and detail page layouts to display entity metadata.

Usage

<!-- Manual fields -->
<CnInfoWidget
:fields="[
{ label: 'Email', value: 'info@example.com' },
{ label: 'Phone', value: '+31 6 12345678' },
{ label: 'Status', value: 'Active' },
]"
:columns="2" />

<!-- Auto-generated from JSON Schema -->
<CnInfoWidget
:object="contact"
:schema="contactSchema"
:columns="3"
:include-fields="['name', 'email', 'status']"
:exclude-fields="['password']" />

Props

PropTypeDefaultDescription
fieldsArraynullManual field definitions: [{ label, value }]. Takes precedence over object + schema
objectObjectnullData object for auto-generation mode
schemaObjectnullJSON Schema for auto-generation mode — property titles become labels
columnsNumber2Number of columns in the grid layout
includeFieldsArraynullAllowlist of property keys to include (auto-generation mode only)
excludeFieldsArray[]Blocklist of property keys to exclude (auto-generation mode only)

Value formatting

In auto-generation mode, values are formatted automatically:

TypeOutput
null / undefined (em-dash)
ArrayComma-separated string
ObjectJSON.stringify(value)
Boolean'Yes' / 'No'
OtherString(value)