Skip to content
ui8kit

component / components

Quote Rating Panel

Quote Rating Panel component

Install

npx ui8kit add quote-rating-panel

Pulls in: box, compose, kit-box, kit-text, quote-split, rating, stack, testimonial-grid, text, utils

Preview

4.9 out of 5

From 2,400 reviews

12,400

Sites published

99.99%

Uptime

Code

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework svelte --dir src --registry-url https://registry.buildy.tw/svelte --strict-cdn
npx ui8kit add quote-rating-panel
components/quote-rating-panel.svelte
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!-- The rating summary of QuoteSplit: the average in large type, the stars, the number of reviews and two figures. -->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { QuoteExtras } from "../blocks/quote-split.types";
  import type { QuoteLabels } from "../blocks/testimonial-grid.types";

  export type QuoteRatingPanelProps = {
    extras: QuoteExtras;
    labels: QuoteLabels;
  };
</script>

<script lang="ts">
  import Box from "../compose/Box.svelte";
  import Stack from "../compose/Stack.svelte";
  import Text from "../compose/Text.svelte";
  import Rating from "../components/rating.svelte";
  import { tpl } from "../utils";

  let { extras, labels }: QuoteRatingPanelProps = $props();
</script>

<Stack
  gap="6"
  align="center"
  class="rounded bg-card inset-ring inset-ring-border p-8 text-center"
  data-slot="quote-rating"
