adw.navigation_split_view

Module for NavigationSplitView class

Types 3

A widget presenting sidebar and content side by side or as a navigation view.

navigation-split-view navigation-split-view-collapsed

adw.navigation_split_view.NavigationSplitView has two adw.navigation_page.NavigationPage children: sidebar and content, and displays them side by side.

When adw.navigation_split_view.NavigationSplitView.collapsed is set to TRUE, it instead puts both children inside an adw.navigation_view.NavigationView. The adw.navigation_split_view.NavigationSplitView.showContent controls which child is visible while collapsed.

See also adw.overlay_split_view.OverlaySplitView.

adw.navigation_split_view.NavigationSplitView is typically used together with an adw.breakpoint.Breakpoint setting the collapsed property to TRUE on small widths, as follows:

<object class="AdwWindow">
  <property name="width-request">280</property>
  <property name="height-request">200</property>
  <property name="default-width">800</property>
  <property name="default-height">800</property>
  <child>
    <object class="AdwBreakpoint">
      <condition>max-width: 400sp</condition>
      <setter object="split_view" property="collapsed">True</setter>
    </object>
  </child>
  <property name="content">
    <object class="AdwNavigationSplitView" id="split_view">
      <property name="sidebar">
        <object class="AdwNavigationPage">
          <property name="title" translatable="yes">Sidebar</property>
          <property name="child">
            <!-- ... -->
          </property>
        </object>
      </property>
      <property name="content">
        <object class="AdwNavigationPage">
          <property name="title" translatable="yes">Content</property>
          <property name="child">
            <!-- ... -->
          </property>
        </object>
      </property>
    </object>
  </property>
</object>

Sizing

When not collapsed, adw.navigation_split_view.NavigationSplitView changes the sidebar width depending on its own width.

If possible, it tries to allocate a fraction of the total width, controlled with the adw.navigation_split_view.NavigationSplitView.sidebarWidthFraction property.

The sidebar also has minimum and maximum sizes, controlled with the adw.navigation_split_view.NavigationSplitView.minSidebarWidth and adw.navigation_split_view.NavigationSplitView.maxSidebarWidth properties.

The minimum and maximum sizes are using the length unit specified with the adw.navigation_split_view.NavigationSplitView.sidebarWidthUnit.

By default, sidebar is using 25% of the total width, with 180sp as the minimum size and 280sp as the maximum size.

Header Bar Integration

When used inside adw.navigation_split_view.NavigationSplitView, adw.header_bar.HeaderBar will automatically hide the window buttons in the middle.

When collapsed, it also displays a back button for the content widget, as well as the page titles. See adw.navigation_view.NavigationView documentation for details.

Actions

adw.navigation_split_view.NavigationSplitView defines the same actions as adw.navigation_view.NavigationView, but they can be used even when the split view is not collapsed:

adw.navigation_split_view.NavigationSplitView as gtk.buildable.Buildable

The adw.navigation_split_view.NavigationSplitView implementation of the gtk.buildable.Buildable interface supports setting the sidebar widget by specifying “sidebar” as the “type” attribute of a <child> element, Specifying “content” child type or omitting it results in setting the content widget.

CSS nodes

adw.navigation_split_view.NavigationSplitView has a single CSS node with the name navigation-split-view.

When collapsed, it contains a child node with the name navigation-view containing both children.

navigation-split-view
╰── navigation-view
    ├── [sidebar child]
    ╰── [content child]

When not collapsed, it contains two nodes with the name widget, one with the .sidebar-pane style class, the other one with .content-view style class, containing the sidebar and content children respectively.

navigation-split-view
├── widget.sidebar-pane
│   ╰── [sidebar child]
╰── widget.content-pane
    ╰── [content child]

Accessibility

adw.navigation_split_view.NavigationSplitView uses the gtk.types.AccessibleRole.Group role.

