feat!: externalize sidebar toggle and remove navOpen state from the SDK#3088
Open
feat!: externalize sidebar toggle and remove navOpen state from the SDK#3088
Conversation
… rendered The expand button in ChannelHeader is pointless when there is no ChannelList in the component tree. Use the existing ChannelListContext to detect whether a ChannelList is present and conditionally render the button.
|
Size Change: -3.28 kB (-0.53%) Total Size: 610 kB 📦 View Changed
ℹ️ View Unchanged
|
Verify the button is hidden without ChannelList and shown with it. Update existing tests to provide ChannelListContext where needed.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3088 +/- ##
=======================================
Coverage 79.57% 79.58%
=======================================
Files 426 423 -3
Lines 12181 12107 -74
Branches 3914 3887 -27
=======================================
- Hits 9693 9635 -58
+ Misses 2488 2472 -16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…nent Remove ToggleSidebarButton from the SDK and replace it with a SidebarToggle slot in ComponentContext. Apps provide their own toggle component via WithComponents; the SDK renders it in the appropriate header slots with conditional visibility: - ChannelHeader/ThreadHeader: render when sidebar is collapsed - ChannelListHeader: render when a channel is active - ThreadListHeader: render when a thread is active Also removes IconSidebar (moved to vite example), MenuIcon prop from ChannelHeader/ThreadHeader, and ToggleButtonIcon prop from ChannelListHeader/ThreadListHeader.
MartinCupela
reviewed
Apr 6, 2026
BREAKING CHANGE: The SDK no longer manages sidebar visibility. The following public APIs have been removed: - `ChatContextValue.navOpen`, `closeMobileNav`, `openMobileNav` - `ChatProps.initialNavOpen` - `NAV_SIDEBAR_DESKTOP_BREAKPOINT` exported constant - `useMobileNavigation` exported hook Sidebar toggle is now fully app-owned. Apps provide a `SidebarToggle` component via `WithComponents` and manage their own open/close state. The vite example app demonstrates this with a new `SidebarContext` that replaces the SDK's nav state. Also removes all navOpen-dependent CSS classes and SCSS rules from the SDK, and deletes `useMobileNavigation` and `useIsMobileViewport` hooks.
…Content Split the single SidebarToggle slot into two generic slots: - HeaderStartContent: rendered at the start of content headers (ChannelHeader, ThreadHeader) - HeaderEndContent: rendered at the end of sidebar headers (ChannelListHeader, ThreadListHeader) These are position-aware, generic slots that can serve any purpose (sidebar toggle, breadcrumbs, back button, etc.).
# Conflicts: # src/components/Icons/icons.tsx
MartinCupela
approved these changes
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Goal
The SDK currently couples itself to a specific layout pattern (collapsible sidebar) by owning
navOpenstate inChatContext. This creates problems — e.g., the sidebar toggle renders even when no sidebar exists — and prevents apps from fully controlling their own layout.This PR removes all sidebar state management from the SDK and makes the app fully responsible for sidebar visibility.
🛠 Implementation details
Sidebar toggle externalized (commit 1-3):
ToggleSidebarButtoncomponent from the SDKSidebarToggleslot toComponentContext— apps provide their own toggle viaWithComponentsIconSidebar(moved to vite example),MenuIconprop,ToggleButtonIconpropnavOpen state removed (commit 4):
navOpen,closeMobileNav,openMobileNavfromChatContextValueinitialNavOpenfromChatPropsNAV_SIDEBAR_DESKTOP_BREAKPOINTconstant,useMobileNavigationhook,useIsMobileViewporthooksetActiveChannelThreadListItemUIopenMobileNavcalls fromChatViewSelectorbuttonsVite example updated:
SidebarContext(SidebarProvider+useSidebar) replaces SDK nav stateSidebarToggleuses app-level sidebar statesidebarOpenfrom app context🎨 UI Changes
No visual changes in the vite example — sidebar toggle behavior is identical. Apps that don't provide a
SidebarTogglewill have no toggle button in any header.ChatContextValue.navOpenChatContextValue.closeMobileNav/openMobileNavChatProps.initialNavOpenNAV_SIDEBAR_DESKTOP_BREAKPOINTuseMobileNavigationhookToggleSidebarButtoncomponentSidebarToggleviaWithComponentsMenuIcon/ToggleButtonIconpropsSidebarToggleslot instead