Resizable

Panels the user can resize by dragging a handle or with the keyboard.

The resizable panel group is new in v0.4.0. ResizablePanelGroup lays out ResizablePanels in a row or a column, and a ResizableHandle between two panels resizes them. Drag a handle, or focus it with Tab and use the arrow keys, Home and End. The browser moves the panels while you drag and reports the new sizes to .NET once at the end, so dragging stays smooth on Blazor Server.

Installation

bash
shellui add resizable

This installs ResizablePanelGroup, ResizablePanel, ResizableHandle and shellui-js, which handles the dragging.

Replaces the old Resizable

Before 0.4.0, Resizable was a flex container that didn't resize. The NuGet package still has it, deprecated; shellui add resizable now installs the panel group instead.

Usage

Basic

Give the group a height (here from its parent). Sizes are percentages of the group: a panel with DefaultSize keeps it, and panels without one share the rest. OnLayout reports every panel's size after a drag or key press.

Sidebar
Content

Layout: 30% / 70%

<div class="w-full max-w-xl space-y-2">
    <div class="h-48 overflow-hidden rounded-lg border border-border">
        <ResizablePanelGroup OnLayout="sizes => layout = sizes">
            <ResizablePanel DefaultSize="30" MinSize="20">
                <div class="flex h-full items-center justify-center p-4 text-sm font-medium">Sidebar</div>
            </ResizablePanel>
            <ResizableHandle WithHandle="true" />
            <ResizablePanel>
                <div class="flex h-full items-center justify-center p-4 text-sm font-medium">Content</div>
            </ResizablePanel>
        </ResizablePanelGroup>
    </div>
    <p class="text-sm text-muted-foreground">Layout: @string.Join(" / ", layout.Select(s => $"{s:0}%"))</p>
</div>

@code {
    private IReadOnlyList<double> layout = new[] { 30d, 70d };
}

Nested and vertical

Direction="vertical" stacks the panels. Put a group inside a panel to split it again. MinSize and MaxSize limit a panel, and WithHandle shows a grip on the handle.

Files
Editor
Terminal
Inspector
<div class="h-72 w-full overflow-hidden rounded-lg border border-border">
    <ResizablePanelGroup>
        <ResizablePanel DefaultSize="20" MinSize="15" MaxSize="35">
            <div class="flex h-full items-center justify-center p-4 text-sm font-medium">Files</div>
        </ResizablePanel>
        <ResizableHandle WithHandle="true" />
        <ResizablePanel MinSize="30">
            <ResizablePanelGroup Direction="vertical">
                <ResizablePanel DefaultSize="65">
                    <div class="flex h-full items-center justify-center p-4 text-sm font-medium">Editor</div>
                </ResizablePanel>
                <ResizableHandle WithHandle="true" />
                <ResizablePanel MinSize="15">
                    <div class="flex h-full items-center justify-center p-4 text-sm font-medium">Terminal</div>
                </ResizablePanel>
            </ResizablePanelGroup>
        </ResizablePanel>
        <ResizableHandle />
        <ResizablePanel DefaultSize="25">
            <div class="flex h-full items-center justify-center p-4 text-sm font-medium">Inspector</div>
        </ResizablePanel>
    </ResizablePanelGroup>
</div>

Keyboard

Key Action
Arrow keys Move the focused handle by KeyboardStep percent (left/right in a row, up/down in a column)
Home Shrink the panel before the handle as far as the two panels' MinSize and MaxSize allow
End Grow it as far as those limits allow

API Reference

ResizablePanelGroup

Parameter Type Default Description
Direction string "horizontal" horizontal for a row, vertical for a column
KeyboardStep double 10 Percent a focused handle moves per arrow key press
OnLayout EventCallback<double[]> — Raised after a drag or key press with every panel's size, in percent
ChildContent RenderFragment? null Panels and handles, alternating
Class string? null Additional CSS classes

The group's Layout property returns the current sizes.

ResizablePanel

Parameter Type Default Description
DefaultSize double? null Starting size in percent; panels without one share what's left
MinSize double 0 Smallest size in percent
MaxSize double 100 Largest size in percent
ChildContent RenderFragment? null The panel's content
Class string? null Additional CSS classes

ResizableHandle

Parameter Type Default Description
WithHandle bool false Shows a grip on the handle
Disabled bool false Stops the handle resizing and takes it out of the Tab order
Class string? null Additional CSS classes

Accessibility

  • Each handle has role="separator", its orientation, and aria-valuenow with the size of the panel before it
  • Handles are in the Tab order (unless Disabled) and show a focus ring
  • Resizing needs an interactive render mode and shellui.js, which shellui add resizable installs and the NuGet package loads by itself

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.