本文へスキップ

Text

継承されたタイポグラフィ、選択、アクセシビリティを使って Unicode テキストを組版・描画します。

デモを読み込み中…

#インポート

github.com/egoist/quickgui/go/ui から ui をインポートします。

import (
	"github.com/egoist/quickgui/go/ui"
)

#使い方

func TextExample() *ui.Element {
	count, setCount := ui.CreateSignal(0)
	return ui.View().Children(
		ui.Text(
			"Count: ",
			count(),
		).FontSize(20),
		ui.Button().Child("Increment").OnClick(func() { setCount(count() + 1) }),
	)
}

#API リファレンス

項目を展開すると説明と完全なシグネチャが表示されます。ダッシュは宣言に既定値が記載されていないことを示します。

ui.Text(children ...any) *Element
ChildChild(child any) *Element—

Child appends content and returns this element. Content can be an element, native node, scalar, accessor, or node-returning construction callback.

Child(child any) *Element
ソースを見る
ChildrenChildren(children ...any) *Element—

Children appends multiple children in order without replacing existing content. It also accepts []any, []*Element, and []*native.Node slices as arguments. Read the retained child nodes through element.Node.Children.

Children(children ...any) *Element
ソースを見る
StyleStyle(style StyleBuilder) *Element—

Style merges a reusable style. Scalar accessors retain independent native bindings.

Style(style StyleBuilder) *Element
ソースを見る
OnClickOnClick(handler func()) *Element—

OnClick handles a click without an unused event parameter.

OnClick(handler func()) *Element
ソースを見る
RefRef(handler func(*native.Node)) *Element—

Ref exposes the native handle once at this point in the declaration chain.

Ref(handler func(*native.Node)) *Element
ソースを見る
PaddingPadding(value any) *Element—

Padding sets the corresponding style property.

Padding(value any) *Element
ソースを見る
BackgroundColorBackgroundColor(value any) *Element—

BackgroundColor sets the corresponding style property.

BackgroundColor(value any) *Element
ソースを見る
OnKeyDownOnKeyDown(value func(*native.Event)) *Element—

OnKeyDown configures the corresponding node property.

OnKeyDown(value func(*native.Event)) *Element
ソースを見る
OnFocusOnFocus(value func(*native.Event)) *Element—

OnFocus configures the corresponding node property.

OnFocus(value func(*native.Event)) *Element
ソースを見る
OnBlurOnBlur(value func(*native.Event)) *Element—

OnBlur configures the corresponding node property.

OnBlur(value func(*native.Event)) *Element
ソースを見る
DisabledDisabled(value any) *Element—

Disabled configures the corresponding node property.

Disabled(value any) *Element
ソースを見る
AriaLabelAriaLabel(value any) *Element—

AriaLabel configures the corresponding node property.

AriaLabel(value any) *Element
ソースを見る
TabIndexTabIndex(value any) *Element—

TabIndex configures the corresponding node property.

TabIndex(value any) *Element
ソースを見る