Skip to content

feat(ui): add Sheet component#274

Merged
kylengn merged 3 commits intomainfrom
feat/sheet
Dec 30, 2025
Merged

feat(ui): add Sheet component#274
kylengn merged 3 commits intomainfrom
feat/sheet

Conversation

@kylengn
Copy link
Contributor

@kylengn kylengn commented Dec 30, 2025

Summary by CodeRabbit

  • New Features

    • Sheet component: A new slide-in overlay panel with configurable sides (left, right, top, bottom) and composable header, footer, and body sections.
    • SelectContent now supports an optional container prop for custom portal mounting.
  • Documentation

    • Added Storybook stories demonstrating Sheet variants including left-aligned layouts, custom close button behaviors, and scrollable content handling.

✏️ Tip: You can customize this high-level summary in your review settings.

@kylengn kylengn self-assigned this Dec 30, 2025
Copilot AI review requested due to automatic review settings December 30, 2025 06:57
@vercel
Copy link

vercel bot commented Dec 30, 2025

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

Project Deployment Review Updated (UTC)
react-ui Ready Ready Preview, Comment Dec 30, 2025 7:27am

@coderabbitai
Copy link

coderabbitai bot commented Dec 30, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

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.

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.

Walkthrough

The pull request introduces a new Sheet component—a Radix Dialog-based sliding overlay UI element with configurable sides and full subcomponent composition. Minor enhancements to existing components include replacing a hard-coded Esc label with a reusable Kbd component in ModalHeader and adding an optional container prop to SelectContent. The Sheet is exported at the library's public entry point and documented with five Storybook stories.

Changes

Cohort / File(s) Summary
Sheet Component Core
libs/react/ui/src/components/sheet/sheet.tsx, libs/react/ui/src/components/sheet/index.ts, libs/react/ui/src/components/index.ts
New Sheet component system built on Radix DialogPrimitive, including 11 exported subcomponents (Trigger, Portal, Overlay, Content, Header, Footer, Title, Description, Body, Close) and two styled variants; re-exported at package's public entry point.
Sheet Documentation
libs/react/ui/src/components/sheet/sheet.stories.tsx
Five interactive Storybook stories (Default, LeftSide, SettingsForm, WithoutCloseButton, LongContent) with automated visual regression screenshots; includes openSheetAndScreenshot play helper.
Component Enhancements
libs/react/ui/src/components/modal/modal.tsx, libs/react/ui/src/components/select/select.tsx
Modal: Replaced hard-coded <kbd>Esc</kbd> element with Kbd component. Select: Added optional container?: HTMLElement | null prop to SelectContent for custom portal mounting.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • EnzalRad
  • dvxam
  • noe-charmet

Poem

🐰 A sliding sheet emerges, oh what delight!
Dialog primitives dancing, side left or right,
Headers and footers compose, stories take flight,
Modal's Esc in fancy Kbd now shines bright! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
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.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately summarizes the main change: introducing a new Sheet component to the UI library with clear, concise phrasing.

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.

Copy link

@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: 0

🧹 Nitpick comments (1)
libs/react/ui/src/components/sheet/sheet.tsx (1)

122-156: Consider making the breakpoint configurable.

The useMediaQuery hook uses a hard-coded breakpoint '(min-width: 768px)', while the similar ModalHeader component receives it as a prop via context. For consistency and flexibility, consider accepting a breakpoint prop or using a shared context pattern like Modal does.

