Fyne API "widget.Label"

widget.Label


import "fyne.io/fyne/v2/widget"

Usage

type Label

type Label struct {
	BaseWidget
	Text       string
	Alignment  fyne.TextAlign      // The alignment of the text
	Wrapping   fyne.TextWrap       // The wrapping of the text
	TextStyle  fyne.TextStyle      // The style of the label text
	Truncation fyne.TextTruncation // The truncation mode of the text

	Importance Importance
}

Label widget is a label component with appropriate padding and layout.

func NewLabel

func NewLabel(text string) *Label

NewLabel creates a new label widget with the set text content

func NewLabelWithData

func NewLabelWithData(data binding.String) *Label

NewLabelWithData returns an Label widget connected to the specified data source.

Since: 2.0

func NewLabelWithStyle

func NewLabelWithStyle(text string, alignment fyne.TextAlign, style fyne.TextStyle) *Label

NewLabelWithStyle creates a new label widget with the set text content

func (*Label) Bind

func (l *Label) Bind(data binding.String)

Bind connects the specified data source to this Label. The current value will be displayed and any changes in the data will cause the widget to update.

Since: 2.0

func (*Label) CreateRenderer

func (l *Label) CreateRenderer() fyne.WidgetRenderer

CreateRenderer is a private method to Fyne which links this widget to its renderer

func (*Label) ExtendBaseWidget

func (l *Label) ExtendBaseWidget(w fyne.Widget)

ExtendBaseWidget is used by an extending widget to make use of BaseWidget functionality.

func (*Label) MinSize

func (l *Label) MinSize() fyne.Size

MinSize returns the size that this label should not shrink below.

Implements: fyne.Widget

func (*Label) Refresh

func (l *Label) Refresh()

Refresh triggers a redraw of the label.

Implements: fyne.Widget

func (*Label) Resize

func (l *Label) Resize(s fyne.Size)

Resize sets a new size for the label. This should only be called if it is not in a container with a layout manager.

Implements: fyne.Widget

func (*Label) SetText

func (l *Label) SetText(text string)

SetText sets the text of the label

func (*Label) Unbind

func (l *Label) Unbind()

Unbind disconnects any configured data source from this Label. The current value will remain at the last value of the data source.

Since: 2.0