View Switching
When your window has several peer pages and shows one at a time, put the pages in a view stack and give the user a switcher to pick between them. Five switchers are on this page, and all of them adapt to the window: a wide desktop gets the full switcher and a narrow phone gets a collapsed one.
View Switcher
Section titled “View Switcher”The standard switcher: one segmented control whose buttons each carry a page’s
icon and label, driving a paired view stack. Its policy decides the
button layout. wide puts the icon and label side by side; narrow stacks the
icon above the label so the bar fits a slim window. An adaptive layout normally
swaps between the two on a breakpoint.
View Switcher Bar
Section titled “View Switcher Bar”The narrow-window half of the same pattern. When the window is too slim for a switcher in the header bar, put one at the bottom edge instead — that is a view switcher bar, pinned into a toolbar view’s bottom slot and bound to the same stack.
Tab View
Section titled “Tab View”Reach for a tab view when the pages are not fixed. Unlike a view switcher, tabs are meant to be added, closed and reordered while the app runs. The tab bar draws one chip per page, each with a title and a close button, and raises the selected chip onto the view background.
Tab Button
Section titled “Tab Button”A button that stands in for a tab bar when there is no room for one. It shows
how many pages its view holds, and lights a dot when a page you are not
looking at needs attention. The number gets smaller from ten pages and gives way
to a glyph at a hundred. Pair it with an action that opens a tab overview, and
listen to clicked to do so.
Tab Bar
Section titled “Tab Bar”The tab bar on its own. libadwaita keeps it a separate widget from the view it drives,
bound through its view property, which is what lets one bar sit over a view it does not
own — a header bar of its own, or a strip that belongs to the window rather than to the
pages. Adw.TabView carries a merged bar of its own, so reach for this one when the bar
and the view are two things in your layout.
Each tab is a chip with the page’s title, its icon and its close button. Two action widgets may sit either side of the chips, and inverted swaps the order inside every chip: the close button moves to the leading edge and the indicator to the trailing one.
Tab Overview
Section titled “Tab Overview”The overview is every page at once: a grid of thumbnails over the tab view, with the page title under each one and its own close button on it. It is meant to be the direct child of the window, with the tab view as its child — opening it covers that view and closing it gives it back.
The header bar counts the open pages (3 Tabs, 1 Tab for a single page) and carries the search button; the search matches titles, tooltips and each page’s keyword, so a browser can make its URLs findable. Turn enable-search off and the button goes, leaving a bar that shows nothing worth showing — which is also what happens when the secondary menu is unset and both sides’ title buttons are off.
Inline View Switcher
Section titled “Inline View Switcher”When a full switcher is too wide for the space, use the inline one. It is built from a linked toggle group and drives the same kind of view stack, but its display mode lets each toggle show labels, icons or both. That makes it fit a header bar or a tight toolbar.
View Switcher Sidebar
Section titled “View Switcher Sidebar”The one Adw switcher built out of a sidebar, and the one whose rows can be
grouped into sections. Point it at a view stack and each page becomes a row with
its icon, its title and — when it asks — an unread dot or a badge count;
starts-section on a page opens a new group, headed by that page’s section-title.
It is adaptive in the sidebar’s sense: mode=“page” turns it into a page of boxed
lists, which is what a NavigationSplitView wants for its sidebar pane once the window
is too narrow for a sidebar. Keep it in sidebar mode with an OverlaySplitView,
where the pane is still a sidebar when collapsed.
Carousel
Section titled “Carousel”For onboarding screens and galleries, use a carousel: pages sit side by side and the user flicks, scrolls or clicks a page indicator to move between them. Two indicator widgets bind to a carousel, dots (shown here) and lines. Both track the fractional scroll position and grow the marker nearest the current page.
Related
Section titled “Related”- Navigation: pages, split views and the navigation stack the switchers sit above.
- Layout: the
Clampand boxes that size a switched view. - Adwaita Storybook: the same widgets in a live component browser you can poke at.