facebook / facebook/astryx

AppShell: support collapsing sidenav to zero width with animation

Open
#2,331 0 comments 0 reactions 1 assignee Claimed by @cixzhang View on GitHub
component enhancement
Dominant language
TypeScript
Stars
13.2k
Forks
1.1k
Avg merge
1d 14h
Merged PRs (30d)
669

Description

## Problem

When using `isSideNavCollapsed` on `XDSAppShell`, the sidenav collapses to a narrow icon rail rather than fully hiding. There's no option to collapse to 0 width (completely hidden), and no built-in transition animation on the width change.

## Desired behavior

1. **Collapse to zero**: When an external button controls collapse, the sidenav should be able to fully disappear (0 width) rather than leaving a rail.
2. **Animated transition**: The width change should animate smoothly (e.g., `transition: width 175ms cubic-bezier(0.24, 1, 0.4, 1)`).

## Proposed API

```tsx

```

Or via the SideNav `collapsible` config:

```tsx
collapsible={{
isCollapsed,
onCollapsedChange,
hasButton: false,
collapsedWidth: 0, // fully hidden
animated: true,
}}
```

## Context

Chat interfaces often want a full-width content area with an optional session list that slides away completely. The icon rail is useful for dashboard apps but not for focused single-pane UIs.

## Workaround

CSS overrides targeting `.xds-app-shell-sidenav` with `width: 0 !important` and custom transitions via a wrapper class.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.