Ga naar hoofdinhoud

CnObjectCard

Schema-driven card for displaying an object's key information. Uses schema configuration to determine which fields to show as title, description, image, and metadata.

Wraps: NcCheckboxRadioSwitch, CnCellRenderer

Try it​

Loading CnObjectCard playground…

CnObjectCard showing client data in card layout

Props​

PropTypeDefaultDescription
objectObject(required)Object data
schemaObject(required)Schema with properties and configuration
selectedBooleanfalseSelection state
selectableBooleanfalseShow selection checkbox
clickToViewBooleanfalseBody click on a selectable card emits click (navigation) instead of toggling selection — the checkbox stays the only selection surface (the card counterpart of a table's rowClickToView)
maxMetadataNumber4Max metadata fields shown

Schema Configuration Keys​

The schema's configuration object controls card layout:

KeyDescription
objectNameFieldField used as card title
objectDescriptionFieldField used as description text
objectImageFieldField containing image URL
objectSummaryFieldField used as summary

Events​

EventPayloadDescription
clickobjectCard clicked. When selectable is false this is the primary navigation event. When selectable is true a deliberate click emits select (a text-selection drag is not treated as a click); for backwards compatibility click is also emitted (with a console.warn deprecation notice) if a @click listener is present — migrate selectable consumers to @select.
selectobjectSelection toggled — emitted by the checkbox, and (when selectable) by a deliberate click anywhere on the card body.

Slots​

SlotScopeDescription
#badges\{ object \}Badge section
#actions\{ object \}Actions section
#metadata\{ object, fields \}Metadata section override

Usage​

<CnObjectCard
:object="contact"
:schema="contactSchema"
:selectable="true"
@click="onCardClick"
@select="onSelect" />

Reference (auto-generated)​

The tables below are generated from the SFC source via vue-docgen-cli. They reflect what's actually in CnObjectCard.vue and update automatically whenever the component changes.

Props​

NameTypeRequiredDefaultDescription
objectobject✓—The object data
schemaobject✓—Schema definition with properties and configuration
selectedbooleanfalseWhether this card is selected
selectablebooleanfalseWhether to show selection checkbox
clickToViewbooleanfalseWhen true, a body click on a SELECTABLE card emits click (navigation) instead of toggling selection — selection then happens via the checkbox only. The card counterpart of CnIndexPage's rowClickToView (a table row click already navigates in that mode).
maxMetadatanumber4Maximum number of metadata fields to show

Events​

NamePayloadDescription
select—Emitted when the card toggles selection (clicking the body of a selectable card, or its checkbox).
click—Emitted when a non-selectable card is clicked. Selectable cards emit select; they also emit click (deprecated) when a click listener is present, so migrate selectable consumers to @select.

Slots​

NameBindingsDescription
badgesobject
metadataobject, fields
actionsobject