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
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | — | 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 |
title | ReactNode | — | Header title. Also names the panel landmark |
actions | ReactNode | — | Rendered in the header, before the close button |
footer | ReactNode | — | Footer content |
hideCloseButton | boolean | — | Hides the close button in the header |
resizable | boolean | — | Shows a drag handle on the inner edge, also operable with the keyboard |
width | number | — | Width in px, controlled |
defaultWidth | number | 360 | Initial width in px, uncontrolled |
onWidthChange | (width: number) => void | — | Called when the panel is resized |
minWidth | number | 280 | Smallest width in px |
maxWidth | number | 640 | Largest width in px |
storageKey | string | — | Persists the width in localStorage under this key |
children | ReactNode | — | 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>Actions, footer and side
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)
| Slot | Type | Description |
|---|---|---|
header | ReactNode | Replaces the header row (title, actions and close button) |
| Slot Prop | Props | Description |
|---|---|---|
header | BaseHTMLProps<HTMLDivElement> | The header row |
title | BaseHTMLProps<HTMLHeadingElement> | The title |
body | BaseHTMLProps<HTMLDivElement> | The scrollable body |
footer | BaseHTMLProps<HTMLDivElement> | The footer |
resizeHandle | BaseHTMLProps<HTMLDivElement> | The resize handle |
closeButton | Partial<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" witharia-valuenow,aria-valueminandaria-valuemax. Arrow keys resize it by 16 px (64 px with Shift), and Home/End jump to the minimum/maximum width.