Ga naar hoofdinhoud

CnCardGrid

Responsive CSS grid layout for CnObjectCard instances. Auto-fills with minmax(320px, 1fr).

Wraps: NcLoadingIcon, NcEmptyContent, CnObjectCard

Try it​

Loading CnCardGrid playground…

CnCardGrid showing a grid of object cards

Props​

PropTypeDefaultDescription
objectsArray[]Object data array
schemaObjectnullPassed to each CnObjectCard (required only when using the default card template; not needed when providing a custom #card slot)
loadingBooleanfalseLoading state
selectableBooleanfalseEnable card selection
clickToViewBooleanfalseBody click on a selectable card emits click (navigation); selection happens via the checkbox only (CnIndexPage wires this from its rowClickToView)
selectedIdsArray[]Currently selected IDs
rowKeyString'id'Unique identifier field
emptyTextString'No items found'

Events​

EventPayloadDescription
clickobjectCard clicked
selectids[]Selection changed

Slots​

SlotScopeDescription
#card\{ object, selected, schema \}Custom card template
#card-actions\{ object \}Card action buttons
#card-badges\{ object \}Card badges
#empty—Custom empty state

Usage​

<CnCardGrid
:objects="contacts"
:schema="schema"
:selectable="true"
:selected-ids="selected"
@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 CnCardGrid.vue and update automatically whenever the component changes.

Props​

NameTypeRequiredDefaultDescription
objectsarray[]Array of objects to display as cards
schemaobjectnullSchema definition (passed through to CnObjectCard)
loadingbooleanfalseWhether data is loading
selectablebooleanfalseWhether cards can be selected
clickToViewbooleanfalseWhen true, a body click on a selectable card emits click (navigation) and selection happens via the checkbox only — the card-grid counterpart of CnIndexPage's rowClickToView.
selectedIdsarray[]Array of currently selected object IDs
rowKeystring'id'Property name used as unique identifier
emptyTextstring() =&gt; t('nextcloud-vue', 'No items found')Text shown when there are no objects

Events​

NamePayloadDescription
click—
select—

Slots​

NameBindingsDescription
empty—
cardobject, selected, schema
card-actionsobject
card-badgesobject