Skip to content

[WEB-4729] dev: propel scrollarea#7748

Merged
sriramveeraghanta merged 4 commits intopreviewfrom
dev-propel-scrollarea
Sep 9, 2025
Merged

[WEB-4729] dev: propel scrollarea#7748
sriramveeraghanta merged 4 commits intopreviewfrom
dev-propel-scrollarea

Conversation

@anmolsinghbhatia
Copy link
Collaborator

@anmolsinghbhatia anmolsinghbhatia commented Sep 9, 2025

Description

This PR introduces the scrollarea component in propel.

Media

Before
media

Summary by CodeRabbit

  • New Features

    • Introduced a ScrollArea component for scrollable content with customizable orientation (vertical/horizontal), size (sm/md/lg), and scroll visibility (always/scroll/hover).
  • Documentation

    • Added an interactive Storybook story showcasing ScrollArea variants, controls, and usage guidance.
  • Chores

    • Exposed the ScrollArea module in the package’s public exports for easier imports.
    • Included ScrollArea in the build entries to ensure it’s compiled and distributed.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 9, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Warning

Rate limit exceeded

@anmolsinghbhatia has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 12 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 7b3acfe and 9faafed.

📒 Files selected for processing (2)
  • packages/propel/src/scrollarea/scrollarea.stories.tsx (1 hunks)
  • packages/propel/src/scrollarea/scrollarea.tsx (1 hunks)

Walkthrough

Adds a new ScrollArea component, its barrel export, Storybook stories, build entry inclusion, and a package.json subpath export for distribution. No changes to existing modules.

Changes

Cohort / File(s) Summary
Public export mapping
packages/propel/package.json
Adds subpath export "./scrollarea": "./dist/scrollarea/index.js".
Build configuration
packages/propel/tsdown.config.ts
Adds src/scrollarea/index.ts to the tsdown entry array.
ScrollArea component
packages/propel/src/scrollarea/scrollarea.tsx, packages/propel/src/scrollarea/index.ts
Introduces ScrollArea component with orientation, size, and scrollType options; adds barrel export export * from "./scrollarea".
Storybook stories
packages/propel/src/scrollarea/scrollarea.stories.tsx
Adds Storybook meta and a Default story for ScrollArea with controls for orientation, size, scrollType, and className.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant App as App/UI
  participant SA as ScrollArea (propel)
  participant Base as @base-ui-components/react/scroll-area

  User->>App: Interact with scrollable content
  App->>SA: Render <ScrollArea orientation/size/scrollType>
  SA->>Base: Render Root + Viewport
  SA->>Base: Render ScrollBar (horizontal/vertical) + Thumb
  SA->>Base: Render Corner
  Note over SA,Base: Styling and behavior vary by size and scrollType
  Base-->>User: Scrolling behavior and visuals
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

🌟enhancement

Suggested reviewers

  • vamsikrishnamathala

Pre-merge checks (2 warnings, 1 inconclusive)

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The current PR description only includes a brief high-level description and a media section but omits the required “Type of Change,” “Test Scenarios,” and “References” sections from the repository’s description template and does not use the exact “Screenshots and Media” heading. Please update the PR description to include the “Type of Change” checklist, document the tests you ran under “Test Scenarios,” add any related issue or design links under “References,” and rename the “Media” section to “Screenshots and Media,” providing before/after visuals if applicable.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title “[WEB-4729] dev: propel scrollarea” references the scrollarea feature but lacks a clear action verb and reads more like a noun phrase, making it ambiguous whether the change introduces, updates, or removes functionality. Consider revising the title to a concise, descriptive sentence such as “Add ScrollArea component to Propel” to clearly convey the main intent of the changeset.

Poem

I built a lane where pixels glide,
A scroll-y stroll, both tall and wide.
With thumbs that track and corners neat,
I whisk through text on quiet feet.
Hop, hop—new paths in exports bloom,
My ears perk up—no more scroll-gloom!

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev-propel-scrollarea

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.

@makeplane
Copy link

makeplane bot commented Sep 9, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new scrollarea component to the propel design system. The component provides customizable scroll behavior with multiple size variants, orientations, and scroll type configurations.

  • Adds a new ScrollArea component with support for different sizes (sm, md, lg), orientations (horizontal, vertical), and scroll types (always, scroll, hover)
  • Includes comprehensive Storybook stories for component documentation and testing
  • Updates build configuration and package exports to include the new component

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/propel/src/scrollarea/scrollarea.tsx Main ScrollArea component implementation with props interface and styling logic
packages/propel/src/scrollarea/scrollarea.stories.tsx Storybook stories and documentation for the ScrollArea component
packages/propel/src/scrollarea/index.ts Export barrel file for the scrollarea module
packages/propel/tsdown.config.ts Adds scrollarea to build configuration entry points
packages/propel/package.json Adds scrollarea export path to package.json exports

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
packages/propel/src/scrollarea/scrollarea.stories.tsx (1)

