Skip to content

ContentCard

A card with a preview, title and details.

ContentCard.tsx
import {ContentCard, ContentGrid, ContentGridItem} from 'alinea/components'
import {IcTwotoneDescription} from 'alinea/dashboard/icons'

const entries = [{id: 'post'}, {id: 'image'}]

export function ContentCardExample() {
  return (
    <div style={{width: 460, height: 240}}>
      <ContentGrid aria-label="Entries" items={entries} minItemWidth={180}>
        {entry => (
          <ContentGridItem id={entry.id} textValue={entry.id}>
            {entry.id === 'post' ? (
              <ContentCard
                icon={IcTwotoneDescription}
                title="Caring for linen"
                breadcrumbs={['Journal']}
                description="Blog post"
              />
            ) : (
              <ContentCard
                variant="media"
                image="/catalog/workshop-bench.jpg"
                color="#8a6f55"
                title="workshop-bench.jpg"
                breadcrumbs={['Media', 'Workshop']}
                description="JPG"
                details="480×320 · 38 kB"
              />
            )}
          </ContentGridItem>
        )}
      </ContentGrid>
    </div>
  )
}

Props

<ContentCard>

The contents of a ContentGridItem, mirroring the dashboard explorer cards

PropTypeDefaultDescription
title*ReactNodeDefault –
variant'icon' | 'media'Default 'icon'icon (the default) shows the icon on a neutral background, media previews a file: its image, or a file icon on the color placeholder
iconIconTypeDefault –The large icon on top of the card
imagestringDefault –Preview image of a media card
colorstringDefault –Placeholder color behind the image, eg. its average color
breadcrumbsReadonlyArray<ReactNode>Default –The location of the item, rendered above the title
descriptionReactNodeDefault –A line below the title, eg. the type or file extension
detailsReactNodeDefault –Rendered at the end of the description, eg. dimensions and file size

Also accepts className and style.

<ContentCardSkeleton>

A pulsing placeholder card for items that are still loading

Accepts className and style.