nextui icon indicating copy to clipboard operation
nextui copied to clipboard

refactor(docs): component preview performance

Open tianenpang opened this issue 1 month ago โ€ข 6 comments

Closes #

๐Ÿ“ Description

Refactors documentation component previews for better performance and optimizes Select component styling.

โ›ณ๏ธ Current behavior (updates)

  • Select component indicator uses translate for positioning.
  • Documentation contains duplicate Select examples.
  • data-focus ring styles are present in some contexts where they may be unnecessary.
  • Component previews in documentation have potential performance bottlenecks.

๐Ÿš€ New behavior

  • Uses flex layout instead of translate for Select indicator positioning.
  • Removes duplicate Select examples from documentation.
  • Removes data-focus ring styles.
  • Optimizes component preview rendering performance in documentation.

Code Block: Implements a lightweight placeholder strategy for collapsed code blocks. Instead of rendering the full code immediately, only a small highlighted snippet (first 5 lines) is rendered initially to significantly reduce DOM nodes.

CSS Optimization: Applies advanced CSS containment properties to ComponentPreviewContainer to isolate layout calculation and enable browser-native lazy rendering:

  • contain - isolates the component's style, layout, and paint from the rest of the page.
  • content-visibility - skips rendering work for off-screen previews.
  • contain-intrinsic-size - reserves space to prevent layout shifts when content is skipped.

๐Ÿ’ฃ Is this a breaking change (Yes/No):

No.

๐Ÿ“ Additional Information

Before After

tianenpang avatar Dec 09 '25 17:12 tianenpang

โš ๏ธ No Changeset found

Latest commit: 352902bfb9cf7fb8086ff92e8a6867e5ce5918cc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Dec 09 '25 17:12 changeset-bot[bot]

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
heroui Ready Ready Preview Comment Dec 10, 2025 7:24pm
heroui-sb Ready Ready Preview Comment Dec 10, 2025 7:24pm

vercel[bot] avatar Dec 09 '25 17:12 vercel[bot]

[!IMPORTANT]

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

โœจ Finishing touches
๐Ÿงช Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch refactor/preview-performance

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

โค๏ธ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Dec 09 '25 17:12 coderabbitai[bot]

Open in StackBlitz

npm i https://pkg.pr.new/heroui-inc/heroui/@heroui/react@5975
npm i https://pkg.pr.new/heroui-inc/heroui/@heroui/styles@5975

commit: 352902b

pkg-pr-new[bot] avatar Dec 09 '25 17:12 pkg-pr-new[bot]