ScoreRating Component

Set up

Let's import all necessary components in the script tag.

<script>
  import { Rating, ScoreRating } from 'flowbite-svelte';
  let headerLabel = {
    desc1: '8.7',
    desc2: 'Excellent',
    desc3: '376 reviews',
    link: {
      label: 'Read all reviews',
      url: '/'
    }
  };
</script>

Score rating

8.7

Excellent

376 reviews

Read all reviews
Staff
8.8
Comfort
8.9
Free WiFi
8.8
Facilities
5.4
Value for money
8.9
Cleanliness
7
Location
8
<ScoreRating
  {headerLabel}
  ratings={[
    { label: 'Staff', rating: 8.8 },
    { label: 'Comfort', rating: 8.9 },
    { label: 'Free WiFi', rating: 8.8 },
    { label: 'Facilities', rating: 5.4 }
  ]}
  ratings2={[
    { label: 'Value for money', rating: 8.9 },
    { label: 'Cleanliness', rating: 7.0 },
    { label: 'Location', rating: 8.0 }
  ]}
/>

Props

The component has the following props, type, and default values. See types page for type information.

Name Type Default
ratings { label: string
ratings2 { label: string
headerLabel { desc1: string
desc1Class string 'bg-blue-100 w-8 text-blue-800 text-sm font-semibold inline-flex items-center p-1.5 rounded dark:bg-blue-200 dark:text-blue-800'
desc2Class string 'ml-2 w-24 font-medium text-gray-900 dark:text-white'
desc3spanClass string 'mx-2 w-1 h-1 bg-gray-900 rounded-full dark:bg-gray-500'
desc3pClass string 'text-sm w-24 font-medium text-gray-500 dark:text-gray-400'

References