Skip to main content

Card Grid

Ant Design

The Card Grid component shows a list of records as a grid of cards, each with a title, an optional image, tags and details. Use it to browse items such as products, projects or recipes and pick one.

Properties​

Property
Description
Expected Value
Data sourceThe records to show, usually a query's data, one card per row.Array
Title fieldField shown as each card's title.Text. Default: title
Subtitle fieldField shown under the title.Text
Image fieldField that holds an image URL, shown at the top of the card.Text
Badge fieldField shown as a colored tag on the card. Common status words such as Done or Overdue get matching colors.Text. Default: category
Badge fieldsMore fields to show as tags, such as ['category', 'level']. A card shows up to four tags.Array
Eyebrow fieldField shown as small text above the title, such as a category.Text
Avatar fieldField shown as an avatar beside the title. An image URL shows the picture; other text shows its initials.Text
Description fieldField shown as the card's body text, cut after three lines.Text. Default: description
Progress fieldField that holds a number from 0 to 100, shown as a progress bar.Text
Meta fieldsFields shown as one line of small text at the bottom of the card, such as ['owner', 'due:Due {}']. After a colon, add a label, where {} marks where the value goes.Array
Id fieldField that identifies each record, used for the selected item.Text. Default: id
Layoutstacked puts the image above the text; row puts the image at the left of the text.stacked, row. Default: stacked
ColumnsNumber of cards per row, up to 8. Leave it at 0 to fit as many as Min card width allows.Number. Default: 0
Min card width (px)Narrowest a card gets when Columns is 0, at least 120 pixels.Number. Default: 240
Image aspectWidth to height ratio of each card's image.16/9, 4/3, 1/1. Default: 16/9
Show imageShows each card's image from Image field.On or off. Default: On
Variantoutlined draws a border around each card; borderless uses a plain background.outlined, borderless. Default: outlined
HoverableRaises a card with a shadow when the pointer is over it.On or off. Default: On
Empty textMessage shown when there are no records.Text. Default: No items

Additional Actions​

Each of these can be switched on or off, or set with a logical expression by clicking fx.

Property
Description
Expected Value
VisibilityShows or hides the component. Hidden components keep their space unless Collapse when hidden is on.On or off. Default: On
Collapse when hiddenRemoves the hidden component's space, so the components below it move up.On or off. Default: Off
Loading stateShows the component's loading look and blocks interaction, for example while a query runs.On or off. Default: Off
DisableStops the user from interacting with the component.On or off. Default: Off
Dynamic heightLets the component grow with its content in the running app instead of keeping a fixed height.On or off. Default: Off

Devices​

Property
Description
Expected Value
Show on desktopShows the component in the desktop layout.On or off. Default: On
Show on mobileShows the component in the mobile layout.On or off. Default: Off

Events​

Add a handler from the Events section of the properties panel. See Event Triggers for the steps.

Event
Description
On card clickedTriggers when the user clicks a card to select it. Clicking the selected card again clears the selection without firing this event.

Component Specific Actions (CSA)​

Run these from an event handler with Control Component, or from a RunJS query. See Component Specific Actions.

Action
Description
How To Access
Clear selectionClears the selected card.components.cardgrid1.clearSelection()
Set visibilityShows the component when true, hides it when false.components.cardgrid1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.cardgrid1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.cardgrid1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
dataSourceThe records to show, usually a query's data, one card per row.{{components.cardgrid1.dataSource}}
titleFieldField shown as each card's title.{{components.cardgrid1.titleField}}
subtitleFieldField shown under the title.{{components.cardgrid1.subtitleField}}
imageFieldField that holds an image URL, shown at the top of the card.{{components.cardgrid1.imageField}}
badgeFieldField shown as a colored tag on the card. Common status words such as Done or Overdue get matching colors.{{components.cardgrid1.badgeField}}
badgeFieldsMore fields to show as tags, such as ['category', 'level']. A card shows up to four tags.{{components.cardgrid1.badgeFields}}
eyebrowFieldField shown as small text above the title, such as a category.{{components.cardgrid1.eyebrowField}}
avatarFieldField shown as an avatar beside the title. An image URL shows the picture; other text shows its initials.{{components.cardgrid1.avatarField}}
descriptionFieldField shown as the card's body text, cut after three lines.{{components.cardgrid1.descriptionField}}
progressFieldField that holds a number from 0 to 100, shown as a progress bar.{{components.cardgrid1.progressField}}
metaFieldsFields shown as one line of small text at the bottom of the card, such as ['owner', 'due:Due {}']. After a colon, add a label, where {} marks where the value goes.{{components.cardgrid1.metaFields}}
idFieldField that identifies each record, used for the selected item.{{components.cardgrid1.idField}}
layoutstacked puts the image above the text; row puts the image at the left of the text.{{components.cardgrid1.layout}}
columnsNumber of cards per row, up to 8. Leave it at 0 to fit as many as Min card width allows.{{components.cardgrid1.columns}}
minCardWidthNarrowest a card gets when Columns is 0, at least 120 pixels.{{components.cardgrid1.minCardWidth}}
imageAspectWidth to height ratio of each card's image.{{components.cardgrid1.imageAspect}}
showImageShows each card's image from Image field.{{components.cardgrid1.showImage}}
variantoutlined draws a border around each card; borderless uses a plain background.{{components.cardgrid1.variant}}
hoverableRaises a card with a shadow when the pointer is over it.{{components.cardgrid1.hoverable}}
emptyTextMessage shown when there are no records.{{components.cardgrid1.emptyText}}
selectedItemIdValue of Id field for the selected card.{{components.cardgrid1.selectedItemId}}
selectedItemThe record of the selected card. It is empty when nothing is selected.{{components.cardgrid1.selectedItem}}
selectedItemIndexPosition of the selected card in Data source, starting at 0, or -1 when nothing is selected.{{components.cardgrid1.selectedItemIndex}}
isVisibleWhether the component is visible.{{components.cardgrid1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.cardgrid1.isLoading}}
isDisabledWhether the component is disabled.{{components.cardgrid1.isDisabled}}

Styles​

Style
Default
Primary colorTheme: Brand primary
Text colorTheme: Primary text
Container backgroundTheme: Surface 1
Border colorTheme: Default border
Border radius—
Box shadow0px 0px 0px 0px #00000040

A default that starts with Theme: follows the app's theme until the style is set to another value. See App Themes.