Skip to content

feat(sheet): improve customizability with size prop, actions slot, and layout fixes#302

Merged
IzumiSy merged 8 commits into
mainfrom
feat/improve-sheet-customizability
Jun 5, 2026
Merged

feat(sheet): improve customizability with size prop, actions slot, and layout fixes#302
IzumiSy merged 8 commits into
mainfrom
feat/improve-sheet-customizability

Conversation

@IzumiSy

@IzumiSy IzumiSy commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Enhance the Sheet component to address several customizability and layout issues.

Changes

API

  • action prop on Sheet.Header — allows placing action buttons (save, edit, etc.) to the right of the title area

UI

  • size prop on Sheet.Content — supports sm (384px), md (512px), lg (720px), xl (960px), and full (100%) width variations for left/right side sheets
  • Sheet.Title font size — increased to text-lg for better visibility and hierarchy
  • Directional close icons — the close button now renders a directional chevron (ChevronsRight/Left/Up/Down) matching the sheet's slide direction instead of a generic X icon
  • Close button hover style — added bg-accent hover background matching the sidebar trigger style, replacing the previous opacity-based hover

Screen shots

Default

スクリーンショット 2026-06-04 10 54 26

Sheet with action prop

スクリーンショット 2026-06-04 10 54 02

Example

<Sheet.Root side="right">
  <Sheet.Trigger render={<Button />}>Open</Sheet.Trigger>
  <Sheet.Content size="lg">
    <Sheet.Header action={<Button size="sm">Save</Button>}>
      <Sheet.Title>Edit Record</Sheet.Title>
      <Sheet.Description>Update details.</Sheet.Description>
    </Sheet.Header>
    <div style={{ padding: "1rem" }}>{/* content */}</div>
  </Sheet.Content>
</Sheet.Root>

@IzumiSy

IzumiSy commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Generated by API Design Review for issue #302

Comment thread packages/core/src/components/sheet.tsx Outdated
Comment thread packages/core/src/components/sheet.tsx
IzumiSy added 3 commits June 3, 2026 15:06
…d layout fixes

- Add `size` prop to Sheet.Content for width variations (sm/md/lg/xl/full)
- Add `actions` prop to Sheet.Header for action buttons beside the title
- Increase Sheet.Title font size to text-lg for better hierarchy
- Move close button from absolute positioning into Header normal flow
- Wrap actions and close button in a shared items-center container
- Fix example body padding from '1rem 0' to '0 1rem' to match Header/Footer
@IzumiSy IzumiSy force-pushed the feat/improve-sheet-customizability branch from c2d693e to abe2ac9 Compare June 3, 2026 06:06
@IzumiSy IzumiSy self-assigned this Jun 3, 2026
IzumiSy added 5 commits June 3, 2026 15:50
- Replace XIcon with directional chevrons (ChevronsRight/Left/Up/Down) based on sheet side
- Add hover background style (bg-accent) to close button matching sidebar trigger style
- Remove opacity-based hover in favor of color-based transition
@erickteowarang

Copy link
Copy Markdown
Contributor

I don't necessarily have an issue with this change, but I do think we're adding action buttons everywhere haha, I'm a bit worried AI will get confused on which action goes where (and humans too)

@IzumiSy

IzumiSy commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

Fair point, though I don't think this will be a big concern in practice. Providing a dedicated actions slot is a pretty common pattern — Ant Design does it with extra/footer props on Drawer/Modal, MUI has <DialogActions>, Chakra has <Drawer.Footer>. Having the slot explicitly in the API actually makes it less-context for consumers since they don't need to think about where or how to place actions within the component's layout.

@erickteowarang

Copy link
Copy Markdown
Contributor

Yeah I don't think it's too much of a concern, maybe we just need to clarify in the skill what action belongs in which component? Depends how opinionated we want to be.

The change itself looks fine though :)

@IzumiSy IzumiSy merged commit 49f10e3 into main Jun 5, 2026
5 checks passed
@IzumiSy IzumiSy deleted the feat/improve-sheet-customizability branch June 5, 2026 01:44
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