UnflowUI
Components

SidePanel

A non-modal panel docked beside the content, optionally resizable, with its width remembered between visits.

Overview

SidePanel shows secondary content (details, sources, previews) next to the page instead of on top of it. From 1280 px up it takes its own column and pushes the content; below that it overlays the content. It is not focus trapped, so the page stays usable while it is open.

For a modal panel that blocks the page, use Modal with placement="sidepanel". SidePanel shares Modal's header, close button and footer.

Import

import { SidePanel } from '@unflowio/ui/components/SidePanel';

Props

PropTypeDefaultDescription
openboolean—Controls visibility
onOpenChange(open: boolean) => void—Called when the close button or Escape closes the panel
side'right' | 'left''right'Edge the panel docks to
titleReactNode—Header title. Also names the panel landmark
actionsReactNode—Rendered in the header, before the close button
footerReactNode—Footer content
hideCloseButtonboolean—Hides the close button in the header
resizableboolean—Shows a drag handle on the inner edge, also operable with the keyboard
widthnumber—Width in px, controlled
defaultWidthnumber360Initial width in px, uncontrolled
onWidthChange(width: number) => void—Called when the panel is resized
minWidthnumber280Smallest width in px
maxWidthnumber640Largest width in px
storageKeystring—Persists the width in localStorage under this key
childrenReactNode—The body

Basic usage

The draft caps liability at 12 months of fees, which matches the standard terms. Indirect losses are not excluded, and the cap does not carve out data breaches.

const [open, setOpen] = useState(true);

<div className="flex">
  <main className="flex-1">…</main>
  <SidePanel title="Sources · 3" open={open} onOpenChange={setOpen}>
    <SourceList />
  </SidePanel>
</div>

Resizable

The draft caps liability at 12 months of fees, which matches the standard terms. Indirect losses are not excluded, and the cap does not carve out data breaches.

<SidePanel title="Sources · 3" open={open} onOpenChange={setOpen} resizable storageKey="sources-panel-width">
  …
</SidePanel>

The draft caps liability at 12 months of fees, which matches the standard terms. Indirect losses are not excluded, and the cap does not carve out data breaches.

<SidePanel
  side="left"
  title="Details"
  open={open}
  onOpenChange={setOpen}
  actions={<Tag label="Draft" variant="grey" size="sm" />}
  footer={<Button label="Open in editor" variant="secondary" size="sm" />}
>
  …
</SidePanel>

Customization (slots & slotProps)

SlotTypeDescription
headerReactNodeReplaces the header row (title, actions and close button)
Slot PropPropsDescription
headerBaseHTMLProps<HTMLDivElement>The header row
titleBaseHTMLProps<HTMLHeadingElement>The title
bodyBaseHTMLProps<HTMLDivElement>The scrollable body
footerBaseHTMLProps<HTMLDivElement>The footer
resizeHandleBaseHTMLProps<HTMLDivElement>The resize handle
closeButtonPartial<Omit<IIconButton, 'onClick'>>The close button

Accessibility

  • The panel is an <aside> landmark labelled by its title.
  • Escape closes the panel while focus is inside it. The close button is named "Close panel" (translated).
  • The resize handle is a role="separator" named "Resize panel" with aria-valuenow, aria-valuemin and aria-valuemax. Arrow keys resize it by 16 px (64 px with Shift), and Home/End jump to the minimum/maximum width.