Theme Playground

Storefront

TruncatedText

Expandable rich-text block that starts with a shorter preview and reveals the full body on demand.

Best for

long product descriptionseditorial previewsdense policy copy

Import

import { TruncatedText } from "@enadhq/enad-react-sdk/client/storefront"

When to use it

Use TruncatedText when the page has real long-form copy but should start with a tighter preview. It works well for product descriptions, editorial excerpts, and policy sections where the visitor may want the full text without navigating away.

If the content is always short, render the rich text directly instead of adding a read-more interaction.

Composition notes

html is the rendered body content. visibleLines controls how much of the content shows before the expand action appears, and labels lets you tune the expand and collapse copy for the page context.

Because the component renders HTML, keep the source content clean and predictable. Large nested markup will make the preview harder to judge and style consistently.

Behavior and theming guidance

Choose the initial line clamp based on intent. Product detail pages often need 2-4 lines, while editorial previews can sometimes start even shorter.

Use button labels that match the tone of the page. Read more is a safe default, but more contextual copy like Expand details or Show full policy can help when the content type is specific.

Examples

Live examples you can edit directly in the sandbox.

2 examples

Product description preview

A good default for long product copy that should start compact but still expand inline when needed.

Editorial excerpt

Use a shorter initial clamp when the page should tease longer editorial content without overwhelming the first screen.

Slots

contentrootpreviewtrigger

Component Sets

Preview the first example across the available component-set presets to compare tone, spacing, and structural defaults.

Props

PropTypeDefaultDescription
htmlstring
Pre-rendered HTML string to display inside the collapsible text block
visibleLinesnumber4
Number of lines visible before the "Read more" trigger
labelsstring
Override labels for the expand/collapse toggle
classNamesPartial<Record<import("@enadhq/enad-react-sdk/client/storefront/types").TruncatedTextSlot, string>>
No description yet.
Slot keys
contentrootpreviewtrigger
classNamestring
No description yet.