Shell
The Shell component is a complete layout engine for building application interfaces. It manages layout state, composition rules, and responsive behavior across seven core slots: Header, Rail, Panel, Sidebar, Content, Inspector, and Bottom.
Installation
shellUsage
tsxAnatomy
Shell is a compound component with the following parts:
tsxRoot Props
The Root component manages the overall shell layout and provides context to child components.
Header Props
Fixed header at the top of the shell for global navigation and branding.
Sidebar Props
Unified navigation sidebar with three states: collapsed, thin, and expanded. Cannot coexist with Rail or Panel.
Rail Props
Slim navigation strip (icon bar). Use with Panel for a two-part navigation layout. Cannot coexist with Sidebar.
Panel Props
Expanded navigation panel that works alongside Rail. Collapses when Rail collapses. Cannot coexist with Sidebar.
Content Props
Main content area. Always required in shell layouts.
Inspector Props
Right-side panel for inspectors, property panels, or contextual information.
Bottom Props
Bottom panel for terminals, logs, or contextual information.
Trigger Props
Button trigger for controlling shell panes. Renders as an unstyled button—wrap with IconButton for styling.
Examples
Basic Sidebar Layout
The most common layout pattern with a collapsible sidebar.
tsxWith Header
Add a fixed header for global navigation.
tsxWith Inspector
Add a right-side panel for properties or details.
tsxWith Bottom Panel
Add a bottom panel for terminals or logs.
tsxRail + Panel Layout
Use Rail and Panel for a two-part navigation with icon strip and expanded panel.
tsxInset Layout
Use inset prop to create floating panes with a gray backdrop.
tsxControlled Sidebar
Control the sidebar state programmatically.
tsxResizable Sidebar
Enable drag-to-resize functionality.
tsxToggle Trigger
Use Shell.Trigger to create toggle buttons for panes.
tsxPresentation Modes
The presentation prop controls how panes interact with the layout. Supports responsive values.
Fixed
Pane takes space in the layout flow. Content adjusts around it.
tsxOverlay
Pane floats above content as a modal sheet. Common for mobile layouts.
tsxStacked
Pane positions above content without displacing it. For floating panels.
tsxResponsive Presentation
Change presentation based on viewport size.
tsxSidebar States
The sidebar supports three states: collapsed, thin, and expanded.
Collapsed
Sidebar is hidden. Use trigger buttons to expand.
tsxThin
Sidebar shows at thinSize width (default 64px). Useful for icon-only navigation.
tsxExpanded
Sidebar shows at full expandedSize width (default 288px).
tsxToggle Modes
Control the toggle sequence with toggleModes.
tsxResponsive
Use responsive objects for breakpoint-specific behavior. Shell uses a mobile-first approach.
tsxBreakpoints
Inset Mode
The inset prop creates floating panes with visual separation from the shell background.
How It Works
When any pane has inset:
- Shell body gets a gray backdrop (
var(--gray-2)) - The inset pane gets margin, creating gaps from edges and other panes
- The pane gets rounded corners for the floating appearance
Visual Treatment
The inset prop handles spatial positioning only. For visual styling (background, shadow, border), use the child component's variant prop:
tsxCustomizing Gap
Override the inset gap with CSS variables:
cssComposition Rules
Shell enforces composition rules to prevent conflicting layouts.
Valid: Sidebar Only
Sidebar is a unified component that handles both icon strip and expanded navigation.
tsxValid: Rail + Panel
Rail provides an icon strip; Panel provides the expanded navigation. Panel collapses when Rail collapses.
tsxInvalid: Mixed
Sidebar cannot coexist with Rail or Panel. This triggers a console warning.
tsxHooks
useShell
Access shell context for programmatic control.
tsxAvailable methods:
togglePane(target)— Toggle a pane's stateexpandPane(target)— Expand a panecollapsePane(target)— Collapse a panesidebarMode— Current sidebar stateinspectorMode— Current inspector statebottomMode— Current bottom panel state
Accessibility
Shell provides comprehensive accessibility through semantic HTML and ARIA attributes.
Semantic Structure
Shell.Headerrenders as<header>Shell.Contentrenders as<main>- Proper landmark structure for screen readers
Keyboard Navigation
- Tab navigation through all interactive elements
- Escape key closes overlay presentations
- Arrow keys for resize handle adjustment
- Enter/Space for trigger activation
Screen Reader Support
- State announcements for panel open/close
- Resize operations announce current dimensions
- ARIA attributes:
aria-expanded,aria-hidden,aria-label
High Contrast
- Enhanced focus indicators
- Windows High Contrast mode compatibility
- Proper contrast ratios for resize handles
Changelog
Added
- Complete Shell component with seven core slots
- Responsive presentation modes: fixed, overlay, stacked
- Advanced resize system with keyboard navigation
- Composition rule enforcement
- Breakpoint system with mobile-first approach
- Size persistence API
- Peek functionality for temporary previews
useShell()hook for context access- ARIA slider implementation for resize handles
- Focus management for overlay presentations
insetprop for floating pane layouts with gray backdrop
Technical
- Context splitting for performance
- TypeScript types for all configurations
- Six breakpoints: initial, xs, sm, md, lg, xl
- Mobile-first approach with overlay defaults