Adw.BottomSheet¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Widget (183), GObject.Object (37), Gtk.Accessible (17), Gtk.Buildable (1), Adw.Swipeable (5)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
|||
r/w/en |
|||
r |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r |
|||
r/w/en |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted when the close button or shortcut is used while [property`Dialog`:py:data::can-close<Adw.BottomSheet.props.can_close>] is set to |
Fields¶
- Inherited:
Class Details¶
- class Adw.BottomSheet(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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] toTRUE
.- 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>] isTRUE
, 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.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:
Creates a new
AdwBottomSheet
.New in version 1.6.
- get_align()¶
- Returns:
the horizontal alignment
- Return type:
Gets horizontal alignment of the bottom sheet.
New in version 1.6.
- get_bottom_bar()¶
- Returns:
the bottom bar widget
- Return type:
Gtk.Widget
orNone
Gets the bottom bar widget for self.
New in version 1.6.
- get_bottom_bar_height()¶
- Returns:
the bottom bar height
- Return type:
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:
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:
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
orNone
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:
Gets whether the bottom sheet takes the full width.
New in version 1.6.
- get_modal()¶
- Returns:
whether the sheet is modal
- Return type:
Gets whether the bottom sheet is modal.
New in version 1.6.
- get_open()¶
- Returns:
whether the sheet is open
- Return type:
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:
Gets whether the bottom bar is revealed.
New in version 1.7.
- get_sheet()¶
- Returns:
the sheet widget
- Return type:
Gtk.Widget
orNone
Gets the bottom sheet widget for self.
New in version 1.6.
- get_sheet_height()¶
- Returns:
the sheet height
- Return type:
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:
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
orNone
) – 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
orNone
) – 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
orNone
) – 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:
- 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:
- Default Value:
0.5
- Flags:
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:
- Default Value:
- Flags:
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¶
-
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:
- Default Value:
- Flags:
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:
- Default Value:
- Flags:
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:
- Default Value:
- Flags:
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:
- Default Value:
- Flags:
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:
- Default Value:
- Flags:
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:
- Default Value:
- Flags:
Whether the bottom sheet is open.
New in version 1.6.
- Adw.BottomSheet.props.reveal_bottom_bar¶
- Name:
reveal-bottom-bar
- Type:
- Default Value:
- Flags:
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:
- Default Value:
- Flags:
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¶
-
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:
- Default Value:
- Flags:
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.