Skip to main content

ListTeaser: React

An article teaser refers to a summary of a longer written news article. Its purpose is to entice readers and generate interest in the full article by offering a glimpse of the content's main points, intriguing information, or engaging elements. This pattern is called the List Teaser.

Installation

Before you can start using the @mediahuis/chameleon-react component, you’ll need to install it, for more information check: Getting started for developers.

With that done, you’re now ready to implement the component in your application.

import { ListTeaser } from '@mediahuis/chameleon-react';

export default function Example() {
return <ListTeaser title="Example" />;
}

Properties

PropertyTypeDefaultRequiredDescription
asElementType'article'NoAllows rendering the ListTeaser with a different HTML tag or a different custom component.
classNameString-NoAllows extending the class names of the teaser.
dateTimeString-NoDateTime of the article, indicate when the teaser has been published. Should be in (ISO8601) notation.
dateTimeOptionsOmit{ format: dateTimeTimeFormat }NoThe date and time formatting setting.
externalBoolean-NoIndicates that the teaser links to an external resource. This adds a visual indicator after the title.
linkString | ReactNode-YesYou can pass a simple URL as string, or you could supply your own component if you would like to add custom props to it (e.g. if you want to add target="_blank")
loadingBoolean-NoThe loading state of the teaser. Will show skeleton loader over the teaser.
prefixString-NoPrepend a prefix to the title.
premiumBoolean-NoAdds a visual indication that the teaser links to premium content.
premiumAccessibilityLabelStringdefaultLocale.premiumNoThe label for the premium indicator, this will be read out by screen readers.
testIDsTestIDProps{}NoTest IDs for automated testing.
titleString-NoThe title of the teaser.
titleTagName'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span''h2'NoThe HTML tag to be used for the title, this has no effect on styling, but is important for accessibility and SEO.

DateTimeOptions

The dateTimeOptions property is an object with configuration for the dateTime, like format, locale and timezone. This uses the DateTime component internally.