Skip to content

BaseImageBox

A component with the primary purpose to display images in responsive boxes but also allowing for text only

Props

Prop nameDescriptionTypeValuesDefault
titleThe title of the item in question (max 2 lines), also used as img alt textstring-'No title'
altTitlespecify a separate title to display on title hover and for the
image alt text. Useful for example if interpretTextAsHtml is
set true and the title contains HTML
string-''
subtextText displayed directly below title (max two lines; max 3 lines with title)string-''
altSubtextspecify a separate subtext to display on subtext hover. Useful for example
if interpretTextAsHtml is set true and the subtext contains HTML
string-''
showTitleshould the title be displayed or box only display the imageboolean-true
showTitleOnHovershould the title be displayed on box hoverboolean-false
titleRowsdefine the number of rows before the title is truncated with ...

auto: If subtext is defined, the title is displayed in one row, otherwise in two rows.
1: Title is displayed in one row.
string|numberauto, 1'auto'
imageUrldefine a url to a single image

data variants to render a single image using src or srcset for a responsive image:
src: 'path'
srcset: { '640w': 'path' }
string|object-null
imagesdefine up to 4 image url to be displayed in a grid

array variants to render a single image using src or srcset for a responsive image:
src: ['path']
srcset: [{ '640w': 'path' }]
array-[]
imageShadowdisplay shadow overlays at the top and bottom of the image
to make text easier to read
boolean-true
imageFooterMargindefine the margin (left, bottom, right) between the image footer and the imagestringlarge, small'large'
descriptiondescriptive element displayed at bottom of box (e.g. item type like "Bilderserie")string-null
additionaldescriptive element displayed at bottom of box (e.g. item type like "Bilderserie")string-null
iconset optional icon
e.g. for items without image
string-''
iconSizeset optional icon sizestringsmall, medium, large, xlarge, xxlarge'xxlarge'
playIcondisplay play icon
e.g. for Video, Audio files
boolean-false
selectabledetermines if the box should be selectable and the checkbox is displayedboolean-false
draggableset prop true if box can be dragged - used solely for styling purposesboolean-false
selectedset select status (checkbox checked) from outsideboolean-false
boxSizespecify the size of the boxobject-{
width: 'auto',
height: 'auto'
}
boxTextspecify any text that should be displayed instead of an image;
each array element on new line
array-[]
lazyloadspecify lazy image loadingboolean-false
imageFirstspecify position of imageboolean-false
centerHeaderspecify if header should be centered horizontally
(aligned left otherwise)
boolean-false
renderElementAsdefine html element that should be rendered
this could either be a native HTML element or a framework specific component
name (e.g. 'RouterLink') or a component passed directly

caveat: if you are using Nuxt the string 'NuxtLink' is not enough,
but you need to import the component as import { NuxtLink } from '#components';
and pass the component to the prop!
string|object-'div'
linkToif element is rendered as vue link component, specify a value for the to attribute
can either be a string or a vue-router Location object (= object with path property
and optional params or query object)
(this needs vue-router)
string|object-''
interpretTextAsHtmlif necessary box text (title, subtext, boxText) can
be rendered as html

tip: do not forget to set prop altTitle and/or altSubtext if the
title text or subtext contains html - otherwise the complete html will
be displayed on text hover and for image alt text

caveat: setting this variable true can lead to XSS attacks. Only use
this prop on trusted content and never on user-provided content.
boolean-false

Events

Event namePropertiesDescription
clickedevent triggered when selectable is false and box is clicked
select-triggeredundefined Boolean - was box selectedevent triggered when box is selectable and clicked upon

Slots

NameDescriptionBindings
title-rightcreate custom content (e.g. additional text or icon) right of the title
iconcreate custom content (e.g. folder icon)
textto display more advanced text - if you use this please specify the ref attribute with boxTextInner that has the line-height css attribute set - so the text display height can be calculated correctly!
footer-leftcreate custom content (e.g. featured icon for files) left of text
footer-rightcreate custom content (e.g. published icon for files) left of text

Demo

A variety of possibilities with image box