Skip to content
ui8kit

component / components

Media Review

Media Review component

Install

npx ui8kit add media-review

Pulls in: compose, group, kit-box, kit-text, media-list, rating, stack, text, utils

Preview

Featured review

“Bright enough to read, soft enough to relax. The base stays put.”

· Mar 12, 2026

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 media-review
components/media-review.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 featured review of MediaList in a muted card: a label with the stars, the text in quotes and the author. -->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import type { MediaExtras, MediaListLabels } from "../blocks/media-list.types";

  export type MediaReviewProps = {
    extras: MediaExtras;
    labels: MediaListLabels;
  };
</script>

<script lang="ts">
  import Group from "../compose/Group.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 }: MediaReviewProps = $props();
</script>

{#each extras.reviews as r, i (r.id)}
  {#if (i < 1)}
    <Stack gap="4" align="stretch" class="rounded bg-muted p-6" data-slot="media-review">
      <Group gap="4" align="center" justify="between" class="flex-wrap">
        <Text size="sm" weight="medium">
          {labels.featured}
        </Text>
        <Rating value={r.rating} label={tpl(labels.rating, r.rating)} />
      </Group>
      <Text size="base">
        {tpl("“{0}”", r.text)}
      </Text>
      <Text size="sm" class="text-muted-foreground">
        {tpl("{0} · {1}", r.author, r.date)}
      </Text>
    </Stack>
  {/if}
{/each}

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 media-review
components/media-review.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 featured review of MediaList in a muted card: a label with the stars, the text in quotes and the author. */
import { Fragment, type ReactNode } from "react";
import { Group, Stack, Text } from "../compose";
import { Rating } from "../components/rating";
import { tpl } from "../utils";
import type { MediaExtras, MediaListLabels } from "../blocks/media-list.types";

export type MediaReviewProps = {
  extras: MediaExtras;
  labels: MediaListLabels;
};

export function MediaReview({ extras, labels }: MediaReviewProps) {
  return (
    <>
      {(extras.reviews ?? []).map((r, i) => (
        <Fragment key={r.id}>
          {(i < 1) ? (
            <Stack gap="4" align="stretch" className="rounded bg-muted p-6" data-slot="media-review">
              <Group gap="4" align="center" justify="between" className="flex-wrap">
                <Text size="sm" weight="medium">
                  {labels.featured}
                </Text>
                <Rating value={r.rating} label={tpl(labels.rating, r.rating)} />
              </Group>
              <Text size="base">
                {tpl("“{0}”", r.text)}
              </Text>
              <Text size="sm" className="text-muted-foreground">
                {tpl("{0} · {1}", r.author, r.date)}
              </Text>
            </Stack>
          ) : null}
        </Fragment>
      ))}
    </>
  );
}

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 media-review
components/media-review.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 featured review of MediaList in a muted card: a label with the stars, the text in quotes and the author. -->
<script lang="ts">
import type { MediaExtras, MediaListLabels } from "../blocks/media-list.types";

export type MediaReviewProps = {
  extras: MediaExtras;
  labels: MediaListLabels;
};
</script>

<script setup lang="ts">
import Group from "../compose/Group.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<MediaReviewProps>();
</script>

<template>
  <template v-for="(r, i) in extras.reviews" :key="r.id">
    <Stack v-if="(i < 1)" gap="4" align="stretch" class="rounded bg-muted p-6" data-slot="media-review">
      <Group gap="4" align="center" justify="between" class="flex-wrap">
        <Text size="sm" weight="medium">
          {{ labels.featured }}
        </Text>
        <Rating :value="r.rating" :label="tpl(labels.rating, r.rating)" />
      </Group>
      <Text size="base">
        {{ tpl("“{0}”", r.text) }}
      </Text>
      <Text size="sm" class="text-muted-foreground">
        {{ tpl("{0} · {1}", r.author, r.date) }}
      </Text>
    </Stack>
  </template>
</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 media-review
components/media-review.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 featured review of MediaList in a muted card: a label with the stars, the text in quotes and the author. */
import { For, type JSX } from "solid-js";
import { Group, Stack, Text } from "../compose";
import { Rating } from "../components/rating";
import { tpl } from "../utils";
import type { MediaExtras, MediaListLabels } from "../blocks/media-list.types";

export type MediaReviewProps = {
  extras: MediaExtras;
  labels: MediaListLabels;
};

export function MediaReview({ extras, labels }: MediaReviewProps) {
  return (
    <>
      <For each={extras.reviews ?? []}>{(r, iOf) => { const i = iOf(); return (
        <>
          {(i < 1) ? (
            <Stack gap="4" align="stretch" class="rounded bg-muted p-6" data-slot="media-review">
              <Group gap="4" align="center" justify="between" class="flex-wrap">
                <Text size="sm" weight="medium">
                  {labels.featured}
                </Text>
                <Rating value={r.rating} label={tpl(labels.rating, r.rating)} />
              </Group>
              <Text size="base">
                {tpl("“{0}”", r.text)}
              </Text>
              <Text size="sm" class="text-muted-foreground">
                {tpl("{0} · {1}", r.author, r.date)}
              </Text>
            </Stack>
          ) : null}
        </>
      ); }}</For>
    </>
  );
}

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 media-review
blocks/media-review.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/media-review.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"
)

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

// The featured review of MediaList in a muted card: a label with the stars, the text in quotes and the author.
templ MediaReview(p MediaReviewProps) {
	{{ vExtras := p.Extras }}
	{{ vLabels := p.Labels }}
	for vI, vR := range uiutils.L(uiutils.Get(vExtras, "reviews")) {
		if uiutils.Lt(float64(vI), float64(1)) {
			@compose.Stack(compose.StackProps{Gap: "4", Align: "stretch", BoxProps: box.BoxProps{Class: "rounded bg-muted p-6", Attrs: uiutils.Attrs("data-slot", "media-review")}}) {
				@compose.Group(compose.GroupProps{Gap: "4", Align: "center", Justify: "between", BoxProps: box.BoxProps{Class: "flex-wrap"}}) {
					@compose.Text(compose.TextProps{Size: "sm", Weight: "medium", TextProps: text.TextProps{}}) {
						{ uiutils.Text(uiutils.Get(vLabels, "featured")) }
					}
					@Rating(RatingProps{Value: uiutils.Get(vR, "rating"), Label: uiutils.Tpl(uiutils.Get(vLabels, "rating"), uiutils.Get(vR, "rating"))})
				}
				@compose.Text(compose.TextProps{Size: "base", TextProps: text.TextProps{}}) {
					{ uiutils.Text(uiutils.Tpl("“{0}”", uiutils.Get(vR, "text"))) }
				}
				@compose.Text(compose.TextProps{Size: "sm", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
					{ uiutils.Text(uiutils.Tpl("{0} · {1}", uiutils.Get(vR, "author"), uiutils.Get(vR, "date"))) }
				}
			}
		}
	}
}

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 media-review
blocks/media-review.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/media-review.json
    The featured review of MediaList in a muted card: a label with the stars, the text in quotes and the author.
    Props (p): extras, labels. -#}
{%- set v_extras = (p.extras ?? null) -%}
{%- set v_labels = (p.labels ?? null) -%}
{%- for v_r in og_l(og_get(v_extras, ['reviews'])) %}
  {%- set v_i = loop.index0 -%}
  {%- if og_t(og_lt(v_i, 1)) %}
    {%- set c_5 -%}
      {%- set c_2 -%}
        {%- set c_1 -%}
          {{ og_text(og_get(v_labels, ['featured'])) }}
        {%- endset -%}
        {{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'medium', 'children': c_1}, with_context = false) }}
        {{ include('blocks/rating.html.twig', {'p': {'value': og_get(v_r, ['rating']), 'label': og_tpl(og_get(v_labels, ['rating']), [og_get(v_r, ['rating'])])}}, with_context = false) }}
      {%- endset -%}
      {{ include('compose/Group.html.twig', {'gap': '4', 'align': 'center', 'justify': 'between', 'class': 'flex-wrap', 'children': c_2}, with_context = false) }}
      {%- set c_3 -%}
        {{ og_text(og_tpl('“{0}”', [og_get(v_r, ['text'])])) }}
      {%- endset -%}
      {{ include('compose/Text.html.twig', {'size': 'base', 'children': c_3}, with_context = false) }}
      {%- set c_4 -%}
        {{ og_text(og_tpl('{0} · {1}', [og_get(v_r, ['author']), og_get(v_r, ['date'])])) }}
      {%- endset -%}
      {{ include('compose/Text.html.twig', {'size': 'sm', 'class': 'text-muted-foreground', 'children': c_4}, with_context = false) }}
    {%- endset -%}
    {{ include('compose/Stack.html.twig', {'gap': '4', 'align': 'stretch', 'class': 'rounded bg-muted p-6', 'attrs': og_attrs(['data-slot', 'media-review']), 'children': c_5}, with_context = false) }}
  {%- endif %}
{%- endfor %}

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 media-review
blocks/media-review.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/media-review.json
    The featured review of MediaList in a muted card: a label with the stars, the text in quotes and the author.
    Props (p): extras, labels. *}
{var $v_extras = ($p['extras'] ?? null)}
{var $v_labels = ($p['labels'] ?? null)}
{foreach og_l(og_get($v_extras, ['reviews'])) as $v_r}
  {var $v_i = $iterator->counter0}
  {if og_t(og_lt($v_i, 1))}
    {capture $c_5}
      {capture $c_2}
        {capture $c_1}
          {=og_text(og_get($v_labels, ['featured']))}
        {/capture}
        {=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'medium', 'children' => (string) $c_1])|noescape}
        {=og_include('blocks/rating.latte', ['p' => ['value' => og_get($v_r, ['rating']), 'label' => og_tpl(og_get($v_labels, ['rating']), [og_get($v_r, ['rating'])])]])|noescape}
      {/capture}
      {=og_include('compose/Group.latte', ['gap' => '4', 'align' => 'center', 'justify' => 'between', 'class' => 'flex-wrap', 'children' => (string) $c_2])|noescape}
      {capture $c_3}
        {=og_text(og_tpl('“{0}”', [og_get($v_r, ['text'])]))}
      {/capture}
      {=og_include('compose/Text.latte', ['size' => 'base', 'children' => (string) $c_3])|noescape}
      {capture $c_4}
        {=og_text(og_tpl('{0} · {1}', [og_get($v_r, ['author']), og_get($v_r, ['date'])]))}
      {/capture}
      {=og_include('compose/Text.latte', ['size' => 'sm', 'class' => 'text-muted-foreground', 'children' => (string) $c_4])|noescape}
    {/capture}
    {=og_include('compose/Stack.latte', ['gap' => '4', 'align' => 'stretch', 'class' => 'rounded bg-muted p-6', 'attrs' => og_attrs(['data-slot', 'media-review']), 'children' => (string) $c_5])|noescape}
  {/if}
{/foreach}

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 media-review
blocks/media-review.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/media-review.json
    The featured review of MediaList in a muted card: a label with the stars, the text in quotes and the author.
    Props (p): extras, labels. -#}
{%- set v_extras = og_def(p['extras'], none) -%}
{%- set v_labels = og_def(p['labels'], none) -%}
{%- for v_r in og_l(og_get(v_extras, ['reviews'])) %}
  {%- set v_i = loop.index0 -%}
  {%- if og_t(og_lt(v_i, 1)) %}
    {%- set c_5 -%}
      {%- set c_2 -%}
        {%- set c_1 -%}
          {{ og_text(og_get(v_labels, ['featured'])) }}
        {%- endset -%}
        {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'medium'}, 'children': c_1}) }}
        {{ og_include('blocks/rating.html.j2', {'p': {'value': og_get(v_r, ['rating']), 'label': og_tpl(og_get(v_labels, ['rating']), [og_get(v_r, ['rating'])])}}) }}
      {%- endset -%}
      {{ og_include('compose/group.html.j2', {'p': {'Gap': '4', 'Align': 'center', 'Justify': 'between', 'Class': 'flex-wrap'}, 'children': c_2}) }}
      {%- set c_3 -%}
        {{ og_text(og_tpl('“{0}”', [og_get(v_r, ['text'])])) }}
      {%- endset -%}
      {{ og_include('compose/text.html.j2', {'p': {'Size': 'base'}, 'children': c_3}) }}
      {%- set c_4 -%}
        {{ og_text(og_tpl('{0} · {1}', [og_get(v_r, ['author']), og_get(v_r, ['date'])])) }}
      {%- endset -%}
      {{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Class': 'text-muted-foreground'}, 'children': c_4}) }}
    {%- endset -%}
    {{ og_include('compose/stack.html.j2', {'p': {'Gap': '4', 'Align': 'stretch', 'Class': 'rounded bg-muted p-6', 'Attrs': og_attrs(['data-slot', 'media-review'])}, 'children': c_5}) }}
  {%- endif %}
{%- endfor %}

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 featured review of MediaList in a muted card: a label with the stars, the text in quotes and the author.

Props of MediaReview
PropTypeDefault Description
extras (required)MediaExtras-
labels (required)MediaListLabels-

Used in