### Class

# Adw SidebarSection

since: 1.9

#### Description [src]

    final class Adw.SidebarSection : GObject.Object
      implements Gtk.Buildable {
      /* No available fields */
    }

A section within `AdwSidebar`.

`AdwSidebarSection` contains `AdwSidebarItem` objects.

Section can optionally have a title, set with the `AdwSidebarSection:title` property. If a title is not set, the section will have a separator in front of it, or just spacing in the `ADW_SIDEBAR_MODE_PAGE` mode.

Sections can also have an arbitrary suffix widget, set with the `AdwSidebarSection:suffix` properties. It will be displayed at the end of its header.

To add items, use `adw_sidebar_section_append()`, `adw_sidebar_section_prepend()` or `adw_sidebar_section_insert()`.

To remove items, use `adw_sidebar_section_remove()` or `adw_sidebar_section_remove_all()`.

To inspect the items, use `adw_sidebar_section_get_item()` or `AdwSidebarSection:items`.

To get the sidebar the section is in, use`AdwSidebarSection:sidebar`.

## Binding models

`AdwSidebarSection` can show items from a provided `GListModel`, using `adw_sidebar_section_bind_model()`. It works the same way as `gtk_list_box_bind_model()`, except the provided function creates an `AdwSidebarItem` rather than a `GtkListBoxRow`.

While a model is bound, adding or removing items manually is not allowed. Inspecting them is still allowed, but discouraged.

## `AdwSidebarSection` as `GtkBuildable`

`AdwSidebarSection` allows adding items as children.

Example of an `AdwSidebarSection` UI definition:

    <object class="AdwSidebarSection">
      <property name="title" translatable="yes">Places</property>
      <child>
        <object class="AdwSidebarItem">
          <property name="title" translatable="yes">Music</property>
          <property name="icon-name">folder-music-symbolic</property>
        </object>
      </child>
      <child>
        <object class="AdwSidebarItem">
          <property name="title" translatable="yes">Pictures</property>
          <property name="icon-name">folder-pictures-symbolic</property>
        </object>
      </child>
      <child>
        <object class="AdwSidebarItem">
          <property name="title" translatable="yes">Videos</property>
          <property name="icon-name">folder-videos-symbolic</property>
        </object>
      </child>
    </object>

Result:

.

Available since: 1.9

#### Ancestors

- GObject

#### Implements

- GtkBuildable

#### Constructors

###### adw_sidebar_section_new

Creates a new `AdwSidebarSection`.

since: 1.9

#### Instance methods

###### adw_sidebar_section_append

Appends `item` to `self`.

since: 1.9

###### adw_sidebar_section_bind_model

Binds `model` to `self`.

since: 1.9

###### adw_sidebar_section_get_item

Gets the item at `index` within `self`.

since: 1.9

###### adw_sidebar_section_get_items

Gets a list model with `self`‘s items.

since: 1.9

###### adw_sidebar_section_get_menu_model

Gets the context menu model for `self`‘s items.

since: 1.9

###### adw_sidebar_section_get_sidebar

Gets the sidebar `self` is in.

since: 1.9

###### adw_sidebar_section_get_suffix

Gets the suffix widget for `self`.

unstable since: 1.10

###### adw_sidebar_section_get_title

Gets the title of `self`.

since: 1.9

###### adw_sidebar_section_insert

Inserts `item` at `position` to `self`.

since: 1.9

###### adw_sidebar_section_prepend

Prepends `item` to `self`.

since: 1.9

###### adw_sidebar_section_remove

Removes `item` from `self`.

since: 1.9

###### adw_sidebar_section_remove_all

Removes all items from `self`.

since: 1.9

###### adw_sidebar_section_set_menu_model

Sets the context menu model for `self`‘s items.

since: 1.9

###### adw_sidebar_section_set_suffix

Sets the suffix widget for `self`.

unstable since: 1.10

###### adw_sidebar_section_set_title

Sets the title of `self`.

since: 1.9

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from GtkBuildable (1)

###### gtk_buildable_get_buildable_id

Gets the ID of the `buildable` object.

#### Properties

###### Adw.SidebarSection:items

A list model with the section’s items.

since: 1.9

###### Adw.SidebarSection:menu-model

Context menu model for the section items.

since: 1.9

###### Adw.SidebarSection:sidebar

The sidebar the section is in.

since: 1.9

###### Adw.SidebarSection:suffix

The suffix widget for this section.

unstable since: 1.10

###### Adw.SidebarSection:title

Title of the section.

since: 1.9

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct AdwSidebarSectionClass {
      GObjectClass parent_class;

    }

No description available.

###### Class members

`parent_class: GObjectClass`

  No description available.