Ark UI Logo
Undefined
Components
Floating panel

Floating Panel

Used to display content in a non-modal floating window.

Anatomy

To set up the editable correctly, you'll need to understand its anatomy and how we name its parts.

Each part includes a data-part attribute to help identify them in the DOM.

Examples

Learn how to use the FloatingPanel component in your project. Let's take a look at the most basic example:

Controlling the size

To control the size of the floating panel programmatically, you can pass the size onResize prop to the machine.

Controlling the position

To control the position of the floating panel programmatically, you can pass the position and onPositionChange prop to the machine.

Anchor position

Use the getAnchorPosition function to compute the initial position of the floating panel. This function is called when the panel is opened and receives the triggerRect and boundaryRect.

Controlling the open state

To control the open state of the floating panel programmatically, you can pass the open and onOpenChange prop to the machine.

Lazy mounting

To lazy mount the floating panel, you can pass the lazyMount prop to the machine.

Context

To access the context of the floating panel, you can use the useFloatingPanelContext hook or the FloatingPanel.Context component.

API Reference