Methods
GType _gType() @property
NavigationSplitView self()Returns `this`, for use in `with` statements.
NavigationSplitViewGidBuilder builder()Get builder for [adw.navigation_split_view.NavigationSplitView] Returns: New builder object
bool collapsed() @propertyGet `collapsed` property. Returns: Whether the split view is collapsed.
void collapsed(bool propval) @propertySet `collapsed` property. Params: propval = Whether the split view is collapsed.
adw.navigation_page.NavigationPage content() @propertyGet `content` property. Returns: The content widget.
void content(adw.navigation_page.NavigationPage propval) @propertySet `content` property. Params: propval = The content widget.
double maxSidebarWidth() @propertyGet `maxSidebarWidth` property. Returns: The maximum sidebar width.
void maxSidebarWidth(double propval) @propertySet `maxSidebarWidth` property. Params: propval = The maximum sidebar width.
double minSidebarWidth() @propertyGet `minSidebarWidth` property. Returns: The minimum sidebar width.
void minSidebarWidth(double propval) @propertySet `minSidebarWidth` property. Params: propval = The minimum sidebar width.
bool showContent() @propertyGet `showContent` property. Returns: Determines the visible page when collapsed.
void showContent(bool propval) @propertySet `showContent` property. Params: propval = Determines the visible page when collapsed.
adw.navigation_page.NavigationPage sidebar() @propertyGet `sidebar` property. Returns: The sidebar widget.
void sidebar(adw.navigation_page.NavigationPage propval) @propertySet `sidebar` property. Params: propval = The sidebar widget.
double sidebarWidthFraction() @propertyGet `sidebarWidthFraction` property. Returns: The preferred sidebar width as a fraction of the total width.
void sidebarWidthFraction(double propval) @propertySet `sidebarWidthFraction` property. Params: propval = The preferred sidebar width as a fraction of the total width.
adw.types.LengthUnit sidebarWidthUnit() @propertyGet `sidebarWidthUnit` property. Returns: The length unit for minimum and maximum sidebar widths.
void sidebarWidthUnit(adw.types.LengthUnit propval) @propertySet `sidebarWidthUnit` property. Params: propval = The length unit for minimum and maximum sidebar widths.
bool getCollapsed()Gets whether self is collapsed. Returns: whether self is collapsed
adw.navigation_page.NavigationPage getContent()Sets the content widget for self. Returns: the content widget
double getMaxSidebarWidth()Gets the maximum sidebar width for self. Returns: the maximum width
double getMinSidebarWidth()Gets the minimum sidebar width for self. Returns: the minimum width
bool getShowContent()Gets which page is visible when self is collapsed. Returns: whether to show content when collapsed
adw.navigation_page.NavigationPage getSidebar()Gets the sidebar widget for self. Returns: the sidebar widget
double getSidebarWidthFraction()Gets the preferred sidebar width fraction for self. Returns: the preferred width fraction
adw.types.LengthUnit getSidebarWidthUnit()Gets the length unit for minimum and maximum sidebar widths. Returns: the length unit
void setCollapsed(bool collapsed)Sets whether self is collapsed.
void setContent(adw.navigation_page.NavigationPage content = null)Sets the content widget for self.
void setMaxSidebarWidth(double width)Sets the maximum sidebar width for self.
void setMinSidebarWidth(double width)Sets the minimum sidebar width for self.
void setShowContent(bool showContent)Sets which page is visible when self is collapsed.
void setSidebar(adw.navigation_page.NavigationPage sidebar = null)Sets the sidebar widget for self.
void setSidebarWidthFraction(double fraction)Sets the preferred sidebar width as a fraction of the total width of self.
void setSidebarWidthUnit(adw.types.LengthUnit unit)Sets the length unit for minimum and maximum sidebar widths.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new [adw.navigation_split_view.NavigationSplitView]. Returns: the newly created [adw.navigation_split_view.NavigationSplitView]

Fluent builder implementation template for adw.navigation_split_view.NavigationSplitView

Methods
T collapsed(bool propval)Set `collapsed` property. Params: propval = Whether the split view is collapsed.
T content(adw.navigation_page.NavigationPage propval)Set `content` property. Params: propval = The content widget. Returns: Builder instance for fluent chaining
T maxSidebarWidth(double propval)Set `maxSidebarWidth` property. Params: propval = The maximum sidebar width.
T minSidebarWidth(double propval)Set `minSidebarWidth` property. Params: propval = The minimum sidebar width.
T showContent(bool propval)Set `showContent` property. Params: propval = Determines the visible page when collapsed.
T sidebar(adw.navigation_page.NavigationPage propval)Set `sidebar` property. Params: propval = The sidebar widget. Returns: Builder instance for fluent chaining
T sidebarWidthFraction(double propval)Set `sidebarWidthFraction` property. Params: propval = The preferred sidebar width as a fraction of the total width.
T sidebarWidthUnit(adw.types.LengthUnit propval)Set `sidebarWidthUnit` property. Params: propval = The length unit for minimum and maximum sidebar widths.