💡 Optional: Make breakpoint configurable
-function SheetHeader({
+function SheetHeader({
+  breakpoint = '(min-width: 768px)',
   className,
   showEscIndicator = true,
   showClose = true,
   children,
   ...props
-}: SheetHeaderProps) {
-  const isDesktop = useMediaQuery('(min-width: 768px)');
+}: SheetHeaderProps & {breakpoint?: string}) {
+  const isDesktop = useMediaQuery(breakpoint);

Alternatively, you could introduce a SheetContext similar to ModalContext to share configuration across all Sheet subcomponents.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 23f1000 and 2899ee7.

📒 Files selected for processing (6)
  • libs/react/ui/src/components/index.ts
  • libs/react/ui/src/components/modal/modal.tsx
  • libs/react/ui/src/components/select/select.tsx
  • libs/react/ui/src/components/sheet/index.ts
  • libs/react/ui/src/components/sheet/sheet.stories.tsx
  • libs/react/ui/src/components/sheet/sheet.tsx
🧰 Additional context used
📓 Path-based instructions (1)
**/*

⚙️ CodeRabbit configuration file

We handle errors at the edge of our applications in most cases. Do not recommend to add error handling around every single function. We prefer them to bubble up and be handled at upper layers.

Files:

  • libs/react/ui/src/components/index.ts
  • libs/react/ui/src/components/modal/modal.tsx
  • libs/react/ui/src/components/select/select.tsx
  • libs/react/ui/src/components/sheet/index.ts
  • libs/react/ui/src/components/sheet/sheet.tsx
  • libs/react/ui/src/components/sheet/sheet.stories.tsx
🧬 Code graph analysis (3)
libs/react/ui/src/components/modal/modal.tsx (1)
libs/react/ui/src/components/kbd/kbd.tsx (1)
  • Kbd (6-20)
libs/react/ui/src/components/sheet/sheet.tsx (4)
libs/react/ui/src/hooks/useMediaQuery.ts (1)
  • useMediaQuery (71-87)
libs/react/ui/src/components/kbd/kbd.tsx (1)
  • Kbd (6-20)
libs/react/ui/src/components/button/button.tsx (1)
  • Button (50-91)
libs/react/ui/src/components/icon/icon.tsx (1)
  • Icon (86-90)
libs/react/ui/src/components/sheet/sheet.stories.tsx (6)
libs/react/ui/src/components/sheet/sheet.tsx (7)
  • Sheet (218-218)
  • SheetTrigger (221-221)
  • SheetContent (223-223)
  • SheetHeader (224-224)
  • SheetTitle (226-226)
  • SheetDescription (227-227)
  • SheetFooter (225-225)
libs/react/ui/src/components/button/button.tsx (1)
  • Button (50-91)
libs/react/ui/src/components/typography/text.tsx (1)
  • Text (27-50)
libs/common/config/src/index.ts (1)
  • email (12-12)
libs/react/ui/src/components/label/label.tsx (1)
  • Label (13-15)
libs/react/ui/src/components/input/input.tsx (1)
  • Input (24-43)
⏰ 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: Agent
  • GitHub Check: Continuous integration
🔇 Additional comments (9)
libs/react/ui/src/components/modal/modal.tsx (1)

5-5: LGTM! Good refactor to use the reusable Kbd component.

Replacing the hard-coded <kbd> element with the reusable Kbd component improves consistency across the UI library and centralizes styling.

Also applies to: 207-207

libs/react/ui/src/components/select/select.tsx (1)

96-106: LGTM! Container prop enables flexible portal mounting.

The addition of the optional container prop allows consumers to control where the select dropdown is rendered in the DOM, which is useful for avoiding z-index conflicts or integrating with other overlay systems.

libs/react/ui/src/components/sheet/sheet.tsx (3)

10-46: LGTM! Well-structured variant system for the Sheet component.

The overlay and content variants provide clear animation states and support all four side positions (top, bottom, left, right) with appropriate transitions and borders.


88-115: LGTM! SheetContent correctly implements portal and overlay composition.

The component properly wraps content in a portal with optional container support, renders the overlay, and applies the appropriate variant classes. The internal structure with shadow insets matches the Modal pattern.


200-215: LGTM! SheetBody properly handles scrolling content.

The component correctly applies flex-1 for growth, overflow-y-auto for vertical scrolling, and includes the scrollbar class for styled scrollbars.

libs/react/ui/src/components/index.ts (1)

28-28: LGTM! Sheet component properly exported.

The barrel export is correctly positioned alphabetically and makes the Sheet component available in the public API.

libs/react/ui/src/components/sheet/index.ts (1)

1-1: LGTM! Standard barrel export pattern.

The re-export makes all Sheet components and types available from the sheet module index.

libs/react/ui/src/components/sheet/sheet.stories.tsx (2)

24-44: LGTM! Well-designed reusable helper for story play functions.

The openSheetAndScreenshot helper eliminates code duplication across stories and provides consistent visual regression testing. The step-by-step approach with proper waiting ensures stable screenshots.


58-277: LGTM! Comprehensive story coverage for the Sheet component.

The five stories effectively demonstrate:

  • Default right-side sheet with header, body, and footer
  • Left-side variant
  • Practical form usage
  • Header without close button
  • Long scrollable content

This provides excellent documentation and visual regression coverage for the component.

@argos-ci
Copy link

argos-ci bot commented Dec 30, 2025

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 12 changed, 10 added Dec 30, 2025, 7:29 AM

Copy link

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 Sheet component to the UI library, providing a slide-in panel interface built on top of Radix UI's Dialog primitive. The Sheet component follows established patterns from the existing Modal component and integrates with the design system's styling tokens.

Key Changes:

  • Added a fully-featured Sheet component with customizable slide directions (top, bottom, left, right)
  • Refactored Modal component to use the new Kbd component for keyboard shortcut indicators
  • Extended Select component to support custom container prop for portal rendering

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
libs/react/ui/src/components/sheet/sheet.tsx Main Sheet component implementation with subcomponents (Header, Footer, Body, Title, Description) and variant styling
libs/react/ui/src/components/sheet/sheet.stories.tsx Comprehensive Storybook stories demonstrating various Sheet configurations and use cases
libs/react/ui/src/components/sheet/index.ts Barrel export for Sheet components
libs/react/ui/src/components/modal/modal.tsx Refactored to use shared Kbd component instead of inline kbd element
libs/react/ui/src/components/select/select.tsx Added container prop to SelectContent for custom portal rendering
libs/react/ui/src/components/index.ts Added Sheet to component exports

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kylengn kylengn merged commit f0cb5c5 into main Dec 30, 2025
5 checks passed
@kylengn kylengn deleted the feat/sheet branch December 30, 2025 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants