Buttons
The two buttons on this page belong to GTK. Gtk.Button is the plain button
every other one is built on, and Gtk.MenuButton is the one whose press opens a
menu. Libadwaita ships neither, and the Adwaita stylesheet gives both their GNOME
shape.
The buttons libadwaita does ship are on Adwaita Buttons, which covers button content, the split button and the toggle group.
Each block below is a stack of windows. The first one RUNS the widget: the preview
is the live browser port, so it follows the light and dark toggle the way a real
window would, and the HTML tab beside it holds the very markup that paints it —
one import '@gjsify/adwaita-web' registers every element in it. Then comes
one window per kind of implementation — Native TypeScript, the @girs program
that runs unchanged on GJS, Node, Bun and Deno, with the matching Blueprint
declaration beside it, UI frameworks, the same widget written in Solid, Vue and
React through @gjsify/gtk-host — or, where the widget is built imperatively rather
than declared, the recorded reason it has no such snippet — and NativeScript,
the port that runs on a phone. That last window splits the way the first one does. An
XML template holds the tree, and the TypeScript beside it is the loader.
GTK 4 is the reference here, typed by
@girs/gtk-4.0. The browser port
spells both buttons the way the GIR does — <gtk-button> and <gtk-menu-button>,
the same tags @gjsify/gtk-host uses — because a widget is named after the library
that owns it and the Adwaita part of these two is the stylesheet. The NativeScript
port names them by the same rule, GtkButton and GtkMenuButton. Where a port
behaves differently, its own window says so.
Button Styles
Section titled “Button Styles”A plain button is Gtk.Button. Add a style class to restyle it. .pill
makes it rounded and prominent, .circular suits an icon-only button,
.suggested-action and .destructive-action colour an affirmative or a
dangerous action, and .flat drops the visible background. They compose with
each other and mean the same thing everywhere in the toolkit, so a
.destructive-action in a header bar reads like one in a dialog.
Menu Button
Section titled “Menu Button”When a button’s only job is to open a menu, use a menu button. It is the
hamburger at the end of a header bar, with no action of its own and every choice
in the popover it opens. Libadwaita ships no menu button, so this is
Gtk.MenuButton. The Adwaita stylesheet gives it the flat, rounded-square shape.
Related
Section titled “Related”- Controls: the entry and the drop down, the other two GTK widgets the Adwaita stylesheet paints.
- Adwaita Buttons: button content, the split button and the toggle group.
- Adwaita Storybook: the same widgets in a live component browser you can poke at.