Skip to main content

CategoryShortDescription

Renders a category's short description. Resolves the correct language entry from the Propeller Category object and renders it as HTML. Unlike CategoryDescription, this component has no truncation or toggle -- it always renders the full short description.

Usage

Basic

import CategoryShortDescription from "@/components/propeller/CategoryShortDescription";

<CategoryShortDescription category={category} language="NL" />

Below a category title

<GridTitle
title={categoryName}
language={process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE || "NL"}
/>
<CategoryShortDescription
category={category}
language={process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE || "NL"}
/>

Custom styling

<CategoryShortDescription
category={category}
language="NL"
className="border-b pb-4"
/>

Paired with CategoryDescription on a category page

<CategoryShortDescription category={category} language="NL" />
<ProductGrid ... />
<CategoryDescription category={category} language="NL" maxLength={300} />

Configuration

Data

PropTypeRequiredDefaultDescription
categoryCategoryNoPropeller Category object. The component reads the shortDescription array of LocalizedString items
languagestringYesLanguage code (e.g. "NL", "EN") used to match the correct LocalizedString entry

Styling

PropTypeRequiredDefaultDescription
classNamestringNoExtra CSS class applied to the root div

Behavior

Language resolution

  1. Reads category.shortDescription -- an array of LocalizedString objects ({ language, value })
  2. Finds the entry where language matches the language prop
  3. Returns the value (HTML string), or an empty string if no match is found

Empty state

When the short description is empty (no category prop, no matching language entry, or an empty value), the component renders nothing -- no wrapper element is added to the DOM.

Styling details

  • Root element: mb-6 bottom margin
  • Description text: prose prose-slate max-w-none text-muted-foreground

Comparison with CategoryDescription

FeatureCategoryShortDescriptionCategoryDescription
Source fieldcategory.shortDescriptioncategory.description
TruncationNoYes (configurable via collapsed and maxLength)
"Read more" toggleNoYes
Use caseBrief summary below titleFull description with expand/collapse

SDK Services

This component does not call any SDK service directly. It expects a Category object to be passed via props (typically fetched by CategoryService.getCategory() or a direct GraphQL query).

Category fields read

FieldSDK TypeDescription
shortDescriptionLocalizedString[]Array of { language: string; value: string } entries. The component finds the entry matching the language prop and renders its value as HTML

GraphQL Queries and Mutations

When fetching a category, include the shortDescription field to supply this component with data:

query GetCategory($categoryId: Int!, $language: String) {
category(id: $categoryId) {
categoryId
name(language: $language) {
language
value
}
shortDescription(language: $language) {
language
value
}
}
}

The returned shortDescription array is passed directly as category.shortDescription.