Docs

Documentation versions (currently viewingVaadin 25 (prerelease))

Split Layout

Split Layout is a component with two content areas and a draggable split handle between them.

Split Layout is a component with two content areas and a draggable split handle between them.

Source code
SplitLayoutBasic.java
split-layout-basic.tsx
split-layout-basic.ts

Orientation

The default orientation is horizontal, placing the content areas side by side. The orientation can also be vertical.

Orientation should be set based on the content and the screen size. The user can also be allowed to choose which orientation they want to use.

Source code
SplitLayoutOrientation.java
split-layout-orientation.tsx
split-layout-orientation.ts

Splitter Position

The initial splitter position is determined by the default size of the two content area components. Their height and width affect the position when using a vertical and horizontal orientation, respectively.

The initial split position can also be explicitly set using a percentage value. When using vertical orientation, the split layout must have an explicit height for this to work. This can be either an absolute or a percentage value. When using a percentage value, ensure that ancestors have an explicit height as well.

Source code
SplitLayoutInitialSplitterPosition.java
split-layout-initial-splitter-position.tsx
split-layout-initial-splitter-position.ts

The splitter respects the minimum and maximum size of the content area components.

Source code
SplitLayoutMinMaxSize.java
split-layout-min-max-size.tsx
split-layout-min-max-size.ts

The split can be adjusted programmatically, for example by using a Button. This is useful when the user wants to toggle between certain positions.

Source code
SplitLayoutToggle.java
split-layout-toggle.tsx
split-layout-toggle.ts

Best Practices

  • Don’t use Split Layout when either content area has, or should have, a fixed size.

  • Split Layouts can be difficult to use in responsive applications, due to the splitter position being percentage-based, so that the content scales with the viewport.

  • Use Split Layout to give the user the ability to adjust the layout. However, if only specific positions, such as collapsed and expanded, are useful to the user, use a toggle button instead. Non-adjustable layouts should use Ordered Layouts or Flex Layout.

54c71610-9696-11ee-b9d1-0242ac120002