1.11 <AdwBottomSheet>

Class: <AdwBottomSheet>

It derives from <GtkWidget>.

A bottom sheet with an optional bottom bar.

<AdwBottomSheet> has three child widgets. BottomSheet:content is shown persistently. BottomSheet:sheet is displayed above it when it’s open, and 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 BottomSheet:full-width is set to FALSE. In this case, BottomSheet:align determines where along the bottom edge they are placed.

Bottom bar can be hidden using the 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 Dialog.

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

By default, the bottom sheet has an overlaid drag handle. It can be disabled by setting 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 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 BottomSheet:can-open or BottomSheet:can-close to FALSE.

In some cases, particularly when using a full-width bottom bar, it may be necessary to shift BottomSheet:content upwards. Use the BottomSheet:bottom-bar-height and 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 MultiLayoutView.

Sizing

Unlike 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 <GtkScrolledWindow>, make sure to set scrolled-window:propagate-natural-height to TRUE.

Header Bar Integration

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

‘AdwBottomSheet‘ as ‘GtkBuildable‘:

The <AdwBottomSheet> implementation of the <GtkBuildable> 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.

Properties

Property: bottom-sheet:align self

Horizontal alignment of the bottom sheet.

0 means the bottom sheet is flush with the start edge, 1 means it’s flush with the end edge. 0.5 means it’s centered.

Only used when BottomSheet:full-width is set to FALSE.

Its value is a real number.

Set it with (set! (bottom-sheet:align self) value).

Property: bottom-sheet:bottom-bar self

The bottom bar widget.

Shown when BottomSheet:open is FALSE. When open, morphs into the BottomSheet:sheet.

Bottom bar can be temporarily hidden using the BottomSheet:reveal-bottom-bar property.

Its value is a <GtkWidget>, or #f.

Set it with (set! (bottom-sheet:bottom-bar self) value).

Property: bottom-sheet:bottom-bar-height self

The current bottom bar height.

It can be used to shift the content upwards permanently to accommodate for the bottom bar.

Its value is a 32-bit integer.

It is read only.

Property: bottom-sheet:can-close self

Whether the bottom sheet can be closed by user.

It can be closed via the close button, swiping down, pressing Escape or clicking the content dimming (when modal).

Bottom sheet can still be closed using BottomSheet:open.

Its value is a boolean.

Set it with (set! (bottom-sheet:can-close self) value).

Property: bottom-sheet:can-open self

Whether the bottom sheet can be opened by user.

It can be opened via clicking or swiping up from the bottom bar.

Does nothing if BottomSheet:bottom-bar is not set.

Bottom sheet can still be opened using BottomSheet:open.

Its value is a boolean.

Set it with (set! (bottom-sheet:can-open self) value).

Property: bottom-sheet:content self

The content widget.

It’s always shown, and the bottom sheet is overlaid over it.

Its value is a <GtkWidget>, or #f.

Set it with (set! (bottom-sheet:content self) value).

Property: bottom-sheet:full-width self

Whether the bottom sheet takes the full width.

When full width, BottomSheet:align is ignored.

Its value is a boolean.

Set it with (set! (bottom-sheet:full-width self) value).

Property: bottom-sheet:modal self

Whether the bottom sheet is modal.

When modal, BottomSheet:content will be dimmed when the bottom sheet is open, and clicking it will close the bottom sheet. It also cannot be focused with keyboard.

Otherwise, the content is accessible even when the bottom sheet is open.

Its value is a boolean.

Set it with (set! (bottom-sheet:modal self) value).

Property: bottom-sheet:open self

Whether the bottom sheet is open.

Its value is a boolean.

Set it with (set! (bottom-sheet:open self) value).

Property: bottom-sheet:reveal-bottom-bar self

Whether to reveal the bottom bar.

The transition will be animated.

See BottomSheet:bottom-bar and BottomSheet:bottom-bar-height.

Its value is a boolean.

Set it with (set! (bottom-sheet:reveal-bottom-bar self) value).

Property: bottom-sheet:sheet self

The bottom sheet widget.

