Adw.BottomSheet

g Adw.BottomSheet Adw.BottomSheet Adw.Swipeable Adw.Swipeable Adw.Swipeable->Adw.BottomSheet GObject.GInterface GObject.GInterface GObject.GInterface->Adw.Swipeable Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.Widget->Adw.BottomSheet

Subclasses:

None

Methods

Inherited:

Gtk.Widget (183), GObject.Object (37), Gtk.Accessible (17), Gtk.Buildable (1), Adw.Swipeable (5)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new ()

get_align ()

get_bottom_bar ()

get_bottom_bar_height ()

get_can_close ()

get_can_open ()

get_content ()

get_full_width ()

get_modal ()

get_open ()

get_reveal_bottom_bar ()

get_sheet ()

get_sheet_height ()

get_show_drag_handle ()

set_align (align)

set_bottom_bar (bottom_bar)

set_can_close (can_close)

set_can_open (can_open)

set_content (content)

set_full_width (full_width)

set_modal (modal)

set_open (open)

set_reveal_bottom_bar (reveal)

set_sheet (sheet)

set_show_drag_handle (show_drag_handle)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9), Adw.Swipeable (5)

Properties

Inherited:

Gtk.Widget (35), Gtk.Accessible (1)

Name

Type

Flags

Short Description

align

float

r/w/en

bottom-bar

Gtk.Widget

r/w/en

bottom-bar-height

int

r

can-close

bool

r/w/en

can-open

bool

r/w/en

content

Gtk.Widget

r/w/en

full-width

bool

r/w/en

modal

bool

r/w/en

open

bool

r/w/en

reveal-bottom-bar

bool

r/w/en

sheet

Gtk.Widget

r/w/en

sheet-height

int

r

show-drag-handle

bool

r/w/en

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Name

Short Description

close-attempt

Emitted when the close button or shortcut is used while [property`Dialog`:py:data::can-close<Adw.BottomSheet.props.can_close>] is set to FALSE.

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details

class Adw.BottomSheet(**kwargs)
Bases:

Gtk.Widget, Adw.Swipeable

Abstract:

No

Structure:

Adw.BottomSheetClass

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`:py:data::content<Adw.BottomSheet.props.content>] is shown persistently. [property`BottomSheet`:py:data::sheet<Adw.BottomSheet.props.sheet>] is displayed above it when it’s open, and [property`BottomSheet`:py:data::bottom-bar<Adw.BottomSheet.props.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`:py:data::full-width<Adw.BottomSheet.props.full_width>] is set to FALSE. In this case, [property`BottomSheet`:py:data::align<Adw.BottomSheet.props.align>] determines where along the bottom edge they are placed.

Bottom bar can be hidden using the [property`BottomSheet`:py:data::reveal-bottom-bar<Adw.BottomSheet.props.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`:py:data::open<Adw.BottomSheet.props.open>] property.

By default, the bottom sheet has an overlaid drag handle. It can be disabled by setting [property`BottomSheet`:py:data::show-drag-handle<Adw.BottomSheet.props.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`:py:data::modal<Adw.BottomSheet.props.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`:py:data::can-open<Adw.BottomSheet.props.can_open>] or [property`BottomSheet`:py:data::can-close<Adw.BottomSheet.props.can_close>] to FALSE.

In some cases, particularly when using a full-width bottom bar, it may be necessary to shift [property`BottomSheet`:py:data::content<Adw.BottomSheet.props.content>] upwards. Use the [property`BottomSheet`:py:data::bottom-bar-height<Adw.BottomSheet.props.bottom_bar_height>] and [property`BottomSheet`:py:data::sheet-height<Adw.BottomSheet.props.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`:py:data::show-drag-handle<Adw.BottomSheet.props.show_drag_handle>] is TRUE, regardless of [property`HeaderBar`:py:data::show-title<Adw.BottomSheet.props.show_title>]. This only applies to the default title, titles set with [property`HeaderBar`:py:data::title-widget<Adw.BottomSheet.props.title_widget>] will still be shown.

Adw.BottomSheet as Gtk.Buildable:

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.

New in version 1.6.

classmethod new()
Returns:

the new created AdwBottomSheet

Return type:

Gtk.Widget

Creates a new AdwBottomSheet.

New in version 1.6.

get_align()
Returns:

the horizontal alignment

Return type:

float

Gets horizontal alignment of the bottom sheet.

New in version 1.6.

