TabBar

class TabBar(**properties: Any)

Superclasses: Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, Buildable, ConstraintTarget

A tab bar for TabView.

https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/tab-bar.png

The AdwTabBar widget is a tab bar that can be used with conjunction with AdwTabView. It is typically used as a top bar within ToolbarView.

AdwTabBar can autohide and can optionally contain action widgets on both sides of the tabs.

When there’s not enough space to show all the tabs, AdwTabBar will scroll them. Pinned tabs always stay visible and aren’t a part of the scrollable area.

CSS nodes

AdwTabBar has a single CSS node with name tabbar.

Constructors

class TabBar
classmethod new() TabBar

Creates a new AdwTabBar.

Methods

class TabBar
get_autohide() bool

Gets whether the tabs automatically hide.

get_end_action_widget() Widget | None

Gets the widget shown after the tabs.

get_expand_tabs() bool

Gets whether tabs expand to full width.

get_extra_drag_preferred_action() DragAction

Gets the current action during a drop on the extra_drop_target.

Added in version 1.4.

get_extra_drag_preload() bool

Gets whether drop data should be preloaded on hover.

Added in version 1.3.

get_inverted() bool

Gets whether tabs use inverted layout.

get_is_overflowing() bool

Gets whether self is overflowing.

If TRUE, all tabs cannot be displayed at once and require scrolling.

get_start_action_widget() Widget | None

Gets the widget shown before the tabs.

get_tabs_revealed() bool

Gets whether the tabs are currently revealed.

See autohide.

get_view() TabView | None

Gets the tab view self controls.

set_autohide(autohide: bool) None

Sets whether the tabs automatically hide.

If set to TRUE, the tab bar disappears when view has 0 or 1 tab, no pinned tabs, and no tab is being transferred.

See tabs_revealed.

Parameters:

autohide – whether the tabs automatically hide

set_end_action_widget(widget: Widget | None = None) None

Sets the widget to show after the tabs.

Parameters:

widget – the widget to show after the tabs

set_expand_tabs(expand_tabs: bool) None

Sets whether tabs expand to full width.

If set to TRUE, the tabs will always vary width filling the whole width when possible, otherwise tabs will always have the minimum possible size.

Parameters:

expand_tabs – whether to expand tabs

set_extra_drag_preload(preload: bool) None

Sets whether drop data should be preloaded on hover.

See preload.

Added in version 1.3.

Parameters:

preload – whether to preload drop data

set_inverted(inverted: bool) None

Sets whether tabs tabs use inverted layout.

If set to TRUE, non-pinned tabs will have the close button at the beginning and the indicator at the end rather than the opposite.

Parameters:

inverted – whether tabs use inverted layout

set_start_action_widget(widget: Widget | None = None) None

Sets the widget to show before the tabs.

Parameters:

widget – the widget to show before the tabs

set_view(view: TabView | None = None) None

Sets the tab view self controls.

Parameters:

view – a tab view

setup_extra_drop_target(actions: DragAction, types: Sequence[type] | None = None) None

Sets the supported types for this drop target.

Sets up an extra drop target on tabs.

This allows to drag arbitrary content onto tabs, for example URLs in a web browser.

If a tab is hovered for a certain period of time while dragging the content, it will be automatically selected.

The extra_drag_drop signal can be used to handle the drop.

Parameters:
  • actions – the supported actions

  • types – all supported GType’s that can be dropped

Properties

class TabBar
props.autohide: bool

Whether the tabs automatically hide.

If set to TRUE, the tab bar disappears when view has 0 or 1 tab, no pinned tabs, and no tab is being transferred.

See tabs_revealed.

props.end_action_widget: Widget

The widget shown after the tabs.

props.expand_tabs: bool

Whether tabs expand to full width.

If set to TRUE, the tabs will always vary width filling the whole width when possible, otherwise tabs will always have the minimum possible size.

props.extra_drag_preferred_action: DragAction

The unique action on the current-drop of the extra_drag_drop.

This property should only be used during a extra_drag_drop and is always a subset of what was originally passed to setup_extra_drop_target.

Added in version 1.4.

props.extra_drag_preload: bool

Whether the drop data should be preloaded on hover.

See preload.

Added in version 1.3.

props.inverted: bool

Whether tabs use inverted layout.

If set to TRUE, non-pinned tabs will have the close button at the beginning and the indicator at the end rather than the opposite.

props.is_overflowing: bool

Whether the tab bar is overflowing.

If TRUE, all tabs cannot be displayed at once and require scrolling.

props.start_action_widget: Widget

The widget shown before the tabs.

props.tabs_revealed: bool

Whether the tabs are currently revealed.

See autohide.

props.view: TabView

The tab view the tab bar controls.

Signals

class TabBar.signals
extra_drag_drop(page: TabPage, value: Any) bool

This signal is emitted when content is dropped onto a tab.

The content must be of one of the types set up via setup_extra_drop_target.

See drop.

Parameters:
  • page – the page matching the tab the content was dropped onto

  • value – the GValue being dropped

extra_drag_value(page: TabPage, value: Any) DragAction

This signal is emitted when the dropped content is preloaded.

In order for data to be preloaded, extra_drag_preload must be set to TRUE.

The content must be of one of the types set up via setup_extra_drop_target.

See value.

Added in version 1.3.

Parameters:
  • page – the page matching the tab the content was dropped onto

  • value – the GValue being dropped