API 文档由 Go 源码生成,内容为英文。
type Tabs struct {
// list and labels, when set, replace options: the tabs are the items of the
// list scope, numbered by position, and selected is an item number.
// tabStop is the one tab Tab reaches; the arrow helper moves focus among the
// rest, which are SkipTab.
}
Tabs paints a compact Base UI-style tab list. The active tab and associated
panel remain application state. Canvas activation supports Enter and Space.
构造函数
BeginTabList#
func BeginTabList(canvas *ui.Canvas, theme ui.Theme, bounds ui.Rect, list ui.Scope, labels []string, selected int) Tabs
BeginTabList starts a tab list whose tabs are the items of list, one per label
in order, so the component numbers its own triggers and the caller keeps an
index: selected is the number of the active tab, or -1. Paint reports the tab
that was clicked:
if index, ok := components.BeginTabList(c, theme, bounds, tabs, labels, current).Paint().Clicked(); ok {
current = index
}
BeginTabs#
func BeginTabs(canvas *ui.Canvas, theme ui.Theme, bounds ui.Rect, options []TabOption, selected ui.ID) Tabs
BeginTabs starts a tab-list declaration.
方法
Disabled#
func (tabs Tabs) Disabled() Tabs
Disabled renders every tab as inert.
Fit#
func (tabs Tabs) Fit() Tabs
Fit sizes the list to its labels like TabsList's w-fit: every trigger is as wide
as its label plus px-2 and the transparent border, so tabs may differ in
width, and the list is the sum of them plus its padding. bounds.Width is
ignored (it may be zero); Paint reports the resulting bounds. Without Fit the
triggers split bounds.Width equally.
Line#
func (tabs Tabs) Line() Tabs
Line selects the transparent list with a two-pixel active indicator.
Paint#
func (tabs Tabs) Paint() TabsResult
Paint draws the list and independently focusable tab triggers.
Vertical#
func (tabs Tabs) Vertical() Tabs
Vertical lays triggers out in a column and places the line indicator at the
trailing edge.