sidePanelLayout
sidePanelLayout adds a panel that opens beside or over the main content.
A side panel can also be created programmatically using Side Dialog.
|
XML Element |
|
|---|---|
Java Class |
|
Basics
SidePanelLayout divides the content into two areas:
-
Main content – the primary layout area.
-
Side panel content – a panel that slides in from one side.
To define the component in XML, use the sidePanelLayout element and add exactly two direct child components.
<sidePanelLayout id="sidePanelLayout"
width="100%"
height="100%">
<vbox id="contentBox">
<!-- Main content -->
</vbox>
<vbox id="sidePanelBox" width="100%" height="100%">
<hbox id="headerBox" width="100%"> (1)
<h2 text="Customer information"/>
<sidePanelLayoutCloser/>
</hbox>
<!-- Side panel content -->
</vbox>
</sidePanelLayout>
| 1 | A side panel typically includes a close button. Use the dedicated sidePanelLayoutCloser component to add that button. |
Opening the Side Panel
The side panel opens in response to user actions such as clicking a button. Call the toggleSidePanel() method:
@ViewComponent
private SidePanelLayout sidePanelLayout;
@Subscribe(id = "toggleButton", subject = "clickListener")
public void onToggleButtonClick(final ClickEvent<JmixButton> event) {
sidePanelLayout.toggleSidePanel();
}
Side Panel Editor
Use SidePanelLayout for a master-detail pattern where the main area contains a list of entities and the side panel edits the selected instance.
Styling
You can customize the appearance and size of SidePanelLayout using CSS variables and theme selectors.
Sizing with CSS Variables
The following variables define the side panel size. Set them globally or in a selector that targets a particular sidePanelLayout.
| Values set in XML or using the Java API override CSS variables. |
Horizontal side panels (LEFT, RIGHT, INLINE_START, INLINE_END):
Variable |
Description |
Default |
|---|---|---|
|
Preferred width of the side panel. |
|
|
Maximum width. |
|
|
Minimum width. |
|
Vertical side panels (TOP, BOTTOM):
Variable |
Description |
Default |
|---|---|---|
|
Preferred height of the side panel. |
|
|
Maximum height. |
|
|
Minimum height. |
|
Appearance
Variable |
Description |
Default |
|---|---|---|
|
Controls how long the open and close animation takes. |
|
Parts
SidePanelLayout exposes the following stylable parts:
Part |
Description |
|---|---|
|
Container for content, side panel, and modality curtain. |
|
Main layout content. |
|
Modality curtain. |
|
Panel that moves into and out of view. |
|
Side panel content container. |
States
The component exposes the following states:
State |
Description |
|---|---|
|
Applied when the side panel is open. |
|
Applied when the side panel is modal. |
|
Matches the current side panel position ( |
|
Applied when the panel overlays content instead of pushing it. |
Attributes
Common attributes serve the same purpose for all components. The following attributes are specific to sidePanelLayout.
| Name | Description | Default |
|---|---|---|
Defines the side from which the panel appears. Possible values are
|
|
|
Determines how the side panel interacts with the main content. If |
|
|
When |
|
|
When This attribute only has an effect when modal is enabled. |
|
|
Sets the accessible label for the overlay element. |
— |
|
If |
|
|
Defines the width of the side panel when its position is The value can be any valid CSS size such as |
|
|
Defines the minimum width of a horizontally positioned side panel. |
|
|
Defines the maximum width of a horizontally positioned side panel. |
|
|
Defines the vertical size of the side panel when it appears from the top or bottom. |
|
|
Defines the minimum vertical size of the side panel. |
|
|
Defines the maximum vertical size of the side panel. |
|
Handlers
Common handlers are configured in the same way for all components. The following handlers are specific to sidePanelLayout.
| Name | Description |
|---|---|
Fires when the user clicks the modality curtain. |
|
Fires before the side panel is displayed and before its opening animation starts. Use it to update content before the panel becomes visible. |
|
Fires after the side panel is fully open and its opening animation has finished. |
|
Fires when the side panel closes. |
Elements
A sidePanelLayout contains exactly two root components: the main content and the side-panel content. Use sidePanelLayoutCloser inside the panel when it needs a dedicated close button.