Skip to content

API Reference / @gtkx/components

@gtkx/components ​

Type Aliases ​

Type AliasDescription
ColumnViewColumnOne column of a ColumnView, pairing Gtk.ColumnViewColumn props with a cell renderer.
ColumnViewPropsNative Gtk.ColumnView props with declarative columns and collections, controlled selection, expansion, and sorting.
ComboRowPropsNative Adw.ComboRow props with declarative collections, controlled selection, and display/popup renderers.
DropDownPropsNative Gtk.DropDown props with declarative collections, controlled selection, and display/popup renderers.
ExpanderDescriptionsWording a screen reader announces for the control that expands and collapses a row. GTK names that control after the row's own content and reports whether it is expanded, but says nothing about what activating it does, so these strings supply that and belong in the application's own language.
GridViewPropsNative Gtk.GridView props with declarative cells, controlled selection, and estimated sizing.
ListItemA single item in a collection model, identified by a stable id and holding an arbitrary value. Nested items form a tree. I narrows the id to the application's own union of ids, which the selection and expansion props of the view rendering the items then share.
ListItemFactoryProps-
ListItemRenderArgsArguments passed to a ListItemRenderer when rendering one cell.
ListItemRendererRenders the contents of one cell of a collection view.
ListRowPropsProperties applied to the row that carries one item: the Gtk.ListItem of a list or grid, or the Gtk.ColumnViewRow of a table. Neither is a widget, so these are the only handles they offer; anything omitted falls back to the row's own default, which leaves the accessibility strings unset rather than setting them to an empty string.
ListRowPropsResolverReturns the ListRowProps to apply to the row displaying one item, re-run whenever the item renders.
ListSectionA group of items rendered under a shared section header.
ListSectionRenderArgsArguments passed to a ListSectionRenderer when rendering one section header.
ListSectionRendererRenders the contents of one section header of a collection view.
ListViewPropsNative Gtk.ListView props with declarative rows and sections, controlled selection and expansion, and estimated sizing.
StatefulActionPropsProps of a StatefulAction whose state is a boolean or a string, with the GVariant type inferred from the value. T narrows a string state to the application's own union of choices.
ToastControllerImperative controls for toasts, returned by useToast.
ToastOptionsDescribes a toast raised through useToast: the construct-time properties of an Adw.Toast plus its button-clicked and dismissed handlers.
ToastProviderPropsProps for ToastProvider.
TypedStatefulActionPropsProps of a StatefulAction whose state has the GVariant type stateType.

Variables ​

VariableDescription
ColumnViewRenders a Gtk.ColumnView from declarative items or sections and a columns array, with controlled selection, expansion, and sorting, per-column header menus, section header rendering, and per-row props such as a screen-reader label.
ComboRowRenders an Adw.ComboRow backed by a collection model, presenting the same choice as a DropDown in the shape of a preferences row, with customizable renderers for the row display, popup rows, and popup section headers, and controlled selection.
DropDownRenders a Gtk.DropDown backed by a collection model, with customizable renderers for the collapsed display, popup rows, and popup section headers, and controlled selection.
GridViewRenders a Gtk.GridView of uniform cells from declarative items, with per-cell rendering, controlled selection, and estimated item sizing.
ListViewRenders a Gtk.ListView from declarative items or sections, with per-row rendering, controlled selection, controlled tree expansion, and estimated item sizing.
StatefulActionRenders a Gio.SimpleAction whose state is a plain JavaScript value instead of a GLib.Variant. The state is controlled: a menu item, a button or an activation only requests a new state through onStateChange, and the action changes when state does. A boolean state makes a toggle. Any other state makes a choice that an item selects by passing the value as its target.

Functions ​

FunctionDescription
ListItemFactoryCreates a Gtk.SignalListItemFactory that renders objects from an existing native model with React. Estimated dimensions keep cells stable until their content mounts.
ToastOverlayRenders an Adw.ToastOverlay and registers it with the nearest ToastProvider, whose useToast callers then show their toasts over its content.
ToastProviderGives useToast in every descendant the ToastOverlay rendered below it. With several overlays, toasts go to the one mounted last.
useToastReturns a ToastController that shows and dismisses toasts on the nearest provider's overlay.