Skip to content

Organisms · Side panel

Side panel

A wide panel docked beside the page's content, for reading or editing one item while the list or board it came from stays in view. It is not modal: there is no scrim (the dimmed layer a Sheet puts over the page), the page keeps working, and opening another item swaps what the panel shows. Its leading edge can be dragged, or moved with the arrow keys, to make it wider or narrower.

Best for
The details of one item from a board, list or table, read and edited while that board or list stays visible and usable beside it.
Not for
A task that must be finished or cancelled before anything else: use Dialog. Filters or navigation on a narrow screen: use Sheet.

This page as Markdown, a plain-text copy for a coding agent (an AI tool that writes code).

Requires

  • A flex row: put the page content (with min-w-0 flex-1) and the panel side by side, so the panel pushes the content aside instead of covering it.
  • A height when the page scrolls inside a container: it is sticky at the top and h-dvh by default. In a padded scroll area, pass className="md:h-[calc(100dvh-4rem)]" or whatever fits.

Examples

Beside a list: open one, then another, without closing

  • Open
  • In review
  • Open
Code
tsx
const ORDERS = [  { id: 'R-1042', title: 'Restock the north depot', status: 'Open' },  { id: 'R-1043', title: 'Replace the scanner at gate 2', status: 'In review' },  { id: 'R-1044', title: 'Count the replica shelf', status: 'Open' },]​function BesideAListExample() {  const [openId, setOpenId] = useState<string | null>(null)  const [width, setWidth] = useState(420)  const open = ORDERS.find(order => order.id === openId)  return (    <div className="flex h-[28rem] w-full overflow-hidden border border-[var(--color-border-hairline)]">      <ul role="list" className="m-0 flex min-w-0 flex-1 list-none flex-col gap-2 overflow-y-auto p-4">        {ORDERS.map(order => (          <li            key={order.id}            aria-current={order.id === openId ? 'true' : undefined}            className="flex items-center justify-between gap-3 border border-[var(--color-border-hairline)] p-3"            style={order.id === openId ? { border: '2px solid var(--color-accent-signal-fill)' } : undefined}          >            <Button variant="link" tone="neutral" className="font-semibold" onClick={() => setOpenId(order.id)}>              {order.title}            </Button>            <Badge tone={order.status === 'Open' ? 'info' : 'warning'}>{order.status}</Badge>          </li>        ))}      </ul>      <SidePanel        key={openId ?? ''}        open={open !== undefined}        onOpenChange={next => { if (!next) setOpenId(null) }}        title={open?.title ?? ''}        eyebrow={open?.id}        description={open?.status}        width={width}        onWidthChange={setWidth}        minWidth={320}        maxWidth={640}        className="md:h-full"        footer={<Button size="sm" onClick={() => setOpenId(null)}>Done</Button>}      >        <div className="flex flex-col gap-4">          <FormField label="Title"><Input defaultValue={open?.title} /></FormField>          <FormField label="Notes" help="Saved when you leave the field."><Textarea rows={4} /></FormField>        </div>      </SidePanel>    </div>  )}​<BesideAListExample />

Anatomy

PartWhat it is
PanelAn aside (a complementary landmark, which screen readers can jump to) named by the title. surface.base, a strong hairline on its leading edge, full height, sticky.
Resize handleThe leading edge: a vertical separator with the width as its value. The line turns accent.signal.indicator on hover, on focus and while dragging.
EyebrowOptional, above the title, in the data font: the item's key, type or column.
TitleRequired. An h2 by default, and the panel's accessible name. It takes focus when the panel opens.
ActionsOptional controls in the header, before the close button.
CloseA ghost icon button at the end of the header.
BodyThe part that scrolls. The header and the footer stay put.
FooterOptional, under the body: the buttons of a form, right-aligned.

Props

openboolean
Required. Whether the panel is shown. Closed, it renders nothing.
onOpenChange(open: boolean) => void
Required. Called with false by the close button and by Escape inside the panel.
titlestring
Required. The visible heading and the panel's accessible name.
eyebrowReactNode
A short line above the title: the item's key, its type, its column.
descriptionstring
Shown under the title. Screen readers read it as the accessible description.
actionsReactNode
Controls in the header, before the close button, such as Run or a DropdownMenu. Keep it to two or three.
footerReactNode
Pinned under the body, outside the scroll: a form's Cancel and Save. Laid out as a right-aligned row with a gap.
widthnumber
The width in pixels, when your code controls it. Pass it together with onWidthChange.
defaultWidthnumberDefault 560
The width it opens at, when it keeps track of the width itself. SIDE_PANEL_WIDTH, exported beside the component, holds the three defaults and the 32px keyboard step.
minWidthnumberDefault 360
The narrowest the handle can make it.
maxWidthnumberDefault 960
The widest the handle can make it.
onWidthChange(width: number) => void
Called as the width changes, from a drag or a key. Store the value (in localStorage, say) to open at the same width next time.
resizeLabelstringDefault 'Resize panel'
The resize handle's accessible name.
closeLabelstringDefault 'Close'
The close button's accessible name.
closeOnEscapebooleanDefault true
Whether Escape inside the panel closes it. An Escape that closes a menu or a listbox opened from the panel never does.
headingLevel2 | 3Default 2
The title's heading level, so it carries on the page's outline.
classNamestring
Merged with the panel classes. When Tailwind utility classes clash, the later one wins: this is where a height goes.
refRef<HTMLElement>
The aside element.
aria-labelledby / aria-describedby—
Left out on purpose. The title and description are the only source of the name and description.
...restOmit<HTMLAttributes<HTMLElement>, 'title'>
Every other native attribute, onto the aside.

Keyboard

KeysResult
EscInside the panel, closes it and sends focus back to whatever opened it.
←→On the resize handle: wider and narrower by 32px, by 128px with Shift.
HomeEndOn the resize handle: the narrowest and the widest.
TabMoves through the panel and on into the page: the panel traps nothing.

Do and don't

Do

  • Open it from the item itself (a card title, a row) and swap its content when another item is opened, without closing it first.
  • Mark the open item in the list: KanbanBoard's selectedItemId does it for a board.
  • Save a field as it is changed or left, as an issue tracker does, so closing the panel never loses work.
  • Remember the width people drag it to.

Don't

  • Don't use it for a choice the page has to wait for. That is a Dialog.
  • Don't open a Sheet or a second SidePanel from it. A Dialog or AlertDialog from inside it is fine.
  • Don't put it over the content with position fixed on a wide screen: docked beside the content is the point.