>
  <Text size="5xl" weight="bold">
    {extras.score}
  </Text>
  <Rating value={extras.rating} label={tpl(labels.rating, extras.rating)} size={20} />
  <Text size="sm" class="text-muted-foreground">
    {extras.reviews}
  </Text>
  <Box class="grid w-full grid-cols-2 gap-4 border-t border-border pt-6">
    {#each extras.stats as s, i (s.id)}
      {#if (i < 2)}
        <Stack gap="0" align="center" data-slot="quote-stat">
          <Text size="2xl" weight="semibold">
            {s.value}
          </Text>
          <Text size="xs" class="text-muted-foreground">
            {s.label}
          </Text>
        </Stack>
      {/if}
    {/each}
  </Box>
</Stack>

Svelte registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework react --dir src --registry-url https://registry.buildy.tw/react --strict-cdn
npx ui8kit add quote-rating-panel
components/quote-rating-panel.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/** The rating summary of QuoteSplit: the average in large type, the stars, the number of reviews and two figures. */
import { Fragment, type ReactNode } from "react";
import { Box, Stack, Text } from "../compose";
import { Rating } from "../components/rating";
import { tpl } from "../utils";
import type { QuoteExtras } from "../blocks/quote-split.types";
import type { QuoteLabels } from "../blocks/testimonial-grid.types";

export type QuoteRatingPanelProps = {
  extras: QuoteExtras;
  labels: QuoteLabels;
};

export function QuoteRatingPanel({ extras, labels }: QuoteRatingPanelProps) {
  return (
    <Stack
      gap="6"
      align="center"
      className="rounded bg-card inset-ring inset-ring-border p-8 text-center"
      data-slot="quote-rating"
    >
      <Text size="5xl" weight="bold">
        {extras.score}
      </Text>
      <Rating value={extras.rating} label={tpl(labels.rating, extras.rating)} size={20} />
      <Text size="sm" className="text-muted-foreground">
        {extras.reviews}
      </Text>
      <Box className="grid w-full grid-cols-2 gap-4 border-t border-border pt-6">
        {(extras.stats ?? []).map((s, i) => (
          <Fragment key={s.id}>
            {(i < 2) ? (
              <Stack gap="0" align="center" data-slot="quote-stat">
                <Text size="2xl" weight="semibold">
                  {s.value}
                </Text>
                <Text size="xs" className="text-muted-foreground">
                  {s.label}
                </Text>
              </Stack>
            ) : null}
          </Fragment>
        ))}
      </Box>
    </Stack>
  );
}

React registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework vue --dir src --registry-url https://registry.buildy.tw/vue --strict-cdn
npx ui8kit add quote-rating-panel
components/quote-rating-panel.vue
<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!-- The rating summary of QuoteSplit: the average in large type, the stars, the number of reviews and two figures. -->
<script lang="ts">
import type { QuoteExtras } from "../blocks/quote-split.types";
import type { QuoteLabels } from "../blocks/testimonial-grid.types";

export type QuoteRatingPanelProps = {
  extras: QuoteExtras;
  labels: QuoteLabels;
};
</script>

<script setup lang="ts">
import Box from "../compose/Box.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import Rating from "../components/rating.vue";
import { tpl } from "../utils";

const { extras, labels } = defineProps<QuoteRatingPanelProps>();
</script>

<template>
  <Stack
    gap="6"
    align="center"
    class="rounded bg-card inset-ring inset-ring-border p-8 text-center"
    data-slot="quote-rating"
  >
    <Text size="5xl" weight="bold">
      {{ extras.score }}
    </Text>
    <Rating :value="extras.rating" :label="tpl(labels.rating, extras.rating)" :size="20" />
    <Text size="sm" class="text-muted-foreground">
      {{ extras.reviews }}
    </Text>
    <Box class="grid w-full grid-cols-2 gap-4 border-t border-border pt-6">
      <template v-for="(s, i) in extras.stats" :key="s.id">
        <Stack v-if="(i < 2)" gap="0" align="center" data-slot="quote-stat">
          <Text size="2xl" weight="semibold">
            {{ s.value }}
          </Text>
          <Text size="xs" class="text-muted-foreground">
            {{ s.label }}
          </Text>
        </Stack>
      </template>
    </Box>
  </Stack>
</template>

Vue registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework solid --dir src --registry-url https://registry.buildy.tw/solid --strict-cdn
npx ui8kit add quote-rating-panel
components/quote-rating-panel.tsx
// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/** The rating summary of QuoteSplit: the average in large type, the stars, the number of reviews and two figures. */
import { For, type JSX } from "solid-js";
import { Box, Stack, Text } from "../compose";
import { Rating } from "../components/rating";
import { tpl } from "../utils";
import type { QuoteExtras } from "../blocks/quote-split.types";
import type { QuoteLabels } from "../blocks/testimonial-grid.types";

export type QuoteRatingPanelProps = {
  extras: QuoteExtras;
  labels: QuoteLabels;
};

export function QuoteRatingPanel({ extras, labels }: QuoteRatingPanelProps) {
  return (
    <Stack
      gap="6"
      align="center"
      class="rounded bg-card inset-ring inset-ring-border p-8 text-center"
      data-slot="quote-rating"
    >
      <Text size="5xl" weight="bold">
        {extras.score}
      </Text>
      <Rating value={extras.rating} label={tpl(labels.rating, extras.rating)} size={20} />
      <Text size="sm" class="text-muted-foreground">
        {extras.reviews}
      </Text>
      <Box class="grid w-full grid-cols-2 gap-4 border-t border-border pt-6">
        <For each={extras.stats ?? []}>{(s, iOf) => { const i = iOf(); return (
          <>
            {(i < 2) ? (
              <Stack gap="0" align="center" data-slot="quote-stat">
                <Text size="2xl" weight="semibold">
                  {s.value}
                </Text>
                <Text size="xs" class="text-muted-foreground">
                  {s.label}
                </Text>
              </Stack>
            ) : null}
          </>
        ); }}</For>
      </Box>
    </Stack>
  );
}

Solid registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework templ --dir src --registry-url https://registry.buildy.tw/templ --strict-cdn
npx ui8kit add quote-rating-panel
blocks/quote-rating-panel.templ
// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
// Source: packages/compose-gen/specs/organisms/quote-rating-panel.json

package blocks

import (
	"github.com/ui8kit/codegen/generated/templ/ui/box"
	"github.com/ui8kit/codegen/generated/templ/compose"
	"github.com/ui8kit/codegen/generated/templ/ui/text"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// QuoteRatingPanelProps are the props of QuoteRatingPanel; the values are the JSON shapes of the TypeScript props.
type QuoteRatingPanelProps struct {
	Extras any `json:"extras"`
	Labels any `json:"labels"`
}

// The rating summary of QuoteSplit: the average in large type, the stars, the number of reviews and two figures.
templ QuoteRatingPanel(p QuoteRatingPanelProps) {
	{{ vExtras := p.Extras }}
	{{ vLabels := p.Labels }}
	@compose.Stack(compose.StackProps{Gap: "6", Align: "center", BoxProps: box.BoxProps{Class: "rounded bg-card inset-ring inset-ring-border p-8 text-center", Attrs: uiutils.Attrs("data-slot", "quote-rating")}}) {
		@compose.Text(compose.TextProps{Size: "5xl", Weight: "bold", TextProps: text.TextProps{}}) {
			{ uiutils.Text(uiutils.Get(vExtras, "score")) }
		}
		@Rating(RatingProps{Value: uiutils.Get(vExtras, "rating"), Label: uiutils.Tpl(uiutils.Get(vLabels, "rating"), uiutils.Get(vExtras, "rating")), Size: float64(20)})
		@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
			{ uiutils.Text(uiutils.Get(vExtras, "reviews")) }
		}
		@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "grid w-full grid-cols-2 gap-4 border-t border-border pt-6"}}) {
			for vI, vS := range uiutils.L(uiutils.Get(vExtras, "stats")) {
				if uiutils.Lt(float64(vI), float64(2)) {
					@compose.Stack(compose.StackProps{Gap: "0", Align: "center", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "quote-stat")}}) {
						@compose.Text(compose.TextProps{Size: "2xl", Weight: "semibold", TextProps: text.TextProps{}}) {
							{ uiutils.Text(uiutils.Get(vS, "value")) }
						}
						@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
							{ uiutils.Text(uiutils.Get(vS, "label")) }
						}
					}
				}
			}
		}
	}
}

