feat(CopySnippet, PrismCode): add an isWrapped prop to soft-wrap long content - #1335
Merged
Conversation
By default CopySnippet keeps each line on one line and scrolls horizontally, which pushes long error messages and logs off to the right. `wrap` lays the content out on multiple lines instead: the block grows vertically to fit (so even a single very long line is fully readable rather than clamped to the collapsed height), and unbreakable runs like URLs, tokens and identifiers wrap too (overflow-wrap: anywhere), not just spaces. It reuses the existing multiline block layout and only adds white-space handling on the inner <code>, so behaviour is unchanged when the prop is unused. `nowrap` still wins. `wrap` is omitted from the inherited Card container styles (it maps to flex-wrap, meaningless on this grid-based component) so the name can carry the boolean prop. Also fixes the docs, which showed a non-existent `multiline` prop. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: a860751 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📦 NPM canary releaseDeployed canary version 0.0.0-canary-f040419. |
Contributor
🧪 Storybook is successfully deployed!
|
Contributor
🏋️ Size limit report
Compared against main at ac2ec33 — run 32379233171, 2026-08-20T14:17:23Z.To see which modules changed, download the size-limit-statoscope-report artifact from this run and open report.html. |
tenphi
approved these changes
Aug 20, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an
isWrappedprop toPrismCodeandCopySnippetthat soft-wraps long content onto multiple lines instead of scrolling it horizontally.By default both components keep each line on one line and scroll sideways, which buries long error messages and logs off to the right.
isWrappedlays the content out on multiple lines: unbreakable runs like URLs, tokens and identifiers break too (overflow-wrap: anywhere), not just spaces. OnCopySnippetthe block additionally grows vertically to fit — so even a single very long line is fully readable rather than clamped to the collapsed single-line height.Why
Cube Cloud CUB-4032 — long error messages shown in
PrismCode/CopySnippetforce horizontal scrolling. The wrap belongs in the components: the global Prism CSS pinswhite-space: preoncode[class*="language-"], so it cannot be reliably overridden from outside, andCopySnippetadditionally clamps the single-line height.Design
PrismCodeowns the wrapping (white-space: pre-wrap+overflow-wrap: anywhereon itsCodesub-element, keyed on awrappedmod).CopySnippetforwards the prop to its innerPrismCodeand only adds its own layout switch (auto height, multiline button placement).isWrappedfollows the library'sis*boolean convention (isDisabled,isLoading,isClearable, …) and avoids reading as the opposite ofCopySnippet'snowrap— the two are different axes:nowrapcollapses real newlines into one scrolling line,isWrappedbreaks long lines.nowrapwins when both are set.Wrappedstories for both components, a unit test for thewrappedmod, and a changeset (minor).Verified in a real browser (Storybook) across corner cases: short/empty code,
nowrapconflict, multiline + long lines, no-space tokens (JWT),hideTextbullets,prefix, explicitheight(clamps + scrolls vertically),serif, custom actions, CRLF input.🤖 Generated with Claude Code
Note
Cursor Bugbot is generating a summary for commit a860751. Configure here.