BottomSheet
A bottom sheet with an optional bottom bar.
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.
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.
Since
1.6
Constructors
Properties
The current bottom bar height.
The current bottom sheet height.
Whether to overlay a drag handle in the bottom sheet.
Functions
Emitted when the close button or shortcut is used while property@Dialog:can-close is set to FALSE
.
Gets the bottom bar widget for @self.
Gets the current bottom bar height.
Gets the progress @self will snap back to after the gesture is canceled.
Gets whether the bottom sheet can be closed by user.
Gets whether the bottom sheet can be opened by user.
Gets the content widget for @self.
Gets the swipe distance of @self.
Gets whether the bottom sheet takes the full width.
Gets the current progress of @self.
Gets the current bottom sheet height.
Gets whether to show a drag handle in the bottom sheet.
Gets the area @self can start a swipe from for the given direction and gesture type.
Sets the bottom bar widget for @self.
Sets whether the bottom sheet can be closed by user.
Sets whether the bottom sheet can be opened by user.
Sets the content widget for @self.
Sets whether the bottom sheet takes the full width.
Sets whether to show a drag handle in the bottom sheet.