Content item
Renders a customizable content item from the content collection. Suitable for posts, news, portfolio items, and other dynamic content.
Component
Props
| Props | Default | Type |
|---|---|---|
type | ContentItemType.CARD | ContentItemType |
title | 'Title' | string |
titleTag | 'h4' | string |
titleClass | 'font-semibold' | string |
titleMaxLength | 72 | number |
description | — | string |
descriptionClass | 'text-sm text-text-neutral-subtle' | string |
descriptionMaxLength | 100 | number |
to | — | string |
hasImage | true | boolean |
imgUrl | — | string |
imgAlt | 'Item image' | string |
imgAspectRatio | AspectRatio.AR_16_9 | AspectRatio |
imgHoverEffect | ImageHoverEffect.BLUR | ImageHoverEffect |
hasImageHoverIcon | true | boolean |
imgHoverIcon | — | string |
imgHoverIconClass | — | string |
imgFallbackIcon | — | string |
imgFallbackIconClass | — | string |
imgContainerClass | — | string |
containerClass | — | string |
hasCardShadow | true | boolean |
hasCardBackgroundHover | false | boolean |
Usage
type
The type prop determines the type of the content item. It accepts values from the ContentItemType enum.
<template>
<ContentItem
:type="ContentItemType.CARD"
/>
</template>
Options
| Value | Description |
|---|---|
BASIC | Displays the item with in a basic style |
CARD | Displays the item inside a card |
title
Sets the title of the content item.
<template>
<ContentItem
title="Title"
/>
</template>
titleTag
Sets the HTML tag used for the title.
Accepted tags: h3, h4, h5, h6
<template>
<ContentItem
title="Title"
titleTag="h4"
/>
</template>
titleClass
Sets the class of the title.
<template>
<ContentItem
title="Title"
titleClass="font-bold"
/>
</template>
titleMaxLength
Sets the maximum length of the title.
<template>
<ContentItem
title="Title"
titleMaxLength="10"
/>
</template>
description
Sets the description of the content item.
<template>
<ContentItem
description="Description"
/>
</template>
descriptionClass
Sets the class of the description.
<template>
<ContentItem
description="Description"
descriptionClass="text-sm"
/>
</template>
descriptionMaxLength
Sets the maximum length of the description.
<template>
<ContentItem
description="Description"
descriptionClass="text-sm"
descriptionMaxLength="10"
/>
</template>
to
Sets the link of the content item.
<template>
<ContentItem
to="/"
/>
</template>
hasImage
Sets whether the content item should display an image. If it it set to true but no image is provided, it will show the fallback placeholder.
<template>
<ContentItem
hasImage="true"
/>
</template>
imgUrl
Sets the URL of the image to be displayed.
<template>
<ContentItem
imgUrl="https://picsum.photos/200/300"
/>
</template>
imgAlt
Sets the alt text of the image.
<template>
<ContentItem
imgUrl="https://picsum.photos/200/300"
imgAlt="Item image"
/>
</template>
imgAspectRatio
Sets the aspect ratio of the image.
<template>
<ContentItem
imgAspectRatio="AspectRatio.AR_16_9"
/>
</template>
Options
| Value | Description |
|---|---|
AR_1_1 | Square image format |
AR_4_3 | Horizontal 4:3 aspect ratio |
AR_3_2 | Horizontal 3:2 aspect ratio |
AR_16_9 | Horizontal 16:9 aspect ratio |
AR_3_4 | Vertical 3:4 aspect ratio |
AR_4_5 | Vertical 4:5 aspect ratio |
AR_2_3 | Vertical 2:3 aspect ratio |
imgHoverEffect
Sets the hover effect of the image.
<template>
<ContentItem
:imgHoverEffect="ImageHoverEffect.ZOOM_IN"
/>
</template>
Options
| Value | Description |
|---|---|
ZOOM_IN | Zoom in on the image |
ZOOM_OUT | Zoom out of the image |
OVERLAY | Overlay the image |
BLUR | Blur the image |
hasImageHoverIcon
Sets whether the image should display a hover icon.
<template>
<ContentItem
:hasImageHoverIcon="true"
/>
</template>
imgHoverIcon
Sets the icon to be displayed on hover.
<template>
<ContentItem
imgHoverIcon="mdi:eye-outline"
/>
</template>
imgHoverIconClass
Sets the class of the hover icon.
<template>
<ContentItem
imgHoverIcon="mdi:eye-outline"
imgHoverIconClass="text-icon-neutral-on-filled-bg"
/>
</template>
imgFallbackIcon
Sets the fallback icon when no image is found.
<template>
<ContentItem
imgFallbackIcon="mdi:image-off-outline"
/>
</template>
imgFallbackIconClass
Sets the class of the fallback icon.
<template>
<ContentItem
imgFallbackIcon="mdi:image-off-outline"
imgFallbackIconClass="text-icon-primary-brand-default"
/>
</template>
imgContainerClass
Sets the class of the image container.
<template>
<ContentItem
imgContainerClass="rounded-lg"
/>
</template>
containerClass
Sets the class of the container.
<template>
<ContentItem
containerClass="bg-white"
/>
</template>
hasCardShadow
Sets whether the card has a shadow. It requires the type to be ContentItemType.CARD.
<template>
<ContentItem
:type="ContentItemType.CARD"
:hasCardShadow="false"
/>
</template>
hasCardBackgroundHover
Sets whether the card background has a hover effect. It requires the type to be ContentItemType.CARD.
<template>
<ContentItem
:type="ContentItemType.CARD"
:hasCardBackgroundHover="true"
/>
</template>
Slots
| Name | Description |
|---|---|
content | Template to render a custom content for the item |
<template>
<ContentItem>
<template #content>
<!-- Insert custom content here -->
</template>
</ContentItem>
</template>