Skip to main content

ProductShortDescription

Renders a product's short description as HTML content, resolving the correct entry from the product's localized descriptions array.

Usage

Basic usage with a product

import ProductShortDescription from '@/components/propeller/ProductShortDescription';

<ProductShortDescription product={product} />

With a specific language

<ProductShortDescription product={product} language="EN" />

With a cluster

<ProductShortDescription product={cluster} language="DE" />

With custom styling

<ProductShortDescription
product={product}
language="NL"
className="mt-4 text-sm"
/>

Conditional rendering on a product detail page

function ProductDetail({ product }: { product: Product }) {
return (
<div>
<h1>{product.name[0]?.value}</h1>
<ProductShortDescription product={product} language="EN" />
{/* Full description, specs, etc. */}
</div>
);
}

Inside a product card layout

<div className="border rounded-lg p-4">
<img src={product.media?.[0]?.url} alt={product.name[0]?.value} />
<h3>{product.name[0]?.value}</h3>
<ProductShortDescription
product={product}
language="NL"
className="line-clamp-3"
/>
<AddToCart product={product} />
</div>

Configuration

Data

PropTypeRequiredDefaultDescription
productProduct | ClusterYesThe product or cluster object. The component reads the shortDescriptions field.

Localization

PropTypeRequiredDefaultDescription
languagestringNo'NL'Language code used to resolve the correct localized short description (e.g., 'EN', 'DE', 'FR').

Appearance

PropTypeRequiredDefaultDescription
classNamestringNo''Additional CSS class(es) applied to the root <div>. Appended after the default Tailwind classes.

Behavior

  • Conditional rendering: The component renders nothing when there is no short description content. No empty wrapper element is added to the DOM.
  • HTML content: The short description value is rendered as raw HTML using dangerouslySetInnerHTML. Content from the Propeller API may include HTML tags such as <p>, <strong>, <ul>, etc.
  • Reactivity: The component recomputes the displayed description whenever product or language changes.
  • Default styling: The root element includes Tailwind prose classes (prose prose-slate max-w-none text-muted-foreground) for consistent typography of HTML content. These can be extended or overridden via the className prop.
  • Type compatibility: Accepts both Product and Cluster objects since both share the shortDescriptions field structure.

SDK Services

This component does not call any SDK services directly. It reads data from a Product or Cluster object that has already been fetched.

Required product fields

FieldTypeDescription
shortDescriptionsLocalizedString[]Array of localized short description entries. Each entry has a language (string) and value (string, may contain HTML).

The LocalizedString type from propeller-sdk-v2:

interface LocalizedString {
language: string;
value: string;
}

Language resolution order

  1. Find an entry in shortDescriptions where language matches the language prop.
  2. If no match is found, fall back to the first entry in the array (shortDescriptions[0].value).
  3. If shortDescriptions is empty or missing, nothing is rendered.

GraphQL Queries and Mutations

When fetching products, include the shortDescriptions field:

query GetProduct($productId: Int!, $language: String) {
product(productId: $productId, language: $language) {
productId
name {
language
value
}
shortDescriptions {
language
value
}
}
}

For clusters:

query GetCluster($clusterId: Int!, $language: String) {
cluster(clusterId: $clusterId, language: $language) {
clusterId
name {
language
value
}
shortDescriptions {
language
value
}
}
}