templ registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework twig --dir src --registry-url https://registry.buildy.tw/twig --strict-cdn
npx ui8kit add quote-rating-panel
blocks/quote-rating-panel.html.twig
{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/quote-rating-panel.json
    The rating summary of QuoteSplit: the average in large type, the stars, the number of reviews and two figures.
    Props (p): extras, labels. -#}
{%- set v_extras = (p.extras ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- set c_7 -%}
  {%- set c_1 -%}
    {{ og_text(og_get(v_extras, ['score'])) }}
  {%- endset -%}
  {{ include('compose/Text.html.twig', {'size': '5xl', 'weight': 'bold', 'children': c_1}, with_context = false) }}
  {{ include('blocks/rating.html.twig', {'p': {'value': og_get(v_extras, ['rating']), 'label': og_tpl(og_get(v_labels, ['rating']), [og_get(v_extras, ['rating'])]), 'size': 20}}, with_context = false) }}
  {%- set c_2 -%}
    {{ og_text(og_get(v_extras, ['reviews'])) }}
  {%- endset -%}
  {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_2}, with_context = false) }}
  {%- set c_6 -%}
    {%- for v_s in og_l(og_get(v_extras, ['stats'])) %}
      {%- set v_i = loop.index0 -%}
      {%- if og_t(og_lt(v_i, 2)) %}
        {%- set c_5 -%}
          {%- set c_3 -%}
            {{ og_text(og_get(v_s, ['value'])) }}
          {%- endset -%}
          {{ include('compose/Text.html.twig', {'size': '2xl', 'weight': 'semibold', 'children': c_3}, with_context = false) }}
          {%- set c_4 -%}
            {{ og_text(og_get(v_s, ['label'])) }}
          {%- endset -%}
          {{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_4}, with_context = false) }}
        {%- endset -%}
        {{ include('compose/Stack.html.twig', {'gap': '0', 'align': 'center', 'attrs': og_attrs(['data-slot', 'quote-stat']), 'children': c_5}, with_context = false) }}
      {%- endif %}
    {%- endfor %}
  {%- endset -%}
  {{ include('compose/Box.html.twig', {'class': 'grid w-full grid-cols-2 gap-4 border-t border-border pt-6', 'children': c_6}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '6', 'align': 'center', 'class': 'rounded bg-card inset-ring inset-ring-border p-8 text-center', 'attrs': og_attrs(['data-slot', 'quote-rating']), 'children': c_7}, with_context = false) }}

