类型 Toggle

API 文档由 Go 源码生成,内容为英文。

type Toggle struct {
	// contains filtered or unexported fields
}

Toggle paints one two-state compact action. The application owns active state and responds to the stable Canvas hit ID.

构造函数

BeginToggle#

func BeginToggle(canvas *ui.Canvas, theme ui.Theme, id ui.ID, bounds ui.Rect, active bool) Toggle

BeginToggle starts a toggle declaration.

方法

BoundsWidth#

func (toggle Toggle) BoundsWidth() float32

BoundsWidth exposes the fitted width for callers laying out neighbors.

Default#

func (toggle Toggle) Default(label string) ToggleResult

Default paints the borderless treatment.

Disabled#

func (toggle Toggle) Disabled() Toggle

Disabled renders and routes the toggle as inert.

Invalid#

func (toggle Toggle) Invalid() Toggle

Invalid applies the destructive validation treatment.

Large#

func (toggle Toggle) Large() Toggle

Large selects the large size variant.

Outline#

func (toggle Toggle) Outline(label string) ToggleResult

Outline paints the bordered treatment.

SizeToFit#

func (toggle Toggle) SizeToFit(label string) Toggle

SizeToFit widens the toggle to its label plus Vega's px-2.5, never narrower than it is tall (min-w).

Small#

func (toggle Toggle) Small() Toggle

Small selects the compact size variant.