SplitView
Description
The SplitView component creates a two-pane container that arranges two child components separated by a draggable splitter. This component is ideal for displaying resizable panels side-by-side (or top/bottom when using horizontal variations) within your UI. It is part of the Tesserae Components group, which provides various UI controls for building interactive interfaces.
Usage
Instantiate a SplitView using the helper method from Tesserae.UI. You can add content to the left and right panels using the Left() and Right() methods. By default, the splitter is non-resizable; calling Resizable() enables drag-to-resize functionality.
Below is a basic usage example:
Public Properties
There are no explicitly exposed public properties for the SplitView component. Configuration and state management are handled via its fluent interface methods.
API reference
public class SplitView : IComponentA vertical split view component.
Constructors
Methods
public SplitView Resizable(Action<int> onResizeEnd = null, string backgroundColor = null)Sets the split view to be resizable.
Parameters
- onResizeEnd
- An optional action to perform when resizing ends.
Returns
The current instance.
public SplitView Left(IComponent component, string background = "")Sets the left component.
Parameters
- component
- The component.
- background
- The background color.
Returns
The current instance.
public SplitView Right(IComponent component, string background = "")Sets the right component.
Parameters
- component
- The component.
- background
- The background color.
Returns
The current instance.
public SplitView PanelStyle()Sets the panel style for the split view.
Returns
The current instance.
public SplitView NotResizable()Sets the split view to be not resizable.
Returns
The current instance.
public SplitView SplitInMiddle()Splits the view in the middle.
Returns
The current instance.
public SplitView LeftIsSmaller(UnitSize leftSize, UnitSize maxLeftSize = null, UnitSize minLeftSize = null)Sets the left component to be smaller.
Parameters
- leftSize
- The left size.
- maxLeftSize
- The maximum left size.
- minLeftSize
- The minimum left size.
Returns
The current instance.
public SplitView RightIsSmaller(UnitSize rightSize, UnitSize maxRightSize = null, UnitSize minRightSize = null)Sets the right component to be smaller.
Parameters
- rightSize
- The right size.
- maxRightSize
- The maximum right size.
- minRightSize
- The minimum right size.
Returns
The current instance.
Samples
Basic SplitView with Resizable Panels
This sample demonstrates how to create a SplitView, assign components to the left and right panels, and enable panel resizing on the fly.
Configuring Side-Specific Panel Sizes
This sample shows how to configure the SplitView so that one of the panels is set to a fixed smaller width.