BottomSheet


Object Hierarchy:

Object hierarchy for BottomSheet

Description:

[ CCode ( type_id = "adw_bottom_sheet_get_type ()" ) ]
[ Version ( since = "1.6" ) ]
public sealed class BottomSheet : Widget, Swipeable, Accessible, Buildable, ConstraintTarget

A bottom sheet with an optional bottom bar.

<picture> <source srcset="bottom-sheet-dark.png" media="(prefers-color-scheme: dark)"> <img src="bottom-sheet.png" alt="bottom-sheet"> </picture>

`AdwBottomSheet` has three child widgets. [property@BottomSheet:content] is shown persistently. [property@BottomSheet:sheet] is displayed above it when it's open, and [property@BottomSheet:bottom-bar] is displayed when it's not.

Bottom sheet and bottom bar are attached to the bottom edge of the widget. They take the full width by default, but can only take a portion of it if [property@BottomSheet:full-width] is set to `FALSE`. In this case, [property@BottomSheet:align] determines where along the bottom edge they are placed.

Bottom bar can be hidden using the [property@BottomSheet:reveal-bottom-bar] property.

`AdwBottomSheet` can be useful for applications such as music players, that want to have a persistent bottom bar that expands into a bottom sheet when clicked. It's meant for cases where a bottom sheet is tightly integrated into the UI. For more transient bottom sheets, see [class@Dialog].

To open or close the bottom sheet, use the [property@BottomSheet:open] property.

By default, the bottom sheet has an overlaid drag handle. It can be disabled by setting [property@BottomSheet:show-drag-handle] to `FALSE`. Note that the handle also controls whether the sheet can be dragged using a pointer.

Bottom sheets are modal by default, meaning that the content is dimmed and cannot be accessed while the sheet is open. Set [ property@BottomSheet:modal] to `FALSE` if this behavior is unwanted.

To disable user interactions for opening or closing the bottom sheet (such as swipes or clicking the bottom bar or close button), set [ property@BottomSheet:can-open] or [property@BottomSheet:can-close] to `FALSE`.

In some cases, particularly when using a full-width bottom bar, it may be necessary to shift [property@BottomSheet:content] upwards. Use the [property@BottomSheet:bottom-bar-height] and [property@BottomSheet:sheet-height] for that.

`AdwBottomSheet` is not adaptive, and for larger window sizes applications may want to replace it with another UI, such as a sidebar. This can be done using [class@MultiLayoutView].

Sizing

Unlike [class@Dialog] presented as a bottom sheet, `AdwBottomSheet` just follows the content's natural size, and it's up to the applications to make sure their content provides one. For example, when using [class@Gtk.ScrolledWindow], make sure to set [ property@Gtk.ScrolledWindow:propagate-natural-height] to `TRUE`.

Header Bar Integration

When placed inside an `AdwBottomSheet`, [class@HeaderBar] will not show the title when [property@BottomSheet:show-drag-handle] is `TRUE`, regardless of [property@HeaderBar:show-title]. This only applies to the default title, titles set with [property@HeaderBar:title-widget] will still be shown.

`AdwBottomSheet` as `GtkBuildable`:

The `AdwBottomSheet` implementation of the [iface@Gtk.Buildable] interface supports setting the sheet widget by specifying “sheet” as the “type” attribute of a `<child>` element, and the bottom bar by specifying “bottom-bar”. Specifying “content” or omitting the child type results in setting the content child.


Namespace: Adw
Package: libadwaita-1

Content:

Properties:

Creation methods:

Methods:

Signals:

Inherited Members:

All known members inherited from class Gtk.Widget
All known members inherited from interface Adw.Swipeable