SplitDirection
SplitDirection chooses whether SplitView
places its panes side by side or one above the other. Set it when configuring a
SplitView; it is not a widget on its own. Choose the direction that fits the available space and how people need to scan
the two panes.
Variants
| | | Notes and default behavior |
|---|
SplitDirection::Horizontal | | Places the two panes side by side, from left to right. | The checked-in SplitView lowers to a Row in this mode. Use it for inspector layouts, sidebars, and editor-plus-preview screens. |
| | Places the two panes one above the other, from top to bottom. | The checked-in SplitView lowers to a Column in this mode. Use it for stacked panels such as preview over logs or content over details. |
How to choose
Choose Horizontal when width is the natural resource. This is common in desktop products where a sidebar, navigation rail, file tree, or inspector should stay visible next to the main content.
Choose Vertical when height is easier to share than width. This is often the better fit on narrower screens, in dashboard panels, or when the lower pane is a secondary surface such as logs, output, or details.
Responsive layout is where this enum becomes more important than it first appears. A split that feels natural on a wide laptop can feel cramped on a tablet in portrait orientation or on a phone-sized host. In those cases, it is often better to keep the same SplitView idea but change the direction based on available space. That way the product keeps one mental model while adjusting the pane arrangement to the host.
Example with SplitView
This component accepts a layout decision from its parent and renders the two
owned panes. The parent also owns the current ratio and resize action:
use fission::prelude::*;
fission_component! {
pub DocumentSplit<()> {
props {
direction: SplitDirection,
first: Widget,
second: Widget,
ratio: f32,
resize: ActionEnvelope,
}
}
view(panes, _state, _cx) =>
SplitView(
direction: panes.direction.clone(),
first: panes.first.clone(),
second: panes.second.clone(),
split_ratio: panes.ratio,
on_resize: panes.resize.clone(),
)
}
On a wide window, an editor and preview may sit side by side. A narrower
container may stack them. Use an appropriate Responsive case or
constraint-aware parent to make that decision; the enum only expresses the
chosen axis. Construct an independent pane tree for each responsive branch,
not two branches that share clones of one retained Widget.
If your direction changes at runtime, keep that responsive rule in ordinary app logic or a named component. SplitDirection should stay the result of the decision, not the place where the decision logic lives.
Specific advice
Do not use Horizontal by default just because many desktop tools do. Start from the shape of the content. If both panes need substantial reading width, a narrow horizontal split can quickly become unusable.
Likewise, do not reach for Vertical only because it feels mobile-friendly. A bottom pane that constantly pushes the main content out of view can be just as frustrating. Test the actual reading and interaction flow on the hosts you plan to ship.
If you need panes that can fully collapse, reorder, or navigate independently, a plain SplitView plus SplitDirection may be too small a tool. In that case, combine it with stronger app state and navigation structure rather than trying to make the enum carry more meaning than it should.