Skip to content

Redesign Shell sidebar collapse, refactor Composer, and add Portal primitive#265

Merged
ankit-thesys merged 22 commits intothesysdev:mainfrom
ankit-thesys:feature/shell-sidebar-composer-redesign
Mar 20, 2026
Merged

Redesign Shell sidebar collapse, refactor Composer, and add Portal primitive#265
ankit-thesys merged 22 commits intothesysdev:mainfrom
ankit-thesys:feature/shell-sidebar-composer-redesign

Conversation

@ankit-thesys
Copy link
Copy Markdown
Contributor

@ankit-thesys ankit-thesys commented Mar 5, 2026

Summary

This PR implements a comprehensive redesign of the Shell component's sidebar collapse behavior, refactors the Composer into a shared component across all shell variants, and introduces a new Portal primitive.

Sidebar Collapse Redesign

  • Collapsed sidebar width reduced from 104px to 52px for a cleaner minimal state
  • Removed background color and full border; replaced with right-border only for a sleeker look
  • Logo transitions smoothly from 36px to 28px when collapsed
  • Toggle icons changed from PanelLeft/PanelRight to ArrowLeftFromLine/ArrowRightFromLine
  • SidebarHeader now accepts children prop, allowing NewChatButton to be placed inside the header for persistent visibility
  • NewChatButton renders as a compact IconButton (SquarePen) when sidebar is collapsed

Composer Refactor

  • Extracted inline Composer from Thread.tsx into dedicated components/Composer.tsx for Shell, CopilotShell, and BottomTray
  • New action-bar layout: textarea above, submit button (right) below
  • Custom scrollbar styling for all composer textareas
  • Added isLoadingMessages guard to prevent submission while messages are loading
  • Updated border, shadow, and spacing tokens for a more polished look

Composer textarea height fix

  • Fixed textarea collapsing to 0px height after sending a message in all layouts (Shell, CopilotShell, BottomTray, DesktopWelcomeComposer)
  • Root cause: useLayoutEffect set height: "auto" which collapsed the textarea inside flex containers with overflow: clip, causing scrollHeight to read 0
  • Fix: use height: "0px" instead of "auto" and Math.max(scrollHeight, 24) for a minimum one-line height

DesktopWelcomeComposer Updates

  • Simplified DOM structure (removed unnecessary wrapper div)
  • Added aria-label for accessibility

New Components

  • ThreadHeader: Desktop-only header bar for thread-level actions (e.g., Share button)
  • Portal: Thin wrapper around @radix-ui/react-portal for rendering content outside the DOM hierarchy

Header Customization Props

  • FullScreen: Added threadHeader (desktop-only header content) and mobileHeaderActions (mobile header right-side content) props
  • Copilot: Added headerActions prop for custom content in the header right side
  • BottomTray: Added headerActions prop for custom content in the header (before built-in thread list/new chat/minimize buttons)
  • All props use ReactNode type for maximum flexibility
  • Props flow through withChatProvider HOC via the existing generic parameter pattern

Storybook and Documentation

  • All Shell stories updated: NewChatButton in SidebarHeader, ThreadHeader with Share button, MobileHeader with rightChildren
  • Added StandaloneWithThreadHeader story demonstrating model selector + action buttons
  • Added WithThreadHeader story in Shell stories
  • Added CopilotWithHeaderActions and BottomTrayWithHeaderActions stories
  • Updated OpenUIChat.mdx with new "Header Customization" section and props tables for all layouts
  • Updated Shell.mdx with ThreadHeader and MobileHeader.rightChildren documentation

Test plan

  • Verify sidebar collapse/expand works correctly at 52px width
  • Verify NewChatButton renders as icon when collapsed, full button when expanded
  • Verify logo size transitions smoothly between states
  • Verify submit is disabled while messages are loading
  • Verify composer textarea maintains proper height after sending a message
  • Verify ThreadHeader is hidden on mobile, visible on desktop
  • Verify threadHeader prop renders custom content in FullScreen desktop header
  • Verify mobileHeaderActions renders in FullScreen mobile header
  • Verify headerActions renders in Copilot and BottomTray headers
  • Verify Portal renders content into document.body (check DOM)
  • Run Storybook and verify all Shell, CopilotShell, BottomTray, and OpenUIChat stories render correctly
  • Run pnpm build in packages/react-ui (verified passing)
  • Run pnpm lint:check in packages/react-ui (verified: 0 errors, only pre-existing warnings)

…imitive

- Sidebar collapse: reduce width to 52px, remove background/full border,
  add smooth logo transition (36px to 28px), new toggle icons
- NewChatButton: render as IconButton when sidebar is collapsed
- SidebarHeader: accept children prop for flexible layout
- Composer: extract into components/ for Shell, CopilotShell, and BottomTray;
  add attachment prop, action-bar layout, scrollbar styling, isLoadingMessages guard
- DesktopWelcomeComposer: same attachment support and layout improvements
- ThreadHeader: new component for desktop-only header actions
- Portal: new component wrapping @radix-ui/react-portal
- Update all Storybook stories with new patterns

Made-with: Cursor
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 5, 2026

@ankit-thesys is attempting to deploy a commit to the thesys-devs Team on Vercel.

A member of the Team first needs to authorize it.

…to feature/shell-sidebar-composer-redesign
ankit-thesys and others added 4 commits March 16, 2026 14:44
…to feature/shell-sidebar-composer-redesign
- Add `threadHeader` (desktop) and `mobileHeaderActions` props to FullScreen
- Add `headerActions` prop to Copilot and BottomTray layouts
- Fix composer textarea collapsing to 0px height in all layouts
  (use height: 0px instead of auto for scrollHeight measurement)
- Add Storybook stories demonstrating header customization
- Update MDX docs with header customization section and props tables

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@@ -0,0 +1,8 @@
import { Portal as RadixPortal } from "@radix-ui/react-portal";
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.

this is not needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed the portal component

@ankit-thesys ankit-thesys merged commit e1cedde into thesysdev:main Mar 20, 2026
1 of 2 checks passed
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