Only shown when BottomSheet:open is TRUE.

Its value is a <GtkWidget>, or #f.

Set it with (set! (bottom-sheet:sheet self) value).

Property: bottom-sheet:sheet-height self

The current bottom sheet height.

It can be used to shift the content upwards when the bottom sheet is open.

Its value is a 32-bit integer.

It is read only.

Property: bottom-sheet:show-drag-handle self

Whether to overlay a drag handle in the bottom sheet.

The handle will be overlaid over BottomSheet:sheet.

When the handle is shown, HeaderBar will hide its default title, and ToolbarView will reserve space if there are no top bars.

Showing drag handle also allows to swipe the bottom sheet down (and to swipe the bottom bar up) with a pointer, instead of just touchscreen.

Its value is a boolean.

Set it with (set! (bottom-sheet:show-drag-handle self) value).

Procedures

Method: bottom-sheet:get-align self ⇒ %return
Method: get-align self ⇒ %return

Gets horizontal alignment of the bottom sheet.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

%return

Returned: a real number.

the horizontal alignment

Method: bottom-sheet:get-bottom-bar self ⇒ %return
Method: get-bottom-bar self ⇒ %return

Gets the bottom bar widget for self.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

%return

Returned: a <GtkWidget>, or #f.

the bottom bar widget

Method: bottom-sheet:get-bottom-bar-height self ⇒ %return
Method: get-bottom-bar-height self ⇒ %return

Gets the current bottom bar height.

It can be used to shift the content upwards permanently to accommodate for the bottom bar.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

%return

Returned: a 32-bit integer.

the bottom bar height

Method: bottom-sheet:get-can-close? self ⇒ %return
Method: get-can-close? self ⇒ %return

Gets whether the bottom sheet can be closed by user.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

%return

Returned: a boolean.

whether the sheet can be closed by user

Method: bottom-sheet:get-can-open? self ⇒ %return
Method: get-can-open? self ⇒ %return

Gets whether the bottom sheet can be opened by user.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

%return

Returned: a boolean.

whether the sheet can be opened by user.

Method: bottom-sheet:get-content self ⇒ %return
Method: get-content self ⇒ %return

Gets the content widget for self.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

%return

Returned: a <GtkWidget>, or #f.

the content widget

Method: bottom-sheet:get-full-width? self ⇒ %return
Method: get-full-width? self ⇒ %return

Gets whether the bottom sheet takes the full width.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

%return

Returned: a boolean.

whether the sheet takes up the full width

Method: bottom-sheet:get-modal? self ⇒ %return
Method: get-modal? self ⇒ %return

Gets whether the bottom sheet is modal.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

%return

Returned: a boolean.

whether the sheet is modal

Method: bottom-sheet:get-open? self ⇒ %return
Method: get-open? self ⇒ %return

Gets whether the bottom sheet is open.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

%return

Returned: a boolean.

whether the sheet is open

Method: bottom-sheet:get-reveal-bottom-bar? self ⇒ %return
Method: get-reveal-bottom-bar? self ⇒ %return

Gets whether the bottom bar is revealed.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

%return

Returned: a boolean.

whether the bottom bar is revealed

Method: bottom-sheet:get-sheet self ⇒ %return
Method: get-sheet self ⇒ %return

Gets the bottom sheet widget for self.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

%return

Returned: a <GtkWidget>, or #f.

the sheet widget

Method: bottom-sheet:get-sheet-height self ⇒ %return
Method: get-sheet-height self ⇒ %return

Gets the current bottom sheet height.

It can be used to shift the content upwards when the bottom sheet is open.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

%return

Returned: a 32-bit integer.

the sheet height

Method: bottom-sheet:get-show-drag-handle? self ⇒ %return
Method: get-show-drag-handle? self ⇒ %return

Gets whether to show a drag handle in the bottom sheet.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

%return

Returned: a boolean.

whether to show the drag handle

Procedure: bottom-sheet:new ⇒ %return

Creates a new <AdwBottomSheet>.

%return

Returned: a <GtkWidget>.

the new created <AdwBottomSheet>

