Skip to content

XDSSheet / XDSDrawer — slide-out panel (318 combined usages) #575

Closed

Description

@cixzhang

other internal library → XDS Migration Gap

other internal library usage count: 318 combined (Sheet: 299, Drawer: 19)

What it does

Slide-out panel that enters from a screen edge (bottom, right, left, top). Common patterns:

  • Mobile navigation — slide from left/bottom
  • Detail panels — slide from right to show item details without leaving context
  • Filters — slide from right/bottom with filter controls
  • Action sheets — slide from bottom on mobile (iOS-style)

other internal library has both Sheet and Drawer as separate components, but they are functionally similar — both are edge-anchored overlay panels with different default behaviors.

other internal library API shape

  • Sheet: full-height side panel, typically from right
  • Drawer: typically from bottom, often with drag-to-dismiss
  • Both support: side (left/right/top/bottom), isOpen/onOpenChange, overlay backdrop

Approach considerations

  1. Variant of XDSDialog — XDSDialog already handles overlay + focus trap. A variant="sheet" or placement="right" prop could make it slide from edges. Keeps the component count low.
  2. Standalone XDSSheet — Separate component with edge-specific animations and sizing. Allows different dismiss behaviors (swipe to dismiss for bottom sheets).
  3. Single component with side prop — XDSSheet with side="right|left|top|bottom" covering both sheet and drawer patterns. Bottom variant gets swipe-to-dismiss.

Key behaviors

  • Edge-anchored (not centered like Dialog)
  • Slide-in/out animation from the specified edge
  • Backdrop overlay with click-to-dismiss
  • Focus trap while open
  • Optional swipe/drag to dismiss (especially bottom sheet)
  • Responsive: may switch from side to bottom on mobile

Context

Part of the other internal library → XDS OSS migration effort. 318 combined usages across Sheet and Drawer in other internal library. Mobile-first apps particularly depend on this pattern.

