Skip to content
Navigation Splitter

Splitter

Resizable panels, with the mouse or the arrow keys.

On this page

Examples

Horizontal

Drag the handle, or focus it and use the arrow keys, Home and End.

Sidebar

Content

Sizes: default

Razor
<div class="flex w-full max-w-2xl flex-col gap-3">
    <div class="h-40 rounded-lg border border-(--klyroo-border)">
        <KlySplitter Panels="Panels" @bind-Sizes="_sizes" data-testid="splitter" />
    </div>
    <p class="text-sm text-(--klyroo-text-muted)" data-testid="splitter-state">Sizes: @(_sizes is null ? "default" : string.Join(" / ", _sizes.Select(s => Math.Round(s))))</p>
</div>

@code {
    private IReadOnlyList<double>? _sizes;

    private static readonly KlySplitterPanel[] Panels =
    [
        new() { Size = 40, MinSize = 20, Content = @<p class="p-3 text-sm">Sidebar</p> },
        new() { Size = 60, MinSize = 20, Content = @<p class="p-3 text-sm">Content</p> },
    ];
}

Vertical

Editor

Console

Razor
<div class="h-64 w-full max-w-md rounded-lg border border-(--klyroo-border)">
    <KlySplitter Panels="Panels" Orientation="KlyOrientation.Vertical" Color="KlyColor.Secondary" />
</div>

@code {
    private static readonly KlySplitterPanel[] Panels =
    [
        new() { Content = @<p class="p-3 text-sm">Editor</p> },
        new() { Size = 30, MinSize = 10, Content = @<p class="p-3 text-sm">Console</p> },
    ];
}

API

KlySplitter

Resizable panels separated by focusable handles.

Parameters

Name Type Default Description
Class string Classes added to the root element, merged last so they win over the theme.
Color KlyColor "primary" Semantic color of the splitter: a built-in KlyColor or the name of a color you defined. When not set, Color applies, else the default of the component. Values: primary, secondary, success, info, warning, error, neutral.
Orientation KlyOrientation KlyOrientation.Horizontal Horizontal places the panels side by side (the handles are vertical); Vertical stacks them. Values: Horizontal, Vertical.
Panels (required) IReadOnlyList<KlySplitterPanel> The panels, in order, as KlySplitterPanel . A handle sits between two neighbors.
Sizes (@bind-Sizes) IReadOnlyList<Double> Sizes in percent, one per panel. Bind it to follow resizing; unbound, resizing stays in the browser.
Step Double 5 Size change of an arrow key press, in percent.
Ui SplitterUi Per-instance class overrides of the slots of the splitter, see SplitterUi . They are merged after the theme and the Class parameter wins on the root slot.

Ui slots

Ui takes a SplitterUi with one class string per slot, merged after the theme.

Slot Styles
Root Classes merged into the root slot of KlySplitter , after the theme and the app configuration.
Panel Classes merged into the panel slot of KlySplitter , after the theme and the app configuration.
Handle Classes merged into the handle slot of KlySplitter , after the theme and the app configuration.