Skip to Content
πŸŽ‰ Coral x Panda has been released πŸŽ‰ Read the Migration Guide

TrustPilot

TrustPilot is a molecule that uses our Trustpilot AppΒ  to display a sentence and Trustpilot review star count, alongwith their logo. This will work for all OE entities that are currently live on Trustpilot.

Basic Usage

import { TrustPilot } from '@krakentech/coral-molecules'; <TrustPilot />

Properties

businessAcronym

Use the businessAcronym prop to specify the entity you want to display the Trustpilot review for.

<TrustPilot businessAcronym="oede" />
Trustpilot Logo

caption

Use the caption prop to provide a custom caption. This prop returns the day, month and year of the last time the Trustpilot review data was updated.

<TrustPilot caption={({ day, month, year }) => `A custom caption with variables: ${day}-${month}-${year}` } />
Trustpilot Logo

message

Use the message prop to provide a custom message. This prop returns the stars and reviews count to use inside your custom message.

<TrustPilot message={({ stars, trustScore, reviews }) => `A custom message with variables. Stars: ${stars}, trustScore: ${trustScore}, reviews: ${reviews}` } />
Trustpilot Logo

Sub-components

It’s possible to use both the Trustpilot Logo and the Stars in insolation. This is useful if you want to use either of them in a different layout or context.

Visit the useTrustPilot hook documentation for further customisation options.

<Stack alignItems="center" flexDirection="column"> <TrustPilotLogo width={200} /> <TrustPilotStars stars={4.5} /> </Stack>
Trustpilot Logo
Trustpilot 4.5 stars

Full API

NameTypeDefault
businessAcronymTrustPilotBusinessAcronym

The acronym for the business you’d like to get Trust Pilot review data for.

oegb
message(props: TrustPilotMessageProps) => ReactNode

Provide a custom message to be displayed. This is a function that returns the following props:

  • stars: The number of stars the business has
  • trustScore: The score the business received
  • reviews: The number of reviews the business has
caption(props: TrustPilotCaptionProps) => ReactNode

Provide a custom caption to be displayed. This is a function that returns the following props:

  • day: The last updated day
  • month: The last updated month
  • year: The last updated year
  • `dateISOString: The full date string in ISO format
attributesAttributes

This prop can be used to pass HTML attributes directly to the component. We currently allow passing data-* and aria-* attributes and the id. However, you can pass anything else with a type hack if necessary since this object is despread in to the component, without filtering its content.

Example usage:

AttributesProps: { 'id': 'close-button', 'aria-label': 'Close button', 'data-testid': 'close-button' };
Last updated on