The EntryCard component is built on top of the Card component and it provides more props to help you manage the entries of your Contentful implementation.
Import
import { EntryCard } from '@contentful/f36-components';// orimport { EntryCard } from '@contentful/f36-card';
Examples
The two main props to show the content of your entry are title
and desciption
.
It’s also possible to pass the Entry’s content type in the contentType
prop.
To show a badge with the status of the entry,
you can pass one of "archived", "changed", "deleted", "draft", "new", or "published" to the status
prop.
Basic usage
Clickable card
Like the Card
component, it’s possible to pass a function to the onClick
prop
and it will be called when the user clicks on the card.
Card actions
To show a ...
button with a menu in the card, pass an array of MenuItem
components
Loading state
Different sizes
With a drag handle
With a thumbnail
Props (API reference)
Open in Storybook- Name
actions
DescriptionAn array of Menu elements used to render an actions menu
ReactNodeArray - Name
actionsButtonProps
DescriptionProps to pass to the action menu button
Partial<ButtonProps<"button">> - Name
ariaLabel
DescriptionIf the card is selectable and has no title, it will need a aria-label to help screen readers identify it
string - Name
as
DescriptionHandle tag for Card component
HTML Tag or React Component (e.g. div, span, etc) - Name
children
DescriptionChild nodes to be rendered in the component
ReactNode - Name
className
DescriptionCSS class to be appended to the root element
string - Name
contentType
DescriptionThe content type of the entry
string - Name
description
DescriptionThe description of the entry
string - Name
dragHandleRender
DescriptionCustom drag handle renderer. Useful, when integrating cards with drag-n-drop libraries
(props: { isDragging?: boolean; drag: ReactElement<any, string | JSXElementConstructor<any>>; }) => ReactElement<any, string | JSXElementConstructor<any>> - Name
href
DescriptionPassing href into the Card. You need to also add property as="a" to make it rendered as <a />
string - Name
icon
DescriptionIcon to show in the Card header
ReactElement<any, string | JSXElementConstructor<any>> - Name
isDragging
DescriptionApplies dragging styles to the card and drag handle
falsetrue - Name
isHovered
DescriptionApplies hover styles to the card
falsetrue - Name
isLoading
DescriptionLoading state for the component - when true will display loading feedback to the user
falsetrue - Name
isSelected
DescriptionApplies selected styles to the element
falsetrue - Name
margin
Descriptionsets margin to one of the corresponding spacing tokens
"none""spacing2Xs""spacingXs""spacingS""spacingM""spacingL""spacingXl""spacing2Xl""spacing3Xl""spacing4Xl" - Name
marginBottom
Descriptionsets margin-bottom to one of the corresponding spacing tokens
"none""spacing2Xs""spacingXs""spacingS""spacingM""spacingL""spacingXl""spacing2Xl""spacing3Xl""spacing4Xl" - Name
marginLeft
Descriptionsets margin-left to one of the corresponding spacing tokens
"none""spacing2Xs""spacingXs""spacingS""spacingM""spacingL""spacingXl""spacing2Xl""spacing3Xl""spacing4Xl" - Name
marginRight
Descriptionsets margin-right to one of the corresponding spacing tokens
"none""spacing2Xs""spacingXs""spacingS""spacingM""spacingL""spacingXl""spacing2Xl""spacing3Xl""spacing4Xl" - Name
marginTop
Descriptionsets margin-top to one of the corresponding spacing tokens
"none""spacing2Xs""spacingXs""spacingS""spacingM""spacingL""spacingXl""spacing2Xl""spacing3Xl""spacing4Xl" - Name
onClick
DescriptionClick event handler
MouseEventHandler<HTMLElement> - Name
size
DescriptionChanges the height of the component. When small will also ensure thumbnail and description aren't rendered
"small""auto""default" - Name
status
DescriptionThe publish status of the entry
"archived""changed""deleted""draft""new""published" - Name
testId
DescriptionA [data-test-id] attribute used for testing purposes
string - Name
thumbnailElement
DescriptionThe thumbnail of the entry
ReactElement<any, string | JSXElementConstructor<any>> - Name
title
DescriptionThe title of the entry
string - Name
withDragHandle
DescriptionRender the component with a drag handle
falsetrue
Content guidelines
Since this is a very opinionated component, we recommend using it only to show your entries. Similar to how references are shown in Contentful.
Accessibility
It inherits the accessibility features of Card