Method: bottom-sheet:set-align self align
Method: set-align self align

Sets horizontal alignment of the bottom sheet.

0 means the bottom sheet is flush with the start edge, 1 means it’s flush with the end edge. 0.5 means it’s centered.

Only used when BottomSheet:full-width is set to FALSE.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

align

Passed: a real number.

the new alignment

Method: bottom-sheet:set-bottom-bar self [bottom-bar]
Method: set-bottom-bar self [bottom-bar]

Sets the bottom bar widget for self.

Shown when BottomSheet:open is FALSE. When open, morphs into the BottomSheet:sheet.

Bottom bar can be temporarily hidden using the BottomSheet:reveal-bottom-bar property.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

bottom-bar

Passed, or left out: a <GtkWidget>, or #f.

the bottom bar widget

Method: bottom-sheet:set-can-close self can-close
Method: set-can-close self can-close

Sets whether the bottom sheet can be closed by user.

It can be closed via the close button, swiping down, pressing Escape or clicking the content dimming (when modal).

Bottom sheet can still be closed using BottomSheet:open.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

can-close

Passed: a boolean.

whether the sheet can be closed by user

Method: bottom-sheet:set-can-open self can-open
Method: set-can-open self can-open

Sets whether the bottom sheet can be opened by user.

It can be opened via clicking or swiping up from the bottom bar.

Does nothing if BottomSheet:bottom-bar is not set.

Bottom sheet can still be opened using BottomSheet:open.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

can-open

Passed: a boolean.

whether the sheet can be opened by user.

Method: bottom-sheet:set-content self [content]
Method: set-content self [content]

Sets the content widget for self.

It’s always shown, and the bottom sheet is overlaid over it.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

content

Passed, or left out: a <GtkWidget>, or #f.

the content widget

Method: bottom-sheet:set-full-width self full-width
Method: set-full-width self full-width

Sets whether the bottom sheet takes the full width.

When full width, BottomSheet:align is ignored.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

full-width

Passed: a boolean.

whether the sheet takes up the full width

Method: bottom-sheet:set-modal self modal
Method: set-modal self modal

Sets whether the bottom sheet is modal.

When modal, BottomSheet:content will be dimmed when the bottom sheet is open, and clicking it will close the bottom sheet. It also cannot be focused with keyboard.

Otherwise, the content is accessible even when the bottom sheet is open.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

modal

Passed: a boolean.

whether the sheet is modal

Method: bottom-sheet:set-open self open
Method: set-open self open

Sets whether the bottom sheet is open.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

open

Passed: a boolean.

whether to open the sheet

Method: bottom-sheet:set-reveal-bottom-bar self reveal
Method: set-reveal-bottom-bar self reveal

Sets whether to reveal the bottom bar.

The transition will be animated.

See BottomSheet:bottom-bar and BottomSheet:bottom-bar-height.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

reveal

Passed: a boolean.

whether to reveal the bottom bar

Method: bottom-sheet:set-sheet self [sheet]
Method: set-sheet self [sheet]

Sets the bottom sheet widget for self.

Only shown when BottomSheet:open is TRUE.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

sheet

Passed, or left out: a <GtkWidget>, or #f.

the sheet widget

Method: bottom-sheet:set-show-drag-handle self show-drag-handle
Method: set-show-drag-handle self show-drag-handle

Sets whether to show a drag handle in the bottom sheet.

The handle will be overlaid over BottomSheet:sheet.

When the handle is shown, HeaderBar will hide its default title, and ToolbarView will reserve space if there are no top bars.

Showing drag handle also allows to swipe the bottom sheet down (and to swipe the bottom bar up) with a pointer, instead of just touchscreen.

self

Passed: a <AdwBottomSheet>.

a bottom sheet

show-drag-handle

Passed: a boolean.

whether to show the drag handle

Signals

Signal: bottom-sheet:close-attempt

Connect a handler with (connect object bottom-sheet:close-attempt handler). It is called as (handler self).

Emitted when the close button or shortcut is used while Dialog:can-close is set to FALSE.

self

Passed: a <AdwBottomSheet>.