---
title: "Floating Panel"
description: "A small window over the page that people can move, resize, fold to its header, or make full size. On phones it opens as a bottom sheet."
url: https://gelatinui.com/components/floating-panel
markdown_url: https://gelatinui.com/components/floating-panel.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/floating-panel"
version: "2026-11-09"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Floating Panel

> A small window over the page that people can move, resize, fold to its header, or make full size. On phones it opens as a bottom sheet.

Page: https://gelatinui.com/components/floating-panel

## When to use it

Best for: A tool window that people keep open while they work on the page under it.

- Use it when people must see and use the page while the panel is open.
- Use `boundary` with a ref to keep the panel inside a map, a canvas, or a video.
- Use `persistKey` to keep the place, the size, and the stage for the next visit.

## When not to use it

- For a task that must end before people go on, use a [Dialog](https://gelatinui.com/components/dialog.md).
- For a small popup next to a button, use a [Popover](https://gelatinui.com/components/popover.md).
- For a panel that slides in from an edge, use a [Drawer](https://gelatinui.com/components/drawer.md).

## Notes for agents

- It is a non-modal Base UI Dialog: a press outside never closes it, and Escape closes only the front panel.
- Always render `FloatingPanelTitle`: it names the dialog.
- Put `FloatingPanelDragHandle`, `FloatingPanelTitle`, and `FloatingPanelControls` in `FloatingPanelHeader`. The stage buttons are `FloatingPanelStageTrigger` with `stage="minimized"` or `"maximized"`.
- `boundary` is `viewport` (default, `fixed`) or a ref to an element with `position: relative`. The panel may sit inside that element.
- A panel open at mount moves the focus into it. Pass `initialFocus={false}` to `FloatingPanelContent` for a tool panel that opens with the page.
- Under 640px the same parts render as a bottom Drawer.

## Anatomy

```text
FloatingPanel
├─ FloatingPanelTrigger (0..n)
├─ FloatingPanelContent (0..n)
├─ FloatingPanelHeader (0..n)
├─ FloatingPanelDragHandle (0..n)
├─ FloatingPanelTitle (0..n)
├─ FloatingPanelDescription (0..n)
├─ FloatingPanelControls (0..n)
├─ FloatingPanelStageTrigger (0..n)
├─ FloatingPanelClose (0..n)
├─ FloatingPanelBody (0..n)
└─ FloatingPanelFooter (0..n)
```

## API reference

### FloatingPanel

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `onOpenChange` | `function` |  | Called when the panel opens or closes, with the Base UI details (the reason, `cancel`). On a phone the details are the ones of the Drawer. |
| `children` | `ReactNode` |  |  |
| `stage` | `FloatingPanelStage` |  | The stage: `default` (its own rect), `minimized` (the header pill), `maximized`. |
| `defaultStage` | `FloatingPanelStage` | "default" | The stage at mount when `stage` is not set. Default `default`. |
| `onStageChange` | `function` |  |  |
| `position` | `FloatingPanelPosition` |  | The place in px from the top left corner of the boundary (controlled). |
| `defaultPosition` | `FloatingPanelPosition` |  | The place at the first open. Default: the center of the boundary. |
| `onPositionChange` | `function` |  | Called after a drag settles, a key move, or a resize from a top or left edge. |
| `size` | `FloatingPanelSize` |  | The size in px (controlled). |
| `defaultSize` | `FloatingPanelSize` | FLOATING_PANEL.size | The size at the first open. Default 320 × 360. |
| `onSizeChange` | `function` |  | Called after a pointer or key resize. |
| `minSize` | `FloatingPanelSize` | FLOATING_PANEL.minSize | The smallest size of a resize. Default 200 × 120. |
| `maxSize` | `FloatingPanelSize` |  | The largest size of a resize. Default: the boundary. |
| `boundary` | `FloatingPanelBoundary` | "viewport" | Where the panel may go: `"viewport"` (default, `fixed`) or a ref to an element (`absolute` in it: give it `position: relative`). At least 48px of the header always stays inside. |
| `draggable` | `boolean` | true | Move by the grip. Default `true`. Off: no grip, the title starts 12px in. |
| `resizable` | `boolean` | true | Resize from the edges. Default `true`. |
| `resizeEdges` | `readonly FloatingPanelEdge[]` | FLOATING_PANEL_EDGES | The edges that resize. Default all 8. |
| `closeOnEscape` | `boolean` | true | Escape closes the front panel. Default `true`. A panel behind the front one never closes. |
| `persistKey` | `string` |  | Saves the place, the size, and the stage under this key for the next visit. Off by default. |
| `labels` | `Partial<FloatingPanelLabels>` |  | The words of the controls. |

Also takes every prop of Base UI `Dialog.Root`: https://base-ui.com/react/components/dialog

### FloatingPanelTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Dialog.Trigger`: https://base-ui.com/react/components/dialog

### FloatingPanelContent

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Dialog.Popup`: https://base-ui.com/react/components/dialog

### FloatingPanelHeader

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### FloatingPanelDragHandle

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` |  |  |
| `children` | `ReactNode` |  |  |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### FloatingPanelTitle

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### FloatingPanelDescription

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

### FloatingPanelControls

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### FloatingPanelStageTrigger

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` |  |  |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |
| `stage` | `"maximized" \| "minimized"` |  | The stage this control goes to: `minimized` (Minimize, then Expand) or `maximized`. |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### FloatingPanelClose

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `children` | `ReactNode` |  |  |

### FloatingPanelBody

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### FloatingPanelFooter

No props of its own: `className`, `children`, and every other prop go to the element it renders.

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| FloatingPanel | `floating-panel` |  |  |  |
| FloatingPanelTrigger | `floating-panel-trigger` | `data-disabled` |  |  |
| FloatingPanelContent | `floating-panel-content` |  |  |  |
| FloatingPanelHeader | `floating-panel-header` |  |  |  |
| FloatingPanelDragHandle | `floating-panel-drag-handle` | `data-dragging` |  |  |
| FloatingPanelTitle | `floating-panel-title` |  |  |  |
| FloatingPanelDescription | `floating-panel-description` | `data-stage` |  |  |
| FloatingPanelControls | `floating-panel-controls` |  |  |  |
| FloatingPanelStageTrigger | `floating-panel-stage-trigger` |  |  |  |
| FloatingPanelClose | `floating-panel-close` |  |  |  |
| FloatingPanelBody | `floating-panel-body` |  |  |  |
| FloatingPanelFooter | `floating-panel-footer` | `data-stage` |  |  |

## Usage

A trigger opens a panel that people drag by its header, size by its edges, and minimize or close.

```tsx title="layers-panel.tsx"
import { Button } from "@/components/ui/button";
import {
  FloatingPanel,
  FloatingPanelBody,
  FloatingPanelClose,
  FloatingPanelContent,
  FloatingPanelControls,
  FloatingPanelDragHandle,
  FloatingPanelHeader,
  FloatingPanelTitle,
  FloatingPanelTrigger,
} from "@/components/ui/pro/floating-panel";

export function LayersPanel() {
  return (
    <FloatingPanel>
      <FloatingPanelTrigger render={<Button variant="outline" />}>Layers</FloatingPanelTrigger>
      <FloatingPanelContent>
        <FloatingPanelHeader>
          <FloatingPanelDragHandle />
          <FloatingPanelTitle>Layers</FloatingPanelTitle>
          <FloatingPanelControls>
            <FloatingPanelClose />
          </FloatingPanelControls>
        </FloatingPanelHeader>
        <FloatingPanelBody>Roads, parks, and transit</FloatingPanelBody>
      </FloatingPanelContent>
    </FloatingPanel>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui-pro/floating-panel
```

It adds 44 registry items: 41 files, 7503 lines, and the npm packages `@base-ui/react`, `@phosphor-icons/react`, `@xstate/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## Built on

- [Button](https://gelatinui.com/components/button.md)
- [Drawer](https://gelatinui.com/components/drawer.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Dialog](https://gelatinui.com/components/dialog.md)
- [Popover](https://gelatinui.com/components/popover.md)
- [Drawer](https://gelatinui.com/components/drawer.md)
- [Resizable](https://gelatinui.com/components/resizable.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Arrow keys | On the grip: moves the panel 10px. On a resize edge: changes the size. |
| Shift + Arrow keys | On the grip: moves the panel 50px. |
| Home, End | On the grip: moves the panel to the start or the end edge of the boundary. |
| Escape | Closes the front panel. |

## Motion

| Part | Motion |
| --- | --- |
| Open and close | popup · fades and scales from 95% at the center |
| Stage change | panel · the size and the corners move to the pill, the full size, or back |
| Front and back | hover · the shadow grows on the front panel and on a dragged panel |
