Skip to main content

Sizing and layout

Auto-resizing​

By default, Dockview uses a ResizeObserver to automatically detect when the container element changes size and updates the layout accordingly. This requires no configuration.

If you need to manage sizing yourself, for example when embedding Dockview inside a container that doesn't produce ResizeObserver notifications, you can disable auto-resizing and call api.layout() manually.

// Disable the internal ResizeObserver
disableAutoResizing={true}

// Then manually drive layout updates:
api.layout(width, height);

You can read the current dimensions at any time via api.width and api.height.

Proportional layout​

When the container is resized, Dockview shares the extra (or missing) space out between the groups of each row and column proportionally, so every group keeps its share of the layout.

Set proportionalLayout={false} to hand the whole delta to the last group in each row/column instead. Every splitter but the last one then stays exactly where the user left it, which is how VS Code behaves. If the last group reaches its minimum or maximum size, the remainder moves on to the group before it. This applies to the nested layouts inside floating and popout windows too.

proportionalLayout={false}

The option can also be changed after initialization with api.updateOptions({ proportionalLayout }). Re-enabling it adopts the group sizes in place at that moment as the proportions to preserve, rather than the proportions from before it was disabled. Passing undefined restores the default.

Hiding borders​

By default, Dockview renders thin borders between groups in the grid. The hideBorders option removes them. See Hiding borders on the theming page for the full example.

Updating options at runtime​

api.updateOptions() lets you change any option after the component has initialized. Only the provided keys are updated; others remain unchanged.

api.updateOptions({
hideBorders: true,
locked: false,
theme: themeLight,
});

See also​

  • Resizing: set a panel or group's exact height and width programmatically
  • Constraints: set minimum and maximum group sizes