Side Panel

Nestable in-flow side panel for navigation, filters and workspace tools

View documentation

Panel and inset

The panel shrinks to zero width and the inset takes the space it frees. Unlike hw:sidebar it stays in the document flow, never becomes an overlay on mobile, and can be nested.

Overview

The panel shrinks to zero width and the inset takes the space it frees — nothing leaves the document flow, nothing becomes an overlay. That is the fundamental difference from hw:sidebar.

On collapse the panel content gets inert immediately, so links and controls inside it leave the tab order before the animation has even finished.

Right side

side="right" moves the panel to the opposite edge and the trigger follows. The position and the icon direction come from the preset, not from a prop.

Editor

With side="right" the panel moves to the opposite edge and the trigger follows — the position and the icon direction come from the preset, not from a prop.

The markup order does not change: panel then inset, exactly as on the left — the flip is flex-direction.

Cookie persistence

Each panel isolates its own cookie from its name — here side_panel_saved-filters_state. The server reads the cookie before rendering, so the first frame already has the right state and nothing jumps. Collapse both, reload, and compare.

Toggle and reload: the state comes back as it was, and already on the first frame — the server reads the cookie before rendering.

The same gesture writes no cookie here: a reload gives back the initial state.

Reload the page Collapse both, reload, and compare which one came back collapsed.

Nesting

Each controller only touches its own targets, so nested panels keep independent state and cookies. A Side Panel can also live inside a hw:sidebar without sharing its state or its overlay behaviour.

Workspace

Two independent panels: toggle the inner one, then the outer one — each keeps its own state and its own cookie.

A keyboard shortcut by composition

The component deliberately ships no shortcut: a page can hold several panels, and a package-owned binding would be ambiguous. Compose the hotkey controller on the trigger instead — press o to toggle.

Document

Press o anywhere on the page to toggle this panel. The shortcut is ignored while the focus sits in a text field.

Explicit initial state

Conceptual

Without default-open the component reads the cookie and falls back to expanded. Passing the value explicitly ignores the cookie — useful for a page that must always start the same way.

Resolution order: an explicit default-open, then the side_panel_<name>_state cookie, then expanded.

Before Turbo Drive renders a new body, the controller copies the live state onto the incoming markup — so a response prepared before the last toggle cannot restore stale state.