get_bottom_bar()
Returns:

the bottom bar widget

Return type:

Gtk.Widget or None

Gets the bottom bar widget for self.

New in version 1.6.

get_bottom_bar_height()
Returns:

the bottom bar height

Return type:

int

Gets the current bottom bar height.

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

New in version 1.6.

get_can_close()
Returns:

whether the sheet can be closed by user

Return type:

bool

Gets whether the bottom sheet can be closed by user.

New in version 1.6.

get_can_open()
Returns:

whether the sheet can be opened by user.

Return type:

bool

Gets whether the bottom sheet can be opened by user.

New in version 1.6.

get_content()
Returns:

the content widget

Return type:

Gtk.Widget or None

Gets the content widget for self.

New in version 1.6.

get_full_width()
Returns:

whether the sheet takes up the full width

Return type:

bool

Gets whether the bottom sheet takes the full width.

New in version 1.6.

get_modal()
Returns:

whether the sheet is modal

Return type:

bool

Gets whether the bottom sheet is modal.

New in version 1.6.

get_open()
Returns:

whether the sheet is open

Return type:

bool

Gets whether the bottom sheet is open.

New in version 1.6.

get_reveal_bottom_bar()
Returns:

whether the bottom bar is revealed

Return type:

bool

Gets whether the bottom bar is revealed.

New in version 1.7.

get_sheet()
Returns:

the sheet widget

Return type:

Gtk.Widget or None

Gets the bottom sheet widget for self.

New in version 1.6.

get_sheet_height()
Returns:

the sheet height

Return type:

int

Gets the current bottom sheet height.

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

New in version 1.6.

get_show_drag_handle()
Returns:

whether to show the drag handle

Return type:

bool

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

New in version 1.6.

set_align(align)
Parameters:

align (float) – the new alignment

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 [property`BottomSheet`:py:data::full-width<Adw.BottomSheet.props.full_width>] is set to FALSE.

New in version 1.6.

set_bottom_bar(bottom_bar)
Parameters:

bottom_bar (Gtk.Widget or None) – the bottom bar widget

Sets the bottom bar widget for self.

Shown when [property`BottomSheet`:py:data::open<Adw.BottomSheet.props.open>] is FALSE. When open, morphs into the [property`BottomSheet`:py:data::sheet<Adw.BottomSheet.props.sheet>].

Bottom bar can be temporarily hidden using the [property`BottomSheet`:py:data::reveal-bottom-bar<Adw.BottomSheet.props.reveal_bottom_bar>] property.

New in version 1.6.

set_can_close(can_close)
Parameters:

can_close (bool) – whether the sheet can be closed by user

Sets whether the bottom sheet can be closed by user.

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

Bottom sheet can still be closed using [property`BottomSheet`:py:data::open<Adw.BottomSheet.props.open>].

New in version 1.6.

set_can_open(can_open)
Parameters:

can_open (bool) – whether the sheet can be opened by user.

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 [property`BottomSheet`:py:data::bottom-bar<Adw.BottomSheet.props.bottom_bar>] is not set.

Bottom sheet can still be opened using [property`BottomSheet`:py:data::open<Adw.BottomSheet.props.open>].

New in version 1.6.

set_content(content)
Parameters:

content (Gtk.Widget or None) – the content widget

Sets the content widget for self.

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

New in version 1.6.

set_full_width(full_width)
Parameters:

full_width (bool) – whether the sheet takes up the full width

Sets whether the bottom sheet takes the full width.

When full width, [property`BottomSheet`:py:data::align<Adw.BottomSheet.props.align>] is ignored.

New in version 1.6.

set_modal(modal)
Parameters:

modal (bool) – whether the sheet is modal

Sets whether the bottom sheet is modal.