Twig registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework latte --dir src --registry-url https://registry.buildy.tw/latte --strict-cdn
npx ui8kit add quote-rating-panel
blocks/quote-rating-panel.latte
{* Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/quote-rating-panel.json
    The rating summary of QuoteSplit: the average in large type, the stars, the number of reviews and two figures.
    Props (p): extras, labels. *}
{var $v_extras = ($p['extras'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{capture $c_7}
  {capture $c_1}
    {=og_text(og_get($v_extras, ['score']))}
  {/capture}
  {=og_include('compose/Text.latte', ['size' => '5xl', 'weight' => 'bold', 'children' => (string) $c_1])|noescape}
  {=og_include('blocks/rating.latte', ['p' => ['value' => og_get($v_extras, ['rating']), 'label' => og_tpl(og_get($v_labels, ['rating']), [og_get($v_extras, ['rating'])]), 'size' => 20]])|noescape}
  {capture $c_2}
    {=og_text(og_get($v_extras, ['reviews']))}
  {/capture}
  {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_2])|noescape}
  {capture $c_6}
    {foreach og_l(og_get($v_extras, ['stats'])) as $v_s}
      {var $v_i = $iterator->counter0}
      {if og_t(og_lt($v_i, 2))}
        {capture $c_5}
          {capture $c_3}
            {=og_text(og_get($v_s, ['value']))}
          {/capture}
          {=og_include('compose/Text.latte', ['size' => '2xl', 'weight' => 'semibold', 'children' => (string) $c_3])|noescape}
          {capture $c_4}
            {=og_text(og_get($v_s, ['label']))}
          {/capture}
          {=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_4])|noescape}
        {/capture}
        {=og_include('compose/Stack.latte', ['gap' => '0', 'align' => 'center', 'attrs' => og_attrs(['data-slot', 'quote-stat']), 'children' => (string) $c_5])|noescape}
      {/if}
    {/foreach}
  {/capture}
  {=og_include('compose/Box.latte', ['class' => 'grid w-full grid-cols-2 gap-4 border-t border-border pt-6', 'children' => (string) $c_6])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '6', 'align' => 'center', 'class' => 'rounded bg-card inset-ring inset-ring-border p-8 text-center', 'attrs' => og_attrs(['data-slot', 'quote-rating']), 'children' => (string) $c_7])|noescape}

Latte registry item (JSON)

Point the CLI at this runtime once, then add the item:

npx ui8kit init --yes --framework jinja2 --dir src --registry-url https://registry.buildy.tw/jinja2 --strict-cdn
npx ui8kit add quote-rating-panel
blocks/quote-rating-panel.html.j2
{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
    Source: packages/compose-gen/specs/organisms/quote-rating-panel.json
    The rating summary of QuoteSplit: the average in large type, the stars, the number of reviews and two figures.
    Props (p): extras, labels. -#}
{%- set v_extras = og_def(p['extras'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- set c_7 -%}
  {%- set c_1 -%}
    {{ og_text(og_get(v_extras, ['score'])) }}
  {%- endset -%}
  {{ og_include('compose/text.html.j2', {'p': {'Size': '5xl', 'Weight': 'bold'}, 'children': c_1}) }}
  {{ og_include('blocks/rating.html.j2', {'p': {'value': og_get(v_extras, ['rating']), 'label': og_tpl(og_get(v_labels, ['rating']), [og_get(v_extras, ['rating'])]), 'size': 20}}) }}
  {%- set c_2 -%}
    {{ og_text(og_get(v_extras, ['reviews'])) }}
  {%- endset -%}
  {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_2}) }}
  {%- set c_6 -%}
    {%- for v_s in og_l(og_get(v_extras, ['stats'])) %}
      {%- set v_i = loop.index0 -%}
      {%- if og_t(og_lt(v_i, 2)) %}
        {%- set c_5 -%}
          {%- set c_3 -%}
            {{ og_text(og_get(v_s, ['value'])) }}
          {%- endset -%}
          {{ og_include('compose/text.html.j2', {'p': {'Size': '2xl', 'Weight': 'semibold'}, 'children': c_3}) }}
          {%- set c_4 -%}
            {{ og_text(og_get(v_s, ['label'])) }}
          {%- endset -%}
          {{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_4}) }}
        {%- endset -%}
        {{ og_include('compose/stack.html.j2', {'p': {'Gap': '0', 'Align': 'center', 'Attrs': og_attrs(['data-slot', 'quote-stat'])}, 'children': c_5}) }}
      {%- endif %}
    {%- endfor %}
  {%- endset -%}
  {{ og_include('compose/box.html.j2', {'p': {'Class': 'grid w-full grid-cols-2 gap-4 border-t border-border pt-6'}, 'children': c_6}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '6', 'Align': 'center', 'Class': 'rounded bg-card inset-ring inset-ring-border p-8 text-center', 'Attrs': og_attrs(['data-slot', 'quote-rating'])}, 'children': c_7}) }}

Jinja2 registry item (JSON)

Props

Names and types come from the xgen specs of the source. Standard HTML attributes (id, role, tabIndex, aria-*) pass through to the root element; the class prop is className in React.

The rating summary of QuoteSplit: the average in large type, the stars, the number of reviews and two figures.

Props of QuoteRatingPanel
PropTypeDefault Description
extras (required)QuoteExtras-the figures, logos and rating summary
labels (required)QuoteLabels-

Used in