Skip to main content

Type Alias: GtkLabelProps

GtkLabelProps = WidgetProps & object

Defined in: generated/jsx.ts:4576

Props for the GtkLabel widget.

Type Declaration

NameTypeDescriptionDefined in
attributes?Pango.AttrList | nullA list of style attributes to apply to the text of the label.generated/jsx.ts:4578
children?ReactNode-generated/jsx.ts:4766
ellipsize?Pango.EllipsizeModeThe preferred place to ellipsize the string, if the label does not have enough room to display the entire string. Note that setting this property to a value other than [enum.Pango.EllipsizeMode.none] has the side-effect that the label requests only enough space to display the ellipsis "...". In particular, this means that ellipsizing labels do not work well in notebook tabs, unless the NotebookPage.tab-expand child property is set to true. Other ways to set a label's width are Widget.set_size_request and Label.set_width_chars.generated/jsx.ts:4592
extraMenu?Gio.MenuModel | nullA menu model whose contents will be appended to the context menu.generated/jsx.ts:4594
justify?Gtk.JustificationThe alignment of the lines in the text of the label, relative to each other. This does not affect the alignment of the label within its allocation. See Label.xalign for that.generated/jsx.ts:4601
label?stringThe contents of the label. If the string contains Pango markup (see Pangoparse_markup), you will have to set the Label.use-markup property to true in order for the label to display the markup attributes. See also Label.set_markup for a convenience function that sets both this property and the Label.use-markup property at the same time. If the string contains underlines acting as mnemonics, you will have to set the Label.use-underline property to true in order for the label to display them.generated/jsx.ts:4616
lines?numberThe number of lines to which an ellipsized, wrapping label should display before it gets ellipsized. This both prevents the label from ellipsizing before this many lines are displayed, and limits the height request of the label to this many lines. ::: warning Setting this property has unintuitive and unfortunate consequences for the minimum width of the label. Specifically, if the height of the label is such that it fits a smaller number of lines than the value of this property, the label can not be ellipsized at all, which means it must be wide enough to fit all the text fully. This property has no effect if the label is not wrapping or ellipsized. Set this property to -1 if you don't want to limit the number of lines.generated/jsx.ts:4634
maxWidthChars?numberThe desired maximum width of the label, in characters. If this property is set to -1, the width will be calculated automatically. See the section on text layout for details of how Label.width-chars and Label.max-width-chars determine the width of ellipsized and wrapped labels.generated/jsx.ts:4644
mnemonicWidget?Gtk.Widget | nullThe widget to be activated when the labels mnemonic key is pressed.generated/jsx.ts:4646
naturalWrapMode?Gtk.NaturalWrapModeSelect the line wrapping for the natural size request. This only affects the natural size requested. For the actual wrapping used, see the Label.wrap-mode property. The default is NaturalWrapMode.inherit, which inherits the behavior of the Label.wrap-mode property.generated/jsx.ts:4656
onActivateCurrentLink?(self) => void | nullGets emitted when the user activates a link in the label. The ::activate-current-link is a keybinding signal. Applications may also emit the signal with g_signal_emit_by_name() if they need to control activation of URIs programmatically. The default bindings for this signal are all forms of the Enter key.generated/jsx.ts:4728
onActivateLink?(uri, self) => boolean | nullGets emitted to activate a URI. Applications may connect to it to override the default behaviour, which is to call FileLauncher.launch.generated/jsx.ts:4735
onCopyClipboard?(self) => void | nullGets emitted to copy the selection to the clipboard. The ::copy-clipboard signal is a keybinding signal. The default binding for this signal is Ctrl+c.generated/jsx.ts:4743
onMoveCursor?(step, count, extendSelection, self) => void | nullGets emitted when the user initiates a cursor movement. The ::move-cursor signal is a keybinding signal. If the cursor is not visible in entry, this signal causes the viewport to be moved instead. Applications should not connect to it, but may emit it with GObjectsignal_emit_by_name if they need to control the cursor programmatically. The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without the Shift modifier does not. There are too many key combinations to list them all here. - , , , move by individual characters/lines - Ctrl+, etc. move by words/paragraphs - Home and End move to the ends of the buffergenerated/jsx.ts:4765
ref?Ref<Gtk.Label>-generated/jsx.ts:4767
selectable?booleanWhether the label text can be selected with the mouse.generated/jsx.ts:4658
singleLineMode?booleanWhether the label is in single line mode. In single line mode, the height of the label does not depend on the actual text, it is always set to ascent + descent of the font. This can be an advantage in situations where resizing the label because of text changes would be distracting, e.g. in a statusbar.generated/jsx.ts:4667
tabs?Pango.TabArray | nullCustom tabs for this label.generated/jsx.ts:4669
useMarkup?booleanTrue if the text of the label includes Pango markup. See Pangoparse_markup.generated/jsx.ts:4675
useUnderline?booleanTrue if the text of the label indicates a mnemonic with an _ before the mnemonic character.generated/jsx.ts:4680
widthChars?numberThe desired width of the label, in characters. If this property is set to -1, the width will be calculated automatically. See the section on text layout for details of how Label.width-chars and Label.max-width-chars determine the width of ellipsized and wrapped labels.generated/jsx.ts:4690
wrap?booleanTrue if the label text will wrap if it gets too wide.generated/jsx.ts:4692
wrapMode?Pango.WrapModeControls how the line wrapping is done. This only affects the formatting if line wrapping is on (see the Label.wrap property). The default is PangoWrapMode.word, which means wrap on word boundaries. For sizing behavior, also consider the Label.natural-wrap-mode property.generated/jsx.ts:4703
xalign?numberThe horizontal alignment of the label text inside its size allocation. Compare this to Widget.halign, which determines how the labels size allocation is positioned in the space available for the label.generated/jsx.ts:4710
yalign?numberThe vertical alignment of the label text inside its size allocation. Compare this to Widget.valign, which determines how the labels size allocation is positioned in the space available for the label.generated/jsx.ts:4717