Activity

  1. added
    enhancement
    component
    on Mar 12, 2026
  2. added this to the milestone on Mar 12, 2026
  3. cixzhang commented on Mar 12, 2026

    @cixzhang
    ContributorAuthor

    📋 Protocol Required

    This component must go through the full specification and build protocols before implementation:

    1. Specification Protocol — Research → Draft Spec → Surface Area Audit → Spec Review → Vibe Test (if needed) → Finalize
    2. Build Protocol — Setup → Foundation → System Integration Check → Implementation → Stories → Tests → Docs → PR → Self-Review

    No code without an approved spec. No PR without a self-review.

  4. cixzhang commented on Mar 14, 2026

    @cixzhang
    ContributorAuthor

    📋 Component Spec: XDSSheet

    Architecture Decision

    Standalone XDSSheet component that composes XDSDialog internally.

    • Sheet has fundamentally different animation (slide vs scale), positioning (edge-anchored vs centered), and sizing (full-height/width vs constrained)
    • Single XDSSheet component covers both "sheet" and "drawer" patterns — side prop handles all four edges
    • Named XDSSheet not XDSDrawer — matches dominant other internal library usage (299 vs 19), aligns with Apple/Google/shadcn naming

    API

    import {XDSSheet} from '@xds/core/Sheet';
    
    // Detail panel (most common — right side)
    <XDSSheet isOpen={isOpen} onOpenChange={setIsOpen}>
      <XDSLayout
        header={<XDSDialogHeader title="Details" onOpenChange={setIsOpen} />}
        content={<XDSLayoutContent>Content here</XDSLayoutContent>}
      />
    </XDSSheet>
    
    // Left navigation
    <XDSSheet isOpen={isOpen} onOpenChange={setIsOpen} side="left" size="sm">
      <nav>...</nav>
    </XDSSheet>
    
    // Bottom action sheet
    <XDSSheet isOpen={isOpen} onOpenChange={setIsOpen} side="bottom" height="auto">
      <XDSLayout
        header={<XDSDialogHeader title="Share" onOpenChange={setIsOpen} />}
        content={<XDSLayoutContent>Actions</XDSLayoutContent>}
      />
    </XDSSheet>

    Props

    Prop Type Default Description
    isOpen boolean (required) Whether the sheet is open
    onOpenChange (isOpen: boolean) => unknown (required) Visibility change callback
    side 'left' | 'right' | 'top' | 'bottom' 'right' Edge the sheet slides from
    size 'sm' | 'md' | 'lg' 'md' Preset size (width for sides, height for top/bottom)
    width number | string — Custom width (overrides size for left/right)
    height number | string — Custom height (overrides size for top/bottom, 'auto' for content-fit)
    purpose 'info' | 'form' | 'required' 'info' Dismissal behavior (inherited from Dialog)
    children ReactNode (required) Sheet content

    Size Presets

    Size Left/Right Width Top/Bottom Height
    sm 320px 25vh
    md 400px 40vh
    lg 560px 60vh

    Left/right sheets are always full viewport height. Top/bottom are always full viewport width.

    Key Decisions

    1. Single component, four directions. No separate Sheet + Drawer. The side prop covers all edges. Bottom sheet = side="bottom". Matches 299:19 usage ratio.

    2. Slide animation, not scale. Each side has its own translateX/Y animation. Left slides from left, right from right, etc. Uses transitionVars['--transition-normal'].

    3. No swipe-to-dismiss (v1). Touch gesture handling, snap points, and physics animation are complex. Not required for initial migration. Future: isSwipeDismissible?: boolean without breaking changes.

    4. purpose prop inherited from Dialog. Same three values (info, form, required) control dismissal identically. Consistent mental model.

    5. Edge-specific border radius. Sheet sits flush against viewport edge with radius only on the interior corners.

    6. height: 'auto' for content-driven bottom sheets. Bottom action sheets commonly size to content. maxHeight: 90vh prevents overflow.

    7. No non-modal variant. Persistent side panels are handled by SideNav. Sheet is always a modal overlay.

    External Research Summary

    System Name Sides Sizes Swipe
    shadcn Sheet (Dialog) + Drawer (Vaul) 4 sides Consumer variants Drawer only
    Ant Design Drawer 4 sides 'default' | 'large' + custom No
    MUI Drawer 4 anchors Consumer No
    Chakra Drawer 4 placements xs-full presets No

    Exports

    • XDSSheet (component)
    • XDSSheetProps, XDSSheetSide, XDSSheetSize (types)

    No overlap with existing Dialog exports. Clean addition.

    Composition Examples

    // Filter panel with form protection
    <XDSSheet isOpen={isOpen} onOpenChange={setIsOpen} purpose="form" size="sm">
      <XDSLayout
        header={<XDSDialogHeader title="Filters" onOpenChange={setIsOpen} />}
        content={
          <XDSLayoutContent>
            <XDSFormLayout>
              <XDSSelector label="Status" options={statusOptions} />
            </XDSFormLayout>
          </XDSLayoutContent>
        }
        footer={
          <XDSLayoutFooter hasDivider>
            <XDSButton variant="secondary" label="Reset" onClick={handleReset} />
            <XDSButton variant="primary" label="Apply" onClick={handleApply} />
          </XDSLayoutFooter>
        }
      />
    </XDSSheet>
    
    // Large content panel
    <XDSSheet isOpen={isOpen} onOpenChange={setIsOpen} size="lg">
      <XDSLayout
        header={<XDSDialogHeader title="Preview" onOpenChange={setIsOpen} />}
        content={<XDSLayoutContent><pre>{content}</pre></XDSLayoutContent>}
      />
    </XDSSheet>
  5. removed this from the milestone on Jun 23, 2026
  6. self-assigned this
    on Jul 28, 2026
  7. added a commit that references this issue on Jul 30, 2026
    64063c8
  8. cixzhang commented on Sep 2, 2026

    @cixzhang
    ContributorAuthor

    Thanks for filing this and for the detailed component sketch in the thread—it shaped what was built. The pattern now ships as BottomSheet for the bottom edge (#4468, #4519) and Drawer for start/end edges, with both included in the current overlay-dismissal family. The earlier Sheet attempt #3695 closed unmerged; the remaining naming and integration questions are active in #3675 with #5550. Closing this issue as superseded by that canonical thread; a top-anchored panel remains the one case to raise there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

componentenhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions