Skip to content
Klarhimmel UI

Testimonials, rating

Testimonials, rating previewTestimonials, rating preview

Install

npx shadcn add @klarhimmel/testimonials-rating
DetailsAbout, usage, props and more

A review-site look: a big average score with stars and the review count on the left, two to four star-rated reviews with a headline, text, name and date on the right.

Import

Import

import Block from '@/components/klarhimmel/blocks/testimonials-rating';
Also called
  • testimonials/rating
About
A review-site look: a big average score with stars and the review count on the left, two to four star-rated reviews with a headline, text, name and date on the right. Stars are decorative; the rating is read out as "5 out of 5 stars".
Category
What customers say, one quote or many. New project? Set it up once: /get-started/installation.

Notes

When to use it

A review-site layout: a big average score with stars on the left and up to four star-rated reviews on the right. With a real rating and no review texts (reviews empty), it is a slim strip: title, stars, score and count on one line, and a link to the reviews. Use it when you have a real rating; testimonials-grid is the better pick for quotes without scores.

Writing for it

- The score (8 characters) is text, such as '4,8', and outOf (30 characters) such as 'out of 5'. The summary stars come from scoreStars, a separate field. - Each review needs a headline (80 characters), a name and stars from 1 to 5. The review text has 280 characters and is optional. - Score, scoreStars and basis (80 characters, the count and source, such as 'Based on 214 Google reviews') come only from the business's real reviews, as they stand; never write a review their page does not show (leave the list empty for the strip). The link goes to where the reviews live. With no real rating, leave all three empty: the score card is not drawn and the reviews stand alone.

Watch out for

The star icons are decorative. Screen readers get the review's star number followed by the outOf text, so a score label like 'out of 5 stars' reads as '5 out of 5 stars' and a different wording will read oddly.

Usage

The block in a page, with its default content (long lists shortened). Every prop is in the table below.

section.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { BlockSurface } from '@/components/klarhimmel/blocks/surface';
import TestimonialsRating from '@/components/klarhimmel/blocks/testimonials-rating';

export default function Section() {
  return (
    <Theme theme="brand">
      <BlockSurface>
        <TestimonialsRating props={{
          "eyebrow": "Section name",
          "title": "Say what the average rating is",
          "score": "0.0",
          "scoreStars": "5",
          "outOf": "out of 5 stars",
          "basis": "Say where the rating comes from",
          "link": {
            "label": "",
            "href": ""
          },
          "reviews": [
            {
              "stars": "5",
              "headline": "Give the review a headline",
              "text": "Say in a sentence or two what the reviewer liked, with one concrete detail.",
              "name": "Name a person",
              "when": "Say when, as a month"
            },
            {
              "stars": "5",
              "headline": "Give the review a headline",
              "text": "Say in a sentence or two what the reviewer liked, with one concrete detail.",
              "name": "Name a person",
              "when": "Say when, as a month"
            },
            {
              "stars": "4",
              "headline": "Give the review a headline",
              "text": "Say in a sentence or two what the reviewer liked, with one concrete detail.",
              "name": "Name a person",
              "when": "Say when, as a month"
            }
          ]
        }} />
      </BlockSurface>
    </Theme>
  );
}

Props

The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.

PropTypeDefaultDescription
eyebrowstring'Section name'Text, up to 60 characters.
titlestring'Say what the average rating is'Text, up to 120 characters.
scorestring'0.0'Text, up to 8 characters.
scoreStars'1' | '2' | '3' | '4' | '5''5'One of '1', '2', '3', '4', '5'. Optional; empty is not rendered.
outOfstring'out of 5 stars'Text, up to 30 characters.
basisstring'Say where the rating comes from'Text, up to 80 characters.
reviews{ stars, headline, text, name, when }[]3 itemsList of up to 4. Each item: stars ('1' | '2' | '3' | '4' | '5'), headline, text, name, when.
linkLink{…}Optional; empty is not rendered.
headingLevel'1' | '2'-One of '1', '2'. Optional; empty is not rendered.