When modal, [property`BottomSheet`:py:data::content<Adw.BottomSheet.props.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.

New in version 1.6.

set_open(open)
Parameters:

open (bool) – whether to open the sheet

Sets whether the bottom sheet is open.

New in version 1.6.

set_reveal_bottom_bar(reveal)
Parameters:

reveal (bool) – whether to reveal the bottom bar

Sets whether to reveal the bottom bar.

The transition will be animated.

See [property`BottomSheet`:py:data::bottom-bar<Adw.BottomSheet.props.bottom_bar>] and [property`BottomSheet`:py:data::bottom-bar-height<Adw.BottomSheet.props.bottom_bar_height>].

New in version 1.7.

set_sheet(sheet)
Parameters:

sheet (Gtk.Widget or None) – the sheet widget

Sets the bottom sheet widget for self.

Only shown when [property`BottomSheet`:py:data::open<Adw.BottomSheet.props.open>] is TRUE.

New in version 1.6.

set_show_drag_handle(show_drag_handle)
Parameters:

show_drag_handle (bool) – whether to show the drag handle

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

The handle will be overlaid over [property`BottomSheet`:py:data::sheet<Adw.BottomSheet.props.sheet>].

When the handle is shown, [class`HeaderBar`] will hide its default title, and [class`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.

New in version 1.6.

Signal Details

Adw.BottomSheet.signals.close_attempt(bottom_sheet)
Signal Name:

close-attempt

Flags:

RUN_LAST

Parameters:

bottom_sheet (Adw.BottomSheet) – The object which received the signal

Emitted when the close button or shortcut is used while [property`Dialog`:py:data::can-close<Adw.BottomSheet.props.can_close>] is set to FALSE.

New in version 1.6.

Property Details

Adw.BottomSheet.props.align
Name:

align

Type:

float

Default Value:

0.5

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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 [property`BottomSheet`:py:data::full-width<Adw.BottomSheet.props.full_width>] is set to FALSE.

New in version 1.6.

Adw.BottomSheet.props.bottom_bar
Name:

bottom-bar

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The bottom bar widget.

Shown when [property`BottomSheet`:py:data::open<Adw.BottomSheet.props.open>] is FALSE. When open, morphs into the [property`BottomSheet`:py:data::sheet<Adw.BottomSheet.props.sheet>].

Bottom bar can be temporarily hidden using the [property`BottomSheet`:py:data::reveal-bottom-bar<Adw.BottomSheet.props.reveal_bottom_bar>] property.

New in version 1.6.

Adw.BottomSheet.props.bottom_bar_height
Name:

bottom-bar-height

Type:

int

Default Value:

0

Flags:

READABLE

The current bottom bar height.

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

New in version 1.6.

Adw.BottomSheet.props.can_close
Name:

can-close

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the bottom sheet can be closed by user.

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

Bottom sheet can still be closed using [property`BottomSheet`:py:data::open<Adw.BottomSheet.props.open>].

New in version 1.6.

Adw.BottomSheet.props.can_open
Name:

can-open

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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 [property`BottomSheet`:py:data::bottom-bar<Adw.BottomSheet.props.bottom_bar>] is not set.

Bottom sheet can still be opened using [property`BottomSheet`:py:data::open<Adw.BottomSheet.props.open>].

New in version 1.6.

Adw.BottomSheet.props.content
Name:

content

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The content widget.

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

New in version 1.6.

Adw.BottomSheet.props.full_width
Name:

full-width

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the bottom sheet takes the full width.

When full width, [property`BottomSheet`:py:data::align<Adw.BottomSheet.props.align>] is ignored.

New in version 1.6.

Adw.BottomSheet.props.modal
Name:

modal

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the bottom sheet is modal.

When modal, [property`BottomSheet`:py:data::content<Adw.BottomSheet.props.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.

New in version 1.6.

Adw.BottomSheet.props.open
Name:

open

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the bottom sheet is open.

New in version 1.6.

Adw.BottomSheet.props.reveal_bottom_bar
Name:

reveal-bottom-bar

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to reveal the bottom bar.

The transition will be animated.

See [property`BottomSheet`:py:data::bottom-bar<Adw.BottomSheet.props.bottom_bar>] and [property`BottomSheet`:py:data::bottom-bar-height<Adw.BottomSheet.props.bottom_bar_height>].

New in version 1.7.

Adw.BottomSheet.props.sheet
Name:

sheet

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The bottom sheet widget.

Only shown when [property`BottomSheet`:py:data::open<Adw.BottomSheet.props.open>] is TRUE.

New in version 1.6.

Adw.BottomSheet.props.sheet_height
Name:

sheet-height

Type:

int

Default Value:

0

Flags:

READABLE

The current bottom sheet height.

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

New in version 1.6.

Adw.BottomSheet.props.show_drag_handle
Name:

show-drag-handle

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to overlay a drag handle in the bottom sheet.

The handle will be overlaid over [property`BottomSheet`:py:data::sheet<Adw.BottomSheet.props.sheet>].

When the handle is shown, [class`HeaderBar`] will hide its default title, and [class`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.

New in version 1.6.