Previewbox

High-quality, open-source website preview components

API

<previewbox-article>

Previewbox Link |

Attributes

NameDescriptionTypeDefault
hideReadMoreBtnIf attribute is present, the read more button will not be shown.string | undefined
readMoreBtnTextThe text for the read more button. Default: 'Read more'string'Read more'
url If the href is not provided, the url will be used to fetch the link preview data.string | nullnull
titleA manually set title for the link preview.string''
descriptionA manually set description for the link preview.string | nullnull
authorA manually set author for the link preview.string | nullnull
imageUrlA manually set image URL for the link preview.string | nullnull
imageAltA manually set image alt text for the link preview.string | nullnull
faviconUrlA manually set favicon URL for the link preview. If not provided, a fallback favicon will be used.string | nullnull
dateA manually set date for the link preview.string | nullnull
hidePoweredByIf set to true, the Powered by Previewbox info will not be shown.string | undefinedundefined
apiUrlThe URL of the API to fetch the link preview data from. Defaults to the Previewbox API.string
darkIf set to true, the components will always be in dark mode.string | undefinedundefined
lightIf set to true, the components will always be in light mode.string | undefinedundefined
hrefThe URL to fetch the meta data from. E.g. https://web-highlights.com/. Reads the open graph data from the provided URL.string''
targetThe target attribute for the a-element. E.g. '_blank'.string'_blank'
relThe rel attribute for the a-element. E.g. 'noopener noreferrer'.string''

Properties

NameAttributeDescriptionTypeDefault
hideReadMoreBtnhideReadMoreBtnIf attribute is present, the read more button will not be shown.string | undefined
readMoreBtnTextreadMoreBtnTextThe text for the read more button. Default: 'Read more'string'Read more'
urlurl If the href is not provided, the url will be used to fetch the link preview data.string | nullnull
titletitleA manually set title for the link preview.string''
descriptiondescriptionA manually set description for the link preview.string | nullnull
authorauthorA manually set author for the link preview.string | nullnull
imageUrlimageUrlA manually set image URL for the link preview.string | nullnull
imageAltimageAltA manually set image alt text for the link preview.string | nullnull
faviconUrlfaviconUrlA manually set favicon URL for the link preview. If not provided, a fallback favicon will be used.string | nullnull
datedateA manually set date for the link preview.string | nullnull
hidePoweredByhidePoweredByIf set to true, the Powered by Previewbox info will not be shown.string | undefinedundefined
apiUrlapiUrlThe URL of the API to fetch the link preview data from. Defaults to the Previewbox API.string
darkdarkIf set to true, the components will always be in dark mode.string | undefinedundefined
lightlightIf set to true, the components will always be in light mode.string | undefinedundefined
fetchedLinkPreviewDataLinkPreviewData | nullnull
_isLoadingbooleanfalse
_isErrorbooleanfalse
_apiErrorApiError | nullnull
linkDataLinkPreviewData
hrefhrefThe URL to fetch the meta data from. E.g. https://web-highlights.com/. Reads the open graph data from the provided URL.string''
targettargetThe target attribute for the a-element. E.g. '_blank'.string'_blank'
relrelThe rel attribute for the a-element. E.g. 'noopener noreferrer'.string''

CSS Shadow Parts

NameDescription
linkThe a-element that contains the link
containerThe container element that contains the anchor element
thumbnailThe thumbnail element that contains the image

<previewbox-link>

Previewbox Link |

Attributes

