This page as markdown: /show-more.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

ShowMore

Status: stable

Collapsible content region that clips children to a collapsed height, fades the cut edge, and reveals the rest with a toggle.

Keywords: show more, disclosure, truncate, expand

Usage

Use ShowMore to reveal additional content after an intentionally shortened preview.

Best practices

Props

Name Type Default Description
collapsedHeight number 96 Collapsed height of the content region in px. The inner wrapper clips to this height until expanded. The toggle and fade only appear when the measured content is taller than this; content that already fits shows in full with no control. Expanding animates to the measured height.
collapsedLines number — Collapsed height as a count of the content's own lines (measured from its line height). Wins over collapsedHeight, and is the one to prefer: the preview keeps the same number of lines when the type scale or density changes, where a px height shows fewer as type grows.
children ReactNode — The content to collapse and reveal.
moreLabel string "Show more" The toggle's text while collapsed.
lessLabel string "Show less" The toggle's text while expanded.

Tokens used

background, foreground, ring

Motion

Accessibility

Related

Examples

Long paragraph

import { ShowMore } from "@sableui/react"

<ShowMore><p className="text-body-md text-foreground">A long paragraph that exceeds the collapsed height…</p></ShowMore>

Collapsed to a line count

import { ShowMore } from "@sableui/react"

<ShowMore collapsedLines={6}><p className="text-body-md text-foreground">{post.description}</p></ShowMore>