Skip to content

Layout

LayoutPanel

Fixed-width side panel for Layout start/end slots.

import { LayoutPanel } from '@var-ui/react';

LayoutPanel

Side panel for Layout start/end slots. Supports fixed width, useResizable integration, and responsive overlay / hidden modes below a breakpoint. overlay renders the panel in a native modal <dialog> that slides in from data-side (the same primitive as Drawer and MobileNav): native focus trap, Escape, backdrop dismissal and scroll lock, with open / defaultOpen / onOpenChange(open, details).

Examples

Default

Demo.tsxTSX
import { useState } from 'react';
import {
  Button,
  Layout,
  LayoutContent,
  LayoutPanel,
  useResizable,
} from '@var-ui/react';

const { end } = useResizable({
  regions: { end: { defaultWidth: 280, minWidth: 220, maxWidth: 400 } },
});

<Layout
  height="auto"
  padding="none"
  content={<LayoutContent padding="none">{/* list */}</LayoutContent>}
  end={
    <LayoutPanel resizable={end} hasResizeHandle label="Details" role="complementary">
      Inspector
    </LayoutPanel>
  }
/>

Resizable

Pass a useResizable() result as resizable and set hasResizeHandle to get a ResizeHandle on the edge facing the content: after a start panel, before an end panel (with the drag direction flipped). It replaces hasDivider, and is skipped below a responsive breakpoint. Without hasResizeHandle, compose your own ResizeHandle next to the panel.

TSX
const list = useResizable({ autoSaveId: 'list', defaultWidth: 340 });

<Layout
  start={
    <LayoutPanel resizable={list} hasResizeHandle resizeHandleLabel="Resize list">
      {items}
    </LayoutPanel>
  }
>
  {detail}
</Layout>;

Props

Accessibility

Set role (e.g. complementary, navigation) and label when the panel is a landmark.