Skip to Content
Documentation
Getting startedComponentsChartsTheming
Get Pro
Overview
Concepts

Floating Panel

Used to render a draggable, resizable panel that floats above the page content

Recipe

Anatomy

import { FloatingPanel } from '@chakra-ui/react'
<FloatingPanel.Root>
  <FloatingPanel.Trigger />
  <FloatingPanel.Positioner>
    <FloatingPanel.Content>
      <FloatingPanel.Header>
        <FloatingPanel.DragTrigger>
          <FloatingPanel.Title />
        </FloatingPanel.DragTrigger>
        <FloatingPanel.Control>
          <FloatingPanel.StageTrigger />
          <FloatingPanel.CloseTrigger />
        </FloatingPanel.Control>
      </FloatingPanel.Header>
      <FloatingPanel.Body />
      <FloatingPanel.ResizeTriggers />
    </FloatingPanel.Content>
  </FloatingPanel.Positioner>
</FloatingPanel.Root>

FloatingPanel.ResizeTriggers renders a FloatingPanel.ResizeTrigger for each resize axis (n, s, e, w, ne, nw, se, sw). Pass the axes prop to render only specific handles.

Examples

Controlled Open

Use the open and onOpenChange props to control the visibility of the panel.

Stages

Use the stage prop on FloatingPanel.StageTrigger to add buttons that minimize, maximize and restore the panel. Here are the available stages:

  • default — restore the panel to its normal size and position
  • minimized — collapse the panel to a compact height (header only)
  • maximized — expand the panel to fill the available boundary
<FloatingPanel.StageTrigger stage="minimized" />

Context

Use useFloatingPanelContext inside the panel to call minimize, maximize, restore, setPosition, and setSize programmatically.

Multiple

Render multiple FloatingPanel.Root instances to show several panels at once. Each root manages its own open state, position, and size independently.

Resize Axes

Pass the axes prop to FloatingPanel.ResizeTriggers to limit which resize handles are rendered.

Min/Max

Use the minSize and maxSize props to constrain how small or large the panel can be resized.

Drag the resize handles — size is clamped between min and max.

Boundary

Use getBoundaryEl with allowOverflow={false} to confine the panel within a specific container.

Drag boundary

Props

Root

PropDefaultType
allowOverflow true
boolean

Whether the panel should be strictly contained within the boundary when dragging

defaultOpen false
boolean

The initial open state of the panel when rendered. Use when you don't need to control the open state of the panel.

dir '\'ltr\''
'ltr' | 'rtl'

The document's text/writing direction.

draggable true
boolean

Whether the panel is draggable

gridSize '1'
number

The snap grid for the panel

hideMode ''display-none''
HideMode

How to hide content when mounted but not present. - `'display-none'`: HTML `hidden` attribute. Effects stay alive. - `'activity'`: React 19 `<Activity mode="hidden">`. Effects pause. Requires React 19+.

lazyMount false
boolean

Whether to enable lazy mounting

resizable true
boolean

Whether the panel is resizable

restoreFocus true
boolean

Whether to restore focus to the trigger when the panel is closed.

skipAnimationOnMount false
boolean

Whether to allow the initial presence animation.

strategy '\'fixed\''
'absolute' | 'fixed'

The strategy to use for positioning

unmountOnExit false
boolean

Whether to unmount on exit.

closeOnEscape
boolean

Whether the panel should close when the escape key is pressed

defaultPosition
Point

The initial position of the panel when rendered. Use when you don't need to control the position of the panel.

defaultSize
Size

The default size of the panel

disabled
boolean

Whether the panel is disabled

finalFocusEl
() => HTMLElement | null

Element to receive focus when the panel is closed. By default, the trigger element is focused.

getAnchorPosition
(details: AnchorPositionDetails) => Point

Function that returns the initial position of the panel when it is opened. If provided, will be used instead of the default position.

getBoundaryEl
() => HTMLElement | null

The boundary of the panel. Useful for recalculating the boundary rect when the it is resized.

id
string

The unique identifier of the machine.

ids
Partial<{ trigger: string; positioner: string; content: string; title: string; header: string }>

The ids of the elements in the floating panel. Useful for composition.

immediate
boolean

Whether to synchronize the present change immediately or defer it to the next frame

initialFocusEl
() => HTMLElement | null

Element to receive focus when the panel is opened. By default, the first focusable element in the content is focused.

lockAspectRatio
boolean

Whether the panel is locked to its aspect ratio

maxSize
Size

The maximum size of the panel

minSize
Size

The minimum size of the panel

onExitComplete
VoidFunction

Function called when the animation ends in the closed state

onOpenChange
(details: OpenChangeDetails) => void

Function called when the panel is opened or closed

onPositionChange
(details: PositionChangeDetails) => void

Function called when the position of the panel changes via dragging

onPositionChangeEnd
(details: PositionChangeDetails) => void

Function called when the position of the panel changes via dragging ends

onSizeChange
(details: SizeChangeDetails) => void

Function called when the size of the panel changes via resizing

onSizeChangeEnd
(details: SizeChangeDetails) => void

Function called when the size of the panel changes via resizing ends

onStageChange
(details: StageChangeDetails) => void

Function called when the stage of the panel changes

open
boolean

The controlled open state of the panel

persistRect
boolean

Whether the panel size and position should be preserved when it is closed

position
Point

The controlled position of the panel

present
boolean

Whether the node is present (controlled by the user)

size
Size

The size of the panel

translations
IntlTranslations

The translations for the floating panel.