NameDescriptionTypeDefault
url If the href is not provided, the url will be used to fetch the link preview data.string | nullnull
titleA manually set title for the link preview.string''
descriptionA manually set description for the link preview.string | nullnull
authorA manually set author for the link preview.string | nullnull
imageUrlA manually set image URL for the link preview.string | nullnull
imageAltA manually set image alt text for the link preview.string | nullnull
faviconUrlA manually set favicon URL for the link preview. If not provided, a fallback favicon will be used.string | nullnull
dateA manually set date for the link preview.string | nullnull
hidePoweredByIf set to true, the Powered by Previewbox info will not be shown.string | undefinedundefined
apiUrlThe URL of the API to fetch the link preview data from. Defaults to the Previewbox API.string
darkIf set to true, the components will always be in dark mode.string | undefinedundefined
lightIf set to true, the components will always be in light mode.string | undefinedundefined
hrefThe URL to fetch the meta data from. E.g. https://web-highlights.com/. Reads the open graph data from the provided URL.string''
targetThe target attribute for the a-element. E.g. '_blank'.string'_blank'
relThe rel attribute for the a-element. E.g. 'noopener noreferrer'.string''

Properties

NameAttributeDescriptionTypeDefault
urlurl If the href is not provided, the url will be used to fetch the link preview data.string | nullnull
titletitleA manually set title for the link preview.string''
descriptiondescriptionA manually set description for the link preview.string | nullnull
authorauthorA manually set author for the link preview.string | nullnull
imageUrlimageUrlA manually set image URL for the link preview.string | nullnull
imageAltimageAltA manually set image alt text for the link preview.string | nullnull
faviconUrlfaviconUrlA manually set favicon URL for the link preview. If not provided, a fallback favicon will be used.string | nullnull
datedateA manually set date for the link preview.string | nullnull
hidePoweredByhidePoweredByIf set to true, the Powered by Previewbox info will not be shown.string | undefinedundefined
apiUrlapiUrlThe URL of the API to fetch the link preview data from. Defaults to the Previewbox API.string
darkdarkIf set to true, the components will always be in dark mode.string | undefinedundefined
lightlightIf set to true, the components will always be in light mode.string | undefinedundefined
fetchedLinkPreviewDataLinkPreviewData | nullnull
_isLoadingbooleanfalse
_isErrorbooleanfalse
_apiErrorApiError | nullnull
linkDataLinkPreviewData
hrefhrefThe URL to fetch the meta data from. E.g. https://web-highlights.com/. Reads the open graph data from the provided URL.string''
targettargetThe target attribute for the a-element. E.g. '_blank'.string'_blank'
relrelThe rel attribute for the a-element. E.g. 'noopener noreferrer'.string''

CSS Shadow Parts

NameDescription
linkThe a-element that contains the link
containerThe container element that contains the anchor element

<undefined>

Attributes

NameDescriptionTypeDefault
faviconUrlstring | nullnull

Properties

NameAttributeDescriptionTypeDefault
faviconUrlfaviconUrlstring | nullnull
isFaviconErrorbooleanfalse

<undefined>

Attributes

NameDescriptionTypeDefault
imageUrlstring | nullnull
imageAltstring | nullnull
isLoadingbooleantrue

Properties

NameAttributeDescriptionTypeDefault
imageUrlimageUrlstring | nullnull
imageAltimageAltstring | nullnull
isLoadingisLoadingbooleantrue
isImageErrorbooleanfalse

<undefined>

<undefined>

<undefined>

Attributes

NameDescriptionTypeDefault
widthnumber | string'100%'
heightnumber | string'16px'

Properties

NameAttributeDescriptionTypeDefault
widthwidthnumber | string'100%'
heightheightnumber | string'16px'

<undefined>

A base directive that contains the natural properties of an anchor element.

Attributes

NameDescriptionTypeDefault
hrefThe URL to fetch the meta data from. E.g. https://web-highlights.com/. Reads the open graph data from the provided URL.string''
targetThe target attribute for the a-element. E.g. '_blank'.string'_blank'
relThe rel attribute for the a-element. E.g. 'noopener noreferrer'.string''

Properties

NameAttributeDescriptionTypeDefault
hrefhrefThe URL to fetch the meta data from. E.g. https://web-highlights.com/. Reads the open graph data from the provided URL.string''
targettargetThe target attribute for the a-element. E.g. '_blank'.string'_blank'
relrelThe rel attribute for the a-element. E.g. 'noopener noreferrer'.string''