Text
Four GTK widgets, and libadwaita ships none of them: it styles the text and textview
nodes they draw. They are Text (the single-line field an entry is built from), Text
View (the multi-line editor), Editable Label (a label that becomes a field on a click)
and the Search Bar that reveals a search entry. A field that belongs in a preferences
group is an Entry Row instead, and the search
entry the strip reveals is a Gtk.SearchEntry.
Gtk.Text is the single-line text widget every entry is built on — Gtk.Entry,
Gtk.PasswordEntry and Gtk.SpinButton each keep one inside. On its own it is a plain
field: a text to seed it, a placeholder-text for what belongs in it while it is
empty, and a max-length the field refuses to pass (counted in characters, not bytes).
visibility="false" masks what is typed, and propagate-text-width grows the field with
its text instead of letting it fill its container.
Text View
Section titled “Text View”The multi-line editor. Its text lives in a Gtk.TextBuffer rather than in a property of
the view’s own, which is why a static tree cannot carry it — and why the framework tabs of
this block are refused rather than showing an empty box. wrap-mode is Pango’s own enum
(none by default, so lines do not wrap), justification aligns the lines with each
other, monospace draws the text in a fixed-width face, and the four margins are the
space inside the widget the text sits in — GTK’s own property doc says “in CSS terms, the
value set here is padding”.
accepts-tab defaults to TRUE, which is the opposite of a browser’s: Tab inserts a tab
character and keeps the focus in the view.
Editable Label
Section titled “Editable Label”A label you click and edit in place: GtkEditableLabel is a stack of a label and an entry,
and editing says which of the two is showing. Enter starts editing, Enter in the field
commits, Escape discards it, and editable="false" leaves it a plain label.
Because editing starts the edit mode as GTK’s property setter does, an attribute is all
it takes — which is also why the preview below shows the label and leaves the mode to the
reader.
Search Bar
Section titled “Search Bar”Gtk.SearchBar reveals a search entry when a search starts. The property search-mode
enabled IS the revealer’s reveal-child, so one boolean decides both whether the strip is
shown and whether the search is on — and hiding it clears the entry, so a dismissed search
leaves nothing behind. show-close-button adds the round close button at its end; an app
with its own search toggle should leave it off, because the two say the same thing.
The bar takes any editable as its child. Gtk.SearchEntry is the one libadwaita styles for
it, and the C has a branch for a plain Gtk.Entry too, so either works — a Gtk.SearchEntry
belongs on Controls when this port has one.
What the NativeScript port has
Section titled “What the NativeScript port has”None of these four. @gjsify/adwaita-nativescript has GtkEntry for a single-line field
and GtkLabel for a read-only run of text, so the first three would each be an expression
built out of what it already has — and the search bar is a revealer plus a key-capture
widget, which the port’s theme has no shape for. The XML template tab of each block above
says so instead of showing one, and the reasons are in
the Adwaita ports ledger.
Related
Section titled “Related”- Controls: the entry this text widget is the delegate of, and the drop down.
- Buttons: the button a search bar’s close button is.
- Adwaita Storybook: the same widgets in a live component browser you can poke at.