88-101: Add a horizontal demo to validate track sizing and corner behavior

Include a second story to exercise orientation: "horizontal" and long-width content.

Apply:

 export const Default: Story = {
   args: {
     className: "h-64 w-80 border rounded-lg",
     size: "md",
     scrollType: "always",
     orientation: "vertical",
   },
   render: (args) => (
     <ScrollArea {...args}>
       <LongTextContent />
     </ScrollArea>
   ),
 };
+
+export const Horizontal: Story = {
+  args: {
+    className: "h-32 w-80 border rounded-lg",
+    size: "md",
+    scrollType: "always",
+    orientation: "horizontal",
+  },
+  render: (args) => (
+    <ScrollArea {...args}>
+      <div className="p-4 w-[60rem]">
+        This line is intentionally very wide to force horizontal overflow. Scroll sideways →
+      </div>
+    </ScrollArea>
+  ),
+};
packages/propel/src/scrollarea/scrollarea.tsx (2)

73-81: Apply orientation-specific margin to the track

mr-1 should only apply to vertical bars; add mb-1 for horizontal to avoid odd spacing.

-        "group/track mr-1 flex justify-center rounded bg-transparent opacity-0 transition-opacity delay-300 ",
+        "group/track flex justify-center rounded bg-transparent opacity-0 transition-opacity delay-300",
+        orientation === "vertical" && "mr-1",
+        orientation === "horizontal" && "mb-1",
         orientation === "vertical" && verticalSizeStyles[size],
         orientation === "horizontal" && horizontalSizeStyles[size],

16-36: Forward ref to Root for better composability

Forwarding the ref matches patterns used across libraries and enables focusing/measurement from consumers.

-function ScrollArea({
-  className,
-  children,
-  orientation,
-  scrollType,
-  size = "md",
-  ...props
-}: ScrollAreaProps) {
-  return (
-    <BaseScrollArea.Root data-slot="scroll-area" className={cn("relative", className)} {...props}>
+type ScrollAreaRootElement = React.ElementRef<typeof BaseScrollArea.Root>;
+const ScrollArea = React.forwardRef<ScrollAreaRootElement, ScrollAreaProps>(function ScrollArea(
+  { className, children, orientation, scrollType, size = "md", ...props },
+  ref
+) {
+  return (
+    <BaseScrollArea.Root
+      ref={ref}
+      data-slot="scroll-area"
+      className={cn("relative", className)}
+      {...props}
+    >
       <BaseScrollArea.Viewport
         data-slot="scroll-area-viewport"
         className="focus-visible:ring-ring/50 size-full overscroll-contain rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline"
       >
         {children}
       </BaseScrollArea.Viewport>
       <ScrollBar orientation={orientation} scrollType={scrollType} size={size} />
       <BaseScrollArea.Corner />
-    </BaseScrollArea.Root>
-  );
-}
+    </BaseScrollArea.Root>
+  );
+});
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 291101a and 7b3acfe.

📒 Files selected for processing (5)
  • packages/propel/package.json (1 hunks)
  • packages/propel/src/scrollarea/index.ts (1 hunks)
  • packages/propel/src/scrollarea/scrollarea.stories.tsx (1 hunks)
  • packages/propel/src/scrollarea/scrollarea.tsx (1 hunks)
  • packages/propel/tsdown.config.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build and lint web apps
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
packages/propel/package.json (1)

30-31: LGTM: public subpath export added correctly

The new "./scrollarea" export aligns with the tsdown entry and barrel index. No issues spotted.

packages/propel/src/scrollarea/index.ts (1)

1-1: LGTM: barrel export

Straightforward re-export; matches package.json subpath.

packages/propel/tsdown.config.ts (1)

16-16: LGTM: build entry added

src/scrollarea/index.ts is included in the build. Good placement.

packages/propel/src/scrollarea/scrollarea.stories.tsx (1)

1-2: No change required – this file’s Storybook types import from @storybook/react-vite matches all other stories in packages/propel and is consistent within that package.

packages/propel/src/scrollarea/scrollarea.tsx (1)

77-79: No adjustments needed for data-hovering and data-scrolling
Verified that @base-ui-components/react/scroll-area emits data-hovering and data-scrolling on the Scrollbar/Thumb exactly as used in the classes.

@sriramveeraghanta sriramveeraghanta merged commit fbd48c3 into preview Sep 9, 2025
6 of 7 checks passed
@sriramveeraghanta sriramveeraghanta deleted the dev-propel-scrollarea branch September 9, 2025 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants