Skip to content

ui ​

分层

只有 api/stable/ui.txt 列出的符号受兼容性承诺约束。标有「实验性」的符号,以及类型下「实验性成员」列出的字段,任何 0.x 版本都可能有不兼容变化(docs/release.md「API 稳定性」)。

go
import "github.com/tangoui/tango/ui"

本页由 site/tools/apigen 从源码注释生成(按 darwin 构建标签选文件),请勿手改。

Package ui is the self-drawn GUI layer of Tango: an immediate-mode API over retained widget state, rendered by a pure-Go pipeline (no cgo) with the visual language of Ant Design 6.7 (default), Element Plus and shadcn/ui.

Programming model ​

A page is a plain function called every frame:

func page(c *ui.Context) {
	ui.Input(c, &name).Placeholder("用户名")
	if ui.Button(c, "保存").Primary().Clicked() {
		save(name)
	}
}

Calls build a tree of layout nodes; chained modifiers (Primary, Disabled, ...) configure the widget before layout and paint run at the end of the frame. Interaction (Clicked, Hovered, focus) is answered from the previous frame's geometry, keyed by widget ID. IDs derive from the enclosing scope, widget kind, label and occurrence; wrap dynamic lists in ui.Key. Values live in the app (pointers); widgets only retain transient state (caret, scroll, open dropdowns, animations) via ui.State. Frames are event driven. A static UI stays idle until input or a request for a new frame. In a page function, call Context.WakeAt to schedule a frame. For example, compute a countdown from its deadline each frame, and call c.WakeAt(time.Now().Add(time.Second)) while it is still running. From a background goroutine, use Runner.Post to update application state on the UI thread and request a redraw.

Layers ​

ui/theme   design tokens (AntDesign, ElementPlus, Shadcn, Dark, derived palettes)
ui/layout  flex/stack/absolute solver with two-axis measurement
ui/paint   display list + Renderer interface + CPU rasterizer
ui/text    shaping (go-text/typesetting), fallback fonts, line breaking
ui/input   events, keys, IME composition, cursors, focus order
ui/icon    built-in vector icons
ui         Context, Runner, Driver, Window/Host contracts, components

Platform integration ​

A platform backend implements Window (size, scale, invalidation, cursor, clipboard, IME, Present) and Host (open a window bound to a Runner); see window.go for the exact contract. The headless Driver implements Window for tests and screenshots. See AUTHORING.md for writing components.

Accessibility ​

A window that also implements AccessibilityHost receives a semantics tree (package ui/a11y: roles, names, states, values, bounds, actions) after every frame that changed it, and forwards screen-reader requests through Runner.PerformAction. Nothing is built while the host reports accessibility disabled. Keyboard access (Tab order, roving arrow keys, focus traps in dialogs, focus return from popups), the reduced-motion preference (RunnerOptions.ReduceMotion) and theme contrast checks (theme.CheckContrast) complete the picture; docs/accessibility.md maps every role to NSAccessibility, UI Automation, AT-SPI, UIAccessibility and AccessibilityNodeInfo.

API tiers: only the symbols listed in api/stable/ui.txt are covered by the compatibility promise of docs/release.md ("API 稳定性"); every other exported symbol is Experimental and may change in any 0.x release. The API reference on the documentation site marks the experimental symbols.

常量 ​

go
const (
	TreeDropBefore = -1
	TreeDropInside = 0
	TreeDropAfter  = 1
)

Tree drop positions reported by Dropped and accepted by TreeMove.

实验性

go
const (
	AlignAuto   = "auto"
	AlignTop    = "top"
	AlignBottom = "bottom"
)

Scroll alignments of Listy.ScrollToKey / ScrollToGroup.

实验性

go
const (
	ValuePassword    = "password"
	ValueTextArea    = "textarea"
	ValueSelect      = "select"
	ValueMultiSelect = "multiSelect"
	ValueRadio       = "radio"
	ValueRadioButton = "radioButton"
	ValueCheckbox    = "checkbox"
	ValueSwitch      = "switch"
	ValueRate        = "rate"
	ValueSlider      = "slider"
	ValueSegmented   = "segmented"
	ValueDateRange   = "dateRange"
	ValueCascader    = "cascader"   // []string path; options: ValueEnum with Children
	ValueTreeSelect  = "treeSelect" // string; options: ValueEnum with Children
	ValueUpload      = "upload"     // []UploadFile; ProField.Pick adds files
	ValueTime        = "time"       // time.Time (time of day)
	ValueTimeRange   = "timeRange"  // [2]time.Time
	ValueColor       = "color"      // string "#RRGGBB" / "#RRGGBBAA"
	ValueDigitRange  = "digitRange" // [2]float64; an empty end is NaN
)

Value types used by ProForm fields in addition to the ProTable ones (ValueText, ValueMoney, ValueDigit, ValuePercent, ValueDate, ValueDateTime, ValueStatus, ValueTag ...): one set describes both a column's display and a field's editor.

实验性

go
const (
	ValueDateWeek      = "dateWeek"      // time.Time, shown as its week ("2026-46周")
	ValueDateMonth     = "dateMonth"     // time.Time, shown as "2006-01"
	ValueDateQuarter   = "dateQuarter"   // time.Time, shown as its quarter ("2026-Q4")
	ValueDateYear      = "dateYear"      // time.Time, shown as "2006"
	ValueDateTimeRange = "dateTimeRange" // [2]time.Time with the times of day
	// ValueImage is an image.Image, []image.Image or UploadFile(s) with a
	// Thumb; the editor is a one-picture Upload card (ProField.Pick adds).
	ValueImage = "image"
	// ValueAvatar is an image.Image (or UploadFile) or a name string (its
	// first letter, edited as text); a picture is edited like image.
	ValueAvatar   = "avatar"
	ValueCode     = "code"     // string in a monospace block
	ValueJSONCode = "jsonCode" // JSON text (string / []byte) or any value, shown indented; validated when edited
	ValueFromNow  = "fromNow"  // time.Time shown relative to now ("3 分钟前"); edited with a date-time picker
	ValueSecond   = "second"   // number of seconds shown as a duration ("1 小时 5 秒")
	ValueIndex    = "index"    // ProTable: the 1-based row number (the value is ignored)
	// ValueCaptcha is a string code with a "get code" button and its
	// countdown (ProField.OnCaptcha sends the code).
	ValueCaptcha = "captcha"
	// ValueFormList is a list of rows ([]ProValues) edited with Form.List;
	// ProField.List gives the fields of a row.
	ValueFormList = "formList"
)

Value types of the third Pro round: date granularities, a date-time range, media (image, avatar), code, relative time, durations, row numbers, a verification code and nested lists. Like the others they describe both a field's editor and the read-only view in ProForm (readonly), ProField, ProTable and ProDescriptions.

实验性

go
const (
	SplitVertical   = "vertical"   // children side by side, vertical dividers
	SplitHorizontal = "horizontal" // children stacked, horizontal dividers
)

Split directions of ProCard.Split.

实验性

go
const (
	SkeletonList         = "list"
	SkeletonResult       = "result"
	SkeletonDescriptions = "descriptions"
)

ProSkeleton page types.

实验性

go
const (
	StatisticVertical   = "vertical"
	StatisticHorizontal = "horizontal"
	StatisticInline     = "inline"
)

Statistic layouts of StatisticCard.StatisticLayout and ProStatistic.

实验性

go
const (
	ChartBottom = "bottom"
	ChartLeft   = "left"
	ChartRight  = "right"
)

Chart placements of StatisticCard.ChartPlace.

实验性

go
const (
	LoginAccount = "account"
	LoginMobile  = "mobile"
)

Login types of LoginForm (the "loginType" value).

实验性

go
const (
	FixedLeft  = "left"
	FixedRight = "right"
)

Fixed column sides (TableColumn.Fixed). They are logical, like Ant's RTL table: "left" is the start side (the right edge in an RTL scope) and "right" the end side.

go
const (
	SelectionAll    = "all"    // select every selectable row (all pages of local data)
	SelectionPage   = "page"   // select the rows of the current page
	SelectionInvert = "invert" // invert the selection of the current page
	SelectionNone   = "none"   // clear the whole selection
)

Built-in selection menu items (TableSelection.Key) of Selections.

实验性

go
const (
	PageTopStart     = "topStart"
	PageTopCenter    = "topCenter"
	PageTopEnd       = "topEnd"
	PageBottomStart  = "bottomStart"
	PageBottomCenter = "bottomCenter"
	PageBottomEnd    = "bottomEnd" // default
	PageNone         = "none"
)

Pagination placements (PaginationPlacement), Ant Design 6 pagination.placement.

实验性

go
const (
	ValueText     = "text"
	ValueMoney    = "money"
	ValueDigit    = "digit"
	ValuePercent  = "percent"
	ValueDate     = "date"
	ValueDateTime = "dateTime"
	ValueStatus   = "status"
	ValueTag      = "tag"
	ValueProgress = "progress"
	ValueLink     = "link"
	ValueOption   = "option" // action column: Render only, never searched
)

Value types of ProColumn.ValueType.

实验性

go
const (
	AlignLeft  = AlignStart
	AlignRight = AlignEnd
)

AlignLeft and AlignRight are transitional aliases of AlignStart and AlignEnd, kept while existing call sites are audited (RTL spec §3.2): in LTR they behave exactly as before. Use AlignStart / AlignEnd for "start / end" and AlignPhysicalLeft / AlignPhysicalRight where the physical side is required; after the audit AlignLeft / AlignRight will become the physical values.

go
const DragSlop = 8

DragSlop is how far (logical px) a press may travel before an enclosing container that accepts the movement direction takes the pointer over.

实验性

go
const FixedNone = "none"

FixedNone unpins a column in TableColumnState.Fixed.

go
const GridContentFixedWidth = 1152

GridContentFixedWidth is the content width of a Fixed GridContent.

实验性

go
const TopNavHeaderWideWidth = 1152

TopNavHeaderWideWidth is Pro v3's Fixed top navigation content width.

实验性

变量 ​

go
var (
	EaseInOut = cubicBezier(0.645, 0.045, 0.355, 1)
	EaseOut   = cubicBezier(0.215, 0.61, 0.355, 1)
	EaseIn    = cubicBezier(0.55, 0.055, 0.675, 0.19)
)

Ant Design motion curves.

实验性

go
var ButtonPresetColors = []ButtonColor{
	ButtonColorBlue, ButtonColorPurple, ButtonColorCyan, ButtonColorGreen, ButtonColorMagenta,
	ButtonColorPink, ButtonColorRed, ButtonColorOrange, ButtonColorYellow, ButtonColorVolcano,
	ButtonColorGeekblue, ButtonColorLime, ButtonColorGold,
}

ButtonPresetColors lists the Ant Design preset colors in display order.

实验性

go
var ContextMenuSource func(c *Context) (geom.Point, bool)

ContextMenuSource is an extra context-menu gesture for platforms without a secondary button (e.g. a two-finger tap): when set, context-menu triggers (Dropdown with TriggerContextMenu) also open when it reports a point inside them. Right-button presses always work (they are read with Context.ContextMenuFor, which respects layers). Nil by default.

实验性

go
var EnUS = &Locale{
	Code: "en-US", Name: "English",
	OK: "OK", Cancel: "Cancel", Close: "Close", Confirm: "Confirm", Back: "Back", Clear: "Clear", Reset: "Reset",
	Search: "Search", Save: "Save", Delete: "Delete", Edit: "Edit", Copy: "Copy", Copied: "Copied", More: "More",
	Expand: "Expand", Collapse: "Collapse", SelectAll: "Select all", Loading: "Loading", Retry: "Retry", GotIt: "Got it",
	NoData: "No data", NoMore: "No more", LoadMore: "Load more", LoadFailed: "Failed to load",
	TotalFmt: "Total %d items", RangeTotalFmt: "%d-%d of %d items", PageSizeFmt: "%d / page",
	PrevPage: "Previous Page", NextPage: "Next Page", Prev5: "Previous 5 Pages", Next5: "Next 5 Pages", JumpTo: "Go to", PageSuffix: "Page",
	Placeholder: "Please enter", SelectPlaceholder: "Please select", Required: "This field is required", NotFound: "Not found",
	LabelColon: ":", SelectedFmt: "%d selected",
	Today: "Today", Now: "Now", SelectDate: "Select date", SelectTime: "Select time", SelectDateTime: "Select date and time",
	StartDate: "Start date", EndDate: "End date",
	PrevYear: "Previous year", NextYear: "Next year", PrevMonth: "Previous month", NextMonth: "Next month", RangeSeparator: "to",
	YearFmt: "%d", MonthFmt: "%[2]s", YearMonthFmt: "%[3]s %[1]d",
	Weekdays:      [7]string{"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"},
	Months:        [12]string{"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"},
	WeekStart:     time.Sunday,
	FilterConfirm: "OK", FilterReset: "Reset", SortAsc: "Click to sort ascending", SortDesc: "Click to sort descending", CancelSort: "Click to cancel sorting",
	SelectionAll: "Select all data", SelectionInvert: "Invert current page", ExpandRow: "Expand row", CollapseRow: "Collapse row",
	ItemUnit: "item", ItemsUnit: "items", Searching: "Searching", Currency: "$",
	MessageBoxTitle: "Message", Info: "Info", Success: "Success", Warning: "Warning", Error: "Error", BackTop: "Back to top",
	CollapseMenu: "Collapse menu", ExpandMenu: "Expand menu", Fullscreen: "Fullscreen", ExitFullscreen: "Exit fullscreen",
	PromptPlaceholder: "Please input", PromptInvalid: "Illegal input", CloseAll: "Close all", Steps: "Steps",

	Calendar: CalendarLocale{Month: "Month", Year: "Year"},
	Carousel: CarouselLocale{Prev: "Previous slide", Next: "Next slide"},
	Image: ImageLocale{
		Preview: "Preview", PreviewLabel: "Image preview", ClosePreview: "Close preview", Prev: "Previous image", Next: "Next image",
		ZoomIn: "Zoom in", ZoomOut: "Zoom out", RotateLeft: "Rotate left", RotateRight: "Rotate right",
		FlipHorizontal: "Flip horizontally", FlipVertical: "Flip vertically",
	},
	ColorPicker: ColorPickerLocale{Presets: "Recommended", None: "None", ClearColor: "Clear color", Clear: "Clear",
		Saturation: "Saturation", Hue: "Hue", Alpha: "Alpha", Format: "Color format", Value: "Color value", Gradient: "Gradient stops", Angle: "Angle"},
	Tour:    TourLocale{Close: "Close tour", Prev: "Previous", Next: "Next", Finish: "Finish"},
	Command: CommandLocale{Placeholder: "Type a command or search...", Empty: "No results found."},
	QRCode:  QRCodeLocale{Expired: "QR code expired", Refresh: "Refresh", Scanned: "Scanned"},
	Table: TableLocale{FilterSearch: "Search in filters", FilterAll: "All", Filter: "Filter", FixedLeft: "Fixed to left", NoFixed: "Not fixed", FixedRight: "Fixed to right", PinLeft: "Pin to left", PinRight: "Pin to right", Unpin: "Unpin", SelectRowFmt: "Select row %d",
		Selections: "Selection options", SelectPage: "Select current page", SelectNone: "Clear all data", SumText: "Sum"},
	Mobile: MobileLocale{PullToRefresh: "Pull to refresh", ReleaseToRefresh: "Release to refresh", Refreshed: "Refreshed", TapToRetry: ", tap to retry", DayFmt: "%d", HourFmt: "%02d", MinuteFmt: "%02d"},
	Graph: GraphLocale{Diagram: "Diagram", ER: "ER diagram", GitGraph: "Commit graph", ZoomIn: "Zoom in", ZoomOut: "Zoom out", FitView: "Fit view", AutoLayout: "Auto layout", MiniMap: "Minimap",
		PrimaryKey: "Primary key", ForeignKey: "Foreign key", SummaryFmt: "%[1]d nodes, %[2]d edges", CommitsFmt: "%d commits"},
	Chart: ChartLocale{Total: "Total", Conversion: "Conversion", Line: "Line chart", Area: "Area chart", Column: "Column chart", Bar: "Bar chart", Pie: "Pie chart", Donut: "Donut chart",
		Scatter: "Scatter chart", Radar: "Radar chart", Gauge: "Gauge", Funnel: "Funnel chart", Heatmap: "Heatmap", DualAxes: "Dual axes chart",
		Liquid: "Liquid gauge", Sparkline: "Sparkline",
		SummaryFmt: "%[1]s, %[2]d series, %[3]d data points", XRangeFmt: "; x axis from %s to %s", YRangeFmt: "; values from %s to %s", ValueFmt: "%s: %s"},
	ProTable: ProTableLocale{Query: "Query", Reload: "Refresh", Density: "Density",
		DensityDefault: "Default", DensityMiddle: "Middle", DensityCompact: "Compact",
		ColumnSetting: "Column settings", ColumnDisplay: "Columns", ClearSelection: "Clear selection", LoadErrorFmt: "Failed to load data: %s"},
	Transfer: TransferLocale{Source: "Source", Target: "Target", SearchPlaceholder: "Search here"},
	Upload: UploadLocale{Trigger: "Upload", Uploading: "Uploading", Remove: "Remove file", Preview: "Preview file",
		Button: "Click to Upload", DragTitle: "Click or drag file to this area to upload", DropPrefix: "Drop file here or ",
		DoneFmt: "%s uploaded", FailedFmt: "%s failed to upload", TooManyFmt: "%s: the list is full", BadTypeFmt: "%s: file type not accepted",
		TooLargeFmt: "%s is larger than %s", IsDirFmt: "%s is a folder"},
	Markdown: MarkdownLocale{ImagePrefix: "[Image] ", CopyCode: "Copy code", Copied: "Copied"},
	MarkdownEditor: MarkdownEditorLocale{Placeholder: "Write Markdown here…",
		Heading: "Heading", Bold: "Bold", Italic: "Italic", Strike: "Strikethrough", Code: "Code", Link: "Link", Quote: "Quote",
		BulletList: "Bulleted list", OrderedList: "Numbered list", Task: "Task", CodeBlock: "Code block", Table: "Table", Divider: "Divider",
		BoldSample: "bold text", ItalicSample: "italic text", StrikeSample: "deleted text", LinkSample: "link text", TableColumnFmt: "Column %d",
		Edit: "Edit", Split: "Split", Preview: "Preview"},
	Form: FormLocale{Validating: "Validating…", RequiredInputFmt: "Please enter %s", RequiredSelectFmt: "Please select %s", Submit: "Submit", Query: "Query", PrevStep: "Previous", NextStep: "Next", MoveUp: "Move up", MoveDown: "Move down", AddRow: "Add a row", Optional: "(optional)"},
	A11y: A11yLocale{Navigation: "Navigation", Breadcrumb: "Breadcrumb", Pagination: "Pagination", Notifications: "Notifications", Toolbar: "Toolbar", Menu: "Menu",
		PageFmt: "Page %d", MoreActions: "More actions", OpenMenu: "Open menu", Remove: "Remove", DragHandle: "Drag to reorder", Resize: "Resize", Splitter: "Splitter",
		ShowPassword: "Show password", HidePassword: "Hide password", Increase: "Increase", Decrease: "Decrease",
		Avatar: "Avatar", Image: "Image", Chart: "Chart", Progress: "Progress", Rating: "Rating", Color: "Color", Loading: "Loading",
		SlideFmt: "Slide %d of %d", RateFmt: "%[1]g of %[2]d stars",
		DateFmt: "%[4]s %[3]d, %[1]d", DigitFmt: "Character %d of %d", RemoveFmt: "Remove %s", Day: "Day", Hour: "Hour", Minute: "Minute", Second: "Second",
		MoveToTarget: "Move to target", MoveToSource: "Move to source",
		PageSize: "Items per page"},
	DatePicker: DatePickerLocale{SelectWeek: "Select week", SelectMonth: "Select month", SelectQuarter: "Select quarter", SelectYear: "Select year",
		StartWeek: "Start week", EndWeek: "End week", StartMonth: "Start month", EndMonth: "End month",
		StartQuarter: "Start quarter", EndQuarter: "End quarter", StartYear: "Start year", EndYear: "End year",
		PrevDecade: "Previous decade", NextDecade: "Next decade", WeekFmt: "%[1]d-%[2]d%[3]s", QuarterFmt: "%[1]d-Q%[2]d", QuarterCellFmt: "Q%d"},
	TimePicker:    TimePickerLocale{StartTime: "Start time", EndTime: "End time", AM: "AM", PM: "PM", Meridiem: "AM/PM"},
	Tabs:          TabsLocale{More: "More tabs", Add: "Add tab"},
	Pagination:    PaginationLocale{Jump: "Go to page", Current: "Current page", Confirm: "Confirm", Prev3: "Previous 3 Pages", Next3: "Next 3 Pages"},
	Slider:        SliderLocale{Min: "Minimum", Max: "Maximum"},
	DropZone:      DropZoneLocale{Name: "Drop zone", Release: "Release to drop the files here"},
	EditableTable: EditableTableLocale{Actions: "Actions", DeleteConfirm: "Delete this row?"},
	PageContainer: PageContainerLocale{FooterToolbar: "Page actions"},
	ProCard:       ProCardLocale{MoreInfo: "More info"},
	StatisticCard: StatisticCardLocale{Up: "Up", Down: "Down"},
	ProField: ProFieldLocale{On: "On", Off: "Off", StartFmt: "%s start", EndFmt: "%s end", Min: "Min", Max: "Max", RangeEndFmt: "%s: %s",
		JustNow: "just now", AgoFmt: "%s ago", LaterFmt: "in %s", SecondFmt: "%d s", MinuteFmt: "%d min", HourFmt: "%d h", DayFmt: "%d d", MonthFmt: "%d mo", YearFmt: "%d yr", InvalidJSON: "Invalid JSON"},
	ProDescriptions: ProDescriptionsLocale{EditFmt: "Edit %s"},
	LightFilter:     LightFilterLocale{Name: "Filter", ClearFmt: "Clear %s", PillFmt: "%s: %s", More: "More filters", MoreFmt: "More filters (%d)"},
	LoginForm: LoginFormLocale{AccountTab: "Account", MobileTab: "Mobile",
		Username: "Username", UsernameRequired: "Please enter your username", Password: "Password", PasswordRequired: "Please enter your password",
		Mobile: "Mobile number", MobileRequired: "Please enter your mobile number", MobileInvalid: "Invalid mobile number",
		Captcha: "Verification code", CaptchaRequired: "Please enter the code", GetCode: "Get code", ResendFmt: "Resend in %ds",
		CodeSentFmt: "Code sent. You can resend it in %d seconds.", CodeReady: "You can request a new code now.",
		Remember: "Remember me", Forgot: "Forgot password", Submit: "Log in", Others: "Other login methods"},
	Chat: ChatLocale{User: "You", Assistant: "Assistant", System: "System", Messages: "Messages", ScrollToBottom: "Scroll to bottom",
		Thinking: "Thinking", Generating: "Generating",
		Placeholder: "Message… (Enter to send, Shift+Enter for a new line)", Send: "Send", Stop: "Stop generating", Attach: "Attach files",
		Suggestions: "Suggestions", Uploading: "Uploading", Failed: "Upload failed", EditPlaceholder: "Edit message",
		Pending: "Pending", Running: "Running", Done: "Done", Error: "Failed", StepsFmt: "%d/%d",
		SecondsFmt: "%.1fs", MinutesFmt: "%dm %ds", ToolCall: "Tool call", Arguments: "Arguments", Result: "Result",
		ApprovalTitle: "Approval required", AllowOnce: "Allow", AllowSession: "Allow for this chat", AllowAlways: "Always allow", Deny: "Deny",
		Allowed: "Allowed", Denied: "Denied", FeedbackPlaceholder: "Add a note (optional)", RiskWarning: "Needs review", RiskDanger: "High risk",
		Conversations: "Conversations", Rename: "Rename", Untitled: "Untitled chat", Today: "Today", Yesterday: "Yesterday",
		Last7Days: "Previous 7 days", Last30Days: "Previous 30 days", Earlier: "Earlier", Prompts: "Prompts"},
	SettingDrawer: SettingDrawerLocale{Open: "Open page settings", Title: "Page settings",
		NavTheme: "Style", Light: "Light menu", Dark: "Dark menu", RealDark: "Dark mode",
		PrimaryColor: "Theme color", Layout: "Navigation", Side: "Side menu", Top: "Top menu", Mix: "Mixed",
		ContentWidth: "Content width", Fluid: "Fluid", Fixed: "Fixed",
		FixedHeader: "Fixed header", FixSiderbar: "Fixed side menu", ColorWeak: "Color weak mode",
		Other: "Other settings", Compact: "Compact", ColorFmt: "Theme color %s"},
	CodeBlock: CodeBlockLocale{Code: "Code"},
	JSONView:  JSONViewLocale{Name: "JSON viewer", CopyValue: "Copy value", CopyPath: "Copy path", ExpandAll: "Expand all", CollapseAll: "Collapse all", ItemsFmt: "%d items", KeysFmt: "%d keys", Search: "Search keys or values", PrevMatch: "Previous match", NextMatch: "Next match", MatchFmt: "%d of %d", NoMatch: "No results", ParseErrorFmt: "Invalid JSON: %s"},
	LogView:   LogViewLocale{Name: "Log", Search: "Search log", PrevMatch: "Previous match", NextMatch: "Next match", MatchFmt: "%d of %d", NoMatch: "No results", Wrap: "Wrap lines", Follow: "Follow output", Level: "Level", AllLevels: "All levels", Levels: [5]string{"Trace", "Debug", "Info", "Warn", "Error"}, LinesFmt: "%d lines"},
	StatusBar: StatusBarLocale{Label: "Status bar"},
	TitleBar:  TitleBarLocale{Minimize: "Minimize", Maximize: "Maximize", Restore: "Restore", WindowControls: "Window controls"},
	NotificationCenter: NotificationCenterLocale{MarkAllRead: "Mark all as read", ClearAll: "Clear all", Dismiss: "Dismiss",
		Empty: "No notifications", UnreadFmt: "%d unread", JustNow: "Just now", MinutesAgoFmt: "%dm ago", HoursAgoFmt: "%dh ago", DaysAgoFmt: "%dd ago"},
	HotkeyInput: HotkeyInputLocale{Placeholder: "Click to record a shortcut", Recording: "Press a key combination, Esc to cancel", ClearLabel: "Clear shortcut"},
	Dock:        DockLocale{Maximize: "Maximize", Restore: "Restore", Split: "Split right", Empty: "Drag a tab here", Group: "Tab group"},

	Extra: map[string]string{
		"diffview.a11y.change":      "Difference %d of %d: ",
		"diffview.a11y.removed":     "removed lines %s",
		"diffview.a11y.inserted":    "added lines %s",
		"diffview.a11y.sep":         ", ",
		"diffview.a11y.range":       "%d–%d",
		"diffview.a11y.none":        "No differences",
		"diffview.hidden":           "%d hidden lines",
		"diffview.showAbove":        "Show %d more lines above",
		"diffview.showBelow":        "Show %d more lines below",
		"diffview.showAll":          "Show all",
		"diffview.original":         "Original (read-only) — %s",
		"diffview.originalEditable": "Original — %s",
		"diffview.modified":         "Modified — %s",
		"diffview.revert":           "Revert this change",
		"diffview.unnamed":          "Untitled",
	},
}

EnUS is the US English locale. RegisterLocale fills the empty texts of every other locale from it.

go
var ErrQRTooLong = errors.New("ui: qrcode data too long")

ErrQRTooLong is returned when the data exceeds version 40 capacity.

实验性

go
var Ja = &Locale{
	Code: "ja-JP", Name: "日本語",
	OK: "OK", Cancel: "キャンセル", Close: "閉じる", Confirm: "確認", Back: "戻る", Clear: "クリア", Reset: "リセット",
	Search: "検索", Save: "保存", Delete: "削除", Edit: "編集", Copy: "コピー", Copied: "コピーしました", More: "その他",
	Expand: "展開", Collapse: "折りたたむ", SelectAll: "すべて選択", Loading: "読み込み中", Retry: "再試行", GotIt: "了解",
	NoData: "データがありません", NoMore: "これ以上ありません", LoadMore: "さらに読み込む", LoadFailed: "読み込みに失敗しました",
	TotalFmt: "全 %d 件", RangeTotalFmt: "%d-%d 件 / 全 %d 件", PageSizeFmt: "%d 件/ページ",
	PrevPage: "前のページ", NextPage: "次のページ", Prev5: "前の 5 ページ", Next5: "次の 5 ページ", JumpTo: "移動", PageSuffix: "ページ",
	Placeholder: "入力してください", SelectPlaceholder: "選択してください", Required: "必須項目です", NotFound: "見つかりません",
	LabelColon: ":", SelectedFmt: "%d 件選択中",
	Today: "今日", Now: "現在", SelectDate: "日付を選択", SelectTime: "時刻を選択", SelectDateTime: "日時を選択",
	StartDate: "開始日", EndDate: "終了日",
	PrevYear: "前年", NextYear: "翌年", PrevMonth: "前月", NextMonth: "翌月", RangeSeparator: "〜",
	YearFmt: "%d年", MonthFmt: "%d月", YearMonthFmt: "%d年%d月",
	Weekdays:      [7]string{"日", "月", "火", "水", "木", "金", "土"},
	Months:        [12]string{"1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"},
	WeekStart:     time.Sunday,
	FilterConfirm: "OK", FilterReset: "リセット", SortAsc: "クリックで昇順", SortDesc: "クリックで降順", CancelSort: "ソートを解除",
	SelectionAll: "すべてを選択", SelectionInvert: "このページを反転", ExpandRow: "行を展開", CollapseRow: "行を折りたたむ",
	ItemUnit: "件", ItemsUnit: "件", Searching: "検索中", Currency: "JPY",
	MessageBoxTitle: "メッセージ", Info: "情報", Success: "成功", Warning: "警告", Error: "エラー", BackTop: "トップへ戻る",
	CollapseMenu: "メニューを折りたたむ", ExpandMenu: "メニューを展開", Fullscreen: "全画面表示", ExitFullscreen: "全画面表示を終了",
	PromptPlaceholder: "入力してください", PromptInvalid: "入力が正しくありません", CloseAll: "すべて閉じる", Steps: "ステップ",

	Calendar: CalendarLocale{Month: "月", Year: "年"},
	Carousel: CarouselLocale{Prev: "前のスライド", Next: "次のスライド"},
	Image: ImageLocale{
		Preview: "プレビュー", PreviewLabel: "画像プレビュー", ClosePreview: "プレビューを閉じる", Prev: "前の画像", Next: "次の画像",
		ZoomIn: "拡大", ZoomOut: "縮小", RotateLeft: "左に回転", RotateRight: "右に回転",
		FlipHorizontal: "左右反転", FlipVertical: "上下反転",
	},
	ColorPicker: ColorPickerLocale{Presets: "おすすめ", None: "なし", ClearColor: "色をクリア", Clear: "クリア",
		Saturation: "彩度", Hue: "色相", Alpha: "透明度", Format: "カラー形式", Value: "カラー値", Gradient: "グラデーションの色標", Angle: "角度"},
	Tour:    TourLocale{Close: "ツアーを閉じる", Prev: "前へ", Next: "次へ", Finish: "完了"},
	Command: CommandLocale{Placeholder: "コマンドを入力または検索…", Empty: "結果が見つかりません。"},
	QRCode:  QRCodeLocale{Expired: "期限切れ", Refresh: "更新", Scanned: "スキャン済み"},
	Table: TableLocale{FilterSearch: "フィルターを検索", FilterAll: "すべて", Filter: "フィルター", FixedLeft: "左に固定", NoFixed: "固定なし", FixedRight: "右に固定", PinLeft: "先頭に固定", PinRight: "末尾に固定", Unpin: "固定を解除", SelectRowFmt: "%d 行目を選択",
		Selections: "選択オプション", SelectPage: "このページを選択", SelectNone: "選択をすべて解除", SumText: "合計"},
	Mobile: MobileLocale{PullToRefresh: "引っ張って更新", ReleaseToRefresh: "離すと更新", Refreshed: "更新しました", TapToRetry: "、タップして再試行", DayFmt: "%d日", HourFmt: "%02d時", MinuteFmt: "%02d分"},
	Graph: GraphLocale{Diagram: "ダイアグラム", ER: "ER 図", GitGraph: "コミットグラフ", ZoomIn: "拡大", ZoomOut: "縮小", FitView: "全体表示", AutoLayout: "自動レイアウト", MiniMap: "ミニマップ",
		PrimaryKey: "主キー", ForeignKey: "外部キー", SummaryFmt: "%[1]d 個のノード、%[2]d 本の接続", CommitsFmt: "%d 件のコミット"},
	Chart: ChartLocale{Total: "合計", Conversion: "コンバージョン率", Line: "折れ線グラフ", Area: "面グラフ", Column: "縦棒グラフ", Bar: "横棒グラフ", Pie: "円グラフ", Donut: "ドーナツグラフ",
		Scatter: "散布図", Radar: "レーダーチャート", Gauge: "ゲージ", Funnel: "ファネルチャート", Heatmap: "ヒートマップ", DualAxes: "2 軸グラフ",
		Liquid: "リキッドゲージ", Sparkline: "スパークライン",
		SummaryFmt: "%[1]s、%[2]d 系列、%[3]d データポイント", XRangeFmt: "、横軸 %s ~ %s", YRangeFmt: "、値 %s ~ %s", ValueFmt: "%s:%s"},
	ProTable: ProTableLocale{Query: "検索", Reload: "更新", Density: "表示密度",
		DensityDefault: "標準", DensityMiddle: "中", DensityCompact: "コンパクト",
		ColumnSetting: "列の設定", ColumnDisplay: "列の表示", ClearSelection: "選択を解除", LoadErrorFmt: "データの読み込みに失敗しました:%s"},
	Transfer: TransferLocale{Source: "ソース", Target: "ターゲット", SearchPlaceholder: "ここを検索"},
	Upload: UploadLocale{Trigger: "アップロード", Uploading: "アップロード中", Remove: "ファイルを削除", Preview: "ファイルをプレビュー",
		Button: "クリックしてアップロード", DragTitle: "クリックまたはドラッグしてアップロード", DropPrefix: "ここにファイルをドロップ、または",
		DoneFmt: "%s をアップロードしました", FailedFmt: "%s のアップロードに失敗しました", TooManyFmt: "%s:ファイル数が上限に達しています", BadTypeFmt: "%s:この形式のファイルは使用できません",
		TooLargeFmt: "%s は %s を超えています", IsDirFmt: "%s はフォルダーです"},
	Markdown: MarkdownLocale{ImagePrefix: "[画像] ", CopyCode: "コードをコピー", Copied: "コピーしました"},
	MarkdownEditor: MarkdownEditorLocale{Placeholder: "ここに Markdown を入力…",
		Heading: "見出し", Bold: "太字", Italic: "斜体", Strike: "取り消し線", Code: "コード", Link: "リンク", Quote: "引用",
		BulletList: "箇条書き", OrderedList: "番号付きリスト", Task: "タスク", CodeBlock: "コードブロック", Table: "表", Divider: "区切り線",
		BoldSample: "太字テキスト", ItalicSample: "斜体テキスト", StrikeSample: "取り消しテキスト", LinkSample: "リンクテキスト", TableColumnFmt: "列 %d",
		Edit: "編集", Split: "分割", Preview: "プレビュー"},
	Form: FormLocale{Validating: "検証中…", RequiredInputFmt: "%sを入力してください", RequiredSelectFmt: "%sを選択してください", Submit: "送信", Query: "検索", PrevStep: "前へ", NextStep: "次へ", MoveUp: "上へ移動", MoveDown: "下へ移動", AddRow: "行を追加", Optional: "(オプション)"},
	A11y: A11yLocale{Navigation: "ナビゲーション", Breadcrumb: "パンくずリスト", Pagination: "ページ送り", Notifications: "通知", Toolbar: "ツールバー", Menu: "メニュー",
		PageFmt: "%d ページ", MoreActions: "その他の操作", OpenMenu: "メニューを開く", Remove: "削除", DragHandle: "ドラッグして並べ替え", Resize: "サイズ変更", Splitter: "分割バー",
		ShowPassword: "パスワードを表示", HidePassword: "パスワードを隠す", Increase: "増やす", Decrease: "減らす",
		Avatar: "アバター", Image: "画像", Chart: "グラフ", Progress: "進捗", Rating: "評価", Color: "色", Loading: "読み込み中",
		SlideFmt: "スライド %d / %d", RateFmt: "%[2]d 点中 %[1]g 点",
		DateFmt: "%d年%d月%d日", DigitFmt: "%d 文字目(全 %d 文字)", RemoveFmt: "%s を削除", Day: "日", Hour: "時", Minute: "分", Second: "秒",
		MoveToTarget: "ターゲットへ移動", MoveToSource: "ソースへ戻す",
		PageSize: "1 ページあたりの件数"},
	DatePicker: DatePickerLocale{SelectWeek: "週を選択", SelectMonth: "月を選択", SelectQuarter: "四半期を選択", SelectYear: "年を選択",
		StartWeek: "開始週", EndWeek: "終了週", StartMonth: "開始月", EndMonth: "終了月",
		StartQuarter: "開始四半期", EndQuarter: "終了四半期", StartYear: "開始年", EndYear: "終了年",
		PrevDecade: "前の10年", NextDecade: "次の10年", WeekFmt: "%[1]d-第%[2]d週", QuarterFmt: "%[1]d-Q%[2]d", QuarterCellFmt: "Q%d"},
	TimePicker:    TimePickerLocale{StartTime: "開始時間", EndTime: "終了時間", AM: "午前", PM: "午後", Meridiem: "午前/午後"},
	Tabs:          TabsLocale{More: "その他のタブ", Add: "タブを追加"},
	Pagination:    PaginationLocale{Jump: "ページを指定して移動", Current: "現在のページ", Confirm: "確認する", Prev3: "前の 3 ページ", Next3: "次の 3 ページ"},
	Slider:        SliderLocale{Min: "最小値", Max: "最大値"},
	DropZone:      DropZoneLocale{Name: "ドロップエリア", Release: "ここで離すとファイルをドロップします"},
	EditableTable: EditableTableLocale{Actions: "操作", DeleteConfirm: "この行を削除しますか?"},
	PageContainer: PageContainerLocale{FooterToolbar: "ページ操作"},
	ProCard:       ProCardLocale{MoreInfo: "詳細情報"},
	StatisticCard: StatisticCardLocale{Up: "上昇", Down: "下降"},
	ProField: ProFieldLocale{On: "オン", Off: "オフ", StartFmt: "%s(開始)", EndFmt: "%s(終了)", Min: "最小", Max: "最大", RangeEndFmt: "%s:%s",
		JustNow: "たった今", AgoFmt: "%s前", LaterFmt: "%s後", SecondFmt: "%d 秒", MinuteFmt: "%d 分", HourFmt: "%d 時間", DayFmt: "%d 日", MonthFmt: "%d か月", YearFmt: "%d 年", InvalidJSON: "JSON の形式が正しくありません"},
	ProDescriptions: ProDescriptionsLocale{EditFmt: "%sを編集"},
	LightFilter:     LightFilterLocale{Name: "フィルター", ClearFmt: "%sをクリア", PillFmt: "%s:%s", More: "その他のフィルター", MoreFmt: "その他のフィルター(%d)"},
	LoginForm: LoginFormLocale{AccountTab: "アカウントでログイン", MobileTab: "携帯電話番号でログイン",
		Username: "ユーザー名", UsernameRequired: "ユーザー名を入力してください", Password: "パスワード", PasswordRequired: "パスワードを入力してください",
		Mobile: "携帯電話番号", MobileRequired: "携帯電話番号を入力してください", MobileInvalid: "携帯電話番号の形式が正しくありません",
		Captcha: "認証コード", CaptchaRequired: "認証コードを入力してください", GetCode: "コードを取得", ResendFmt: "%d 秒後に再送信",
		CodeSentFmt: "認証コードを送信しました。%d 秒後に再送信できます。", CodeReady: "認証コードを再送信できるようになりました。",
		Remember: "ログイン状態を保持", Forgot: "パスワードをお忘れの方", Submit: "ログイン", Others: "その他のログイン方法"},
	Chat: ChatLocale{User: "あなた", Assistant: "アシスタント", System: "システム", Messages: "メッセージ一覧", ScrollToBottom: "最新へ移動",
		Thinking: "考え中", Generating: "生成中",
		Placeholder: "メッセージを入力(Enter で送信、Shift+Enter で改行)", Send: "送信", Stop: "生成を停止", Attach: "ファイルを添付",
		Suggestions: "候補", Uploading: "アップロード中", Failed: "アップロード失敗", EditPlaceholder: "メッセージを編集",
		Pending: "待機中", Running: "実行中", Done: "完了", Error: "失敗", StepsFmt: "%d/%d",
		SecondsFmt: "%.1f 秒", MinutesFmt: "%d 分 %d 秒", ToolCall: "ツール呼び出し", Arguments: "引数", Result: "結果",
		ApprovalTitle: "確認が必要です", AllowOnce: "許可", AllowSession: "この会話で許可", AllowAlways: "常に許可", Deny: "拒否",
		Allowed: "許可済み", Denied: "拒否済み", FeedbackPlaceholder: "補足(任意)", RiskWarning: "要確認", RiskDanger: "高リスク",
		Conversations: "会話一覧", Rename: "名前を変更", Untitled: "無題の会話", Today: "今日", Yesterday: "昨日",
		Last7Days: "過去 7 日間", Last30Days: "過去 30 日間", Earlier: "それ以前", Prompts: "プロンプト"},
	SettingDrawer: SettingDrawerLocale{Open: "ページ設定を開く", Title: "ページ設定",
		NavTheme: "テーマ", Light: "ライトメニュー", Dark: "ダークメニュー", RealDark: "ダークモード",
		PrimaryColor: "テーマカラー", Layout: "ナビゲーション", Side: "サイドメニュー", Top: "トップメニュー", Mix: "ミックス",
		ContentWidth: "コンテンツ幅", Fluid: "可変", Fixed: "固定",
		FixedHeader: "ヘッダーを固定", FixSiderbar: "サイドメニューを固定", ColorWeak: "色覚サポート",
		Other: "その他の設定", Compact: "コンパクト", ColorFmt: "テーマカラー %s"},
	CodeBlock: CodeBlockLocale{Code: "コード"},
	JSONView:  JSONViewLocale{Name: "JSON ビューア", CopyValue: "値をコピー", CopyPath: "パスをコピー", ExpandAll: "すべて展開", CollapseAll: "すべて折りたたむ", ItemsFmt: "%d 項目", KeysFmt: "%d 個のキー", Search: "キーまたは値を検索", PrevMatch: "前の一致", NextMatch: "次の一致", MatchFmt: "%d/%d", NoMatch: "一致なし", ParseErrorFmt: "JSON を解析できません: %s"},
	LogView:   LogViewLocale{Name: "ログ", Search: "ログを検索", PrevMatch: "前の一致", NextMatch: "次の一致", MatchFmt: "%d/%d", NoMatch: "一致なし", Wrap: "折り返し", Follow: "最新を追跡", Level: "レベル", AllLevels: "すべてのレベル", Levels: [5]string{"Trace", "Debug", "Info", "Warn", "Error"}, LinesFmt: "%d 行"},
	StatusBar: StatusBarLocale{Label: "ステータスバー"},
	TitleBar:  TitleBarLocale{Minimize: "最小化", Maximize: "最大化", Restore: "元に戻す", WindowControls: "ウィンドウ操作"},
	NotificationCenter: NotificationCenterLocale{MarkAllRead: "すべて既読にする", ClearAll: "すべてクリア", Dismiss: "通知を削除",
		Empty: "通知はありません", UnreadFmt: "未読 %d 件", JustNow: "たった今", MinutesAgoFmt: "%d 分前", HoursAgoFmt: "%d 時間前", DaysAgoFmt: "%d 日前"},
	HotkeyInput: HotkeyInputLocale{Placeholder: "クリックしてショートカットを記録", Recording: "キーの組み合わせを押してください(Esc で取消)", ClearLabel: "ショートカットをクリア"},
	Dock:        DockLocale{Maximize: "最大化", Restore: "元に戻す", Split: "右に分割", Empty: "ここにタブをドラッグ", Group: "タブグループ"},
}

Ja is the Japanese locale.

go
var MessageDuration = 3 * time.Second

MessageDuration is how long Message toasts stay visible by default.

实验性

go
var NotifyStackThreshold = 3

NotifyStackThreshold is the count above which cards collapse into a stack until hovered (Ant stack mode). 0 disables stacking.

实验性

go
var ProSettingsPresetColors = []theme.Color{
	theme.Hex("#1677ff"), theme.Hex("#1890ff"), theme.Hex("#f5222d"), theme.Hex("#fa541c"), theme.Hex("#faad14"),
	theme.Hex("#13c2c2"), theme.Hex("#52c41a"), theme.Hex("#2f54eb"), theme.Hex("#722ed1"),
}

ProSettingsPresetColors are the theme colors offered by SettingDrawer (Pro's daybreak, dust, volcano, sunset, cyan, green, geekblue, purple).

实验性

go
var ZhCN = &Locale{
	Code: "zh-CN", Name: "简体中文",
	OK: "确定", Cancel: "取消", Close: "关闭", Confirm: "确认", Back: "返回", Clear: "清除", Reset: "重置",
	Search: "搜索", Save: "保存", Delete: "删除", Edit: "编辑", Copy: "复制", Copied: "复制成功", More: "更多",
	Expand: "展开", Collapse: "收起", SelectAll: "全选", Loading: "加载中", Retry: "重试", GotIt: "知道了",
	NoData: "暂无数据", NoMore: "没有更多了", LoadMore: "加载更多", LoadFailed: "加载失败",
	TotalFmt: "共 %d 条", RangeTotalFmt: "第 %d-%d 条/共 %d 条", PageSizeFmt: "%d 条/页",
	PrevPage: "上一页", NextPage: "下一页", Prev5: "向前 5 页", Next5: "向后 5 页", JumpTo: "跳至", PageSuffix: "页",
	Placeholder: "请输入", SelectPlaceholder: "请选择", Required: "此项为必填项", NotFound: "无匹配数据",
	LabelColon: ":", SelectedFmt: "已选择 %d 项",
	Today: "今天", Now: "此刻", SelectDate: "请选择日期", SelectTime: "请选择时间", SelectDateTime: "请选择日期时间",
	StartDate: "开始日期", EndDate: "结束日期",
	PrevYear: "上一年", NextYear: "下一年", PrevMonth: "上个月", NextMonth: "下个月", RangeSeparator: "至",
	YearFmt: "%d年", MonthFmt: "%d月", YearMonthFmt: "%d年%d月",
	Weekdays:      [7]string{"日", "一", "二", "三", "四", "五", "六"},
	Months:        [12]string{"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"},
	WeekStart:     time.Sunday,
	FilterConfirm: "确定", FilterReset: "重置", SortAsc: "点击升序", SortDesc: "点击降序", CancelSort: "取消排序",
	SelectionAll: "全选所有", SelectionInvert: "反选当页", ExpandRow: "展开行", CollapseRow: "关闭行",
	ItemUnit: "项", ItemsUnit: "项", Searching: "搜索中", Currency: "¥",
	MessageBoxTitle: "提示", Info: "提示", Success: "成功", Warning: "警告", Error: "错误", BackTop: "回到顶部",
	CollapseMenu: "折叠菜单", ExpandMenu: "展开菜单", Fullscreen: "全屏", ExitFullscreen: "退出全屏",
	PromptPlaceholder: "请输入内容", PromptInvalid: "输入的数据不合法", CloseAll: "全部关闭", Steps: "步骤",

	Calendar: CalendarLocale{Month: "月", Year: "年"},
	Carousel: CarouselLocale{Prev: "上一张", Next: "下一张"},
	Image: ImageLocale{
		Preview: "预览", PreviewLabel: "预览图片", ClosePreview: "关闭预览", Prev: "上一张", Next: "下一张",
		ZoomIn: "放大", ZoomOut: "缩小", RotateLeft: "向左旋转", RotateRight: "向右旋转",
		FlipHorizontal: "左右翻转", FlipVertical: "上下翻转",
	},
	ColorPicker: ColorPickerLocale{Presets: "推荐", None: "无", ClearColor: "清除颜色", Clear: "清空",
		Saturation: "饱和度", Hue: "色相", Alpha: "透明度", Format: "颜色格式", Value: "颜色值", Gradient: "渐变色标", Angle: "角度"},
	Tour:    TourLocale{Close: "关闭引导", Prev: "上一步", Next: "下一步", Finish: "结束导览"},
	Command: CommandLocale{Placeholder: "输入命令或搜索…", Empty: "没有找到结果。"},
	QRCode:  QRCodeLocale{Expired: "二维码过期", Refresh: "点击刷新", Scanned: "已扫描"},
	Table: TableLocale{FilterSearch: "在筛选项中搜索", FilterAll: "全部", Filter: "筛选", FixedLeft: "固定在左侧", NoFixed: "不固定", FixedRight: "固定在右侧", PinLeft: "固定在列首", PinRight: "固定在列尾", Unpin: "不固定", SelectRowFmt: "选择第 %d 行",
		Selections: "选择选项", SelectPage: "选择当页", SelectNone: "清空所有", SumText: "合计"},
	Mobile: MobileLocale{PullToRefresh: "下拉刷新", ReleaseToRefresh: "释放立即刷新", Refreshed: "刷新成功", TapToRetry: ",点击重试", DayFmt: "%d日", HourFmt: "%02d时", MinuteFmt: "%02d分"},
	Graph: GraphLocale{Diagram: "关系图", ER: "ER 图", GitGraph: "提交图", ZoomIn: "放大", ZoomOut: "缩小", FitView: "适应视图", AutoLayout: "自动布局", MiniMap: "小地图",
		PrimaryKey: "主键", ForeignKey: "外键", SummaryFmt: "%[1]d 个节点,%[2]d 条连线", CommitsFmt: "%d 个提交"},
	Chart: ChartLocale{Total: "总计", Conversion: "转化率", Line: "折线图", Area: "面积图", Column: "柱状图", Bar: "条形图", Pie: "饼图", Donut: "环形图", Scatter: "散点图", Radar: "雷达图",
		Gauge: "仪表盘", Funnel: "漏斗图", Heatmap: "热力图", DualAxes: "双轴图", Liquid: "水波图", Sparkline: "迷你图",
		SummaryFmt: "%[1]s,%[2]d 个系列,%[3]d 个数据点", XRangeFmt: ";横轴从 %s 到 %s", YRangeFmt: ";数值从 %s 到 %s", ValueFmt: "%s:%s"},
	ProTable: ProTableLocale{Query: "查询", Reload: "刷新", Density: "密度",
		DensityDefault: "默认", DensityMiddle: "中等", DensityCompact: "紧凑",
		ColumnSetting: "列设置", ColumnDisplay: "列展示", ClearSelection: "取消选择", LoadErrorFmt: "数据加载失败:%s"},
	Transfer: TransferLocale{Source: "源列表", Target: "目标列表", SearchPlaceholder: "请输入搜索内容"},
	Upload: UploadLocale{Trigger: "上传", Uploading: "文件上传中", Remove: "删除文件", Preview: "预览文件",
		Button: "点击上传", DragTitle: "点击或将文件拖拽到这里上传", DropPrefix: "将文件拖到此处,或",
		DoneFmt: "%s 上传成功", FailedFmt: "%s 上传失败", TooManyFmt: "%s:文件数量已达上限", BadTypeFmt: "%s:不支持该文件类型",
		TooLargeFmt: "%s 超过 %s", IsDirFmt: "%s 是文件夹"},
	Markdown: MarkdownLocale{ImagePrefix: "[图片] ", CopyCode: "复制代码", Copied: "已复制"},
	MarkdownEditor: MarkdownEditorLocale{Placeholder: "在此输入 Markdown……",
		Heading: "标题", Bold: "粗体", Italic: "斜体", Strike: "删除线", Code: "代码", Link: "链接", Quote: "引用",
		BulletList: "无序列表", OrderedList: "有序列表", Task: "任务", CodeBlock: "代码块", Table: "表格", Divider: "分割线",
		BoldSample: "粗体文字", ItalicSample: "斜体文字", StrikeSample: "删除文字", LinkSample: "链接文字", TableColumnFmt: "列 %d",
		Edit: "编辑", Split: "分屏", Preview: "预览"},
	Form: FormLocale{Validating: "校验中…", RequiredInputFmt: "请输入%s", RequiredSelectFmt: "请选择%s", Submit: "提交", Query: "查询", PrevStep: "上一步", NextStep: "下一步", MoveUp: "上移", MoveDown: "下移", AddRow: "添加一行数据", Optional: "(可选)"},
	A11y: A11yLocale{Navigation: "导航", Breadcrumb: "面包屑", Pagination: "分页", Notifications: "通知", Toolbar: "工具栏", Menu: "菜单",
		PageFmt: "第 %d 页", MoreActions: "更多操作", OpenMenu: "打开菜单", Remove: "移除", DragHandle: "拖动排序", Resize: "调整大小", Splitter: "分隔条",
		ShowPassword: "显示密码", HidePassword: "隐藏密码", Increase: "增加", Decrease: "减少",
		Avatar: "头像", Image: "图片", Chart: "图表", Progress: "进度", Rating: "评分", Color: "颜色", Loading: "加载中",
		SlideFmt: "第 %d 张,共 %d 张", RateFmt: "%[1]g 星,共 %[2]d 星",
		DateFmt: "%d年%d月%d日", DigitFmt: "第 %d 位,共 %d 位", RemoveFmt: "移除 %s", Day: "日", Hour: "时", Minute: "分", Second: "秒",
		MoveToTarget: "移到目标列表", MoveToSource: "移回源列表",
		PageSize: "每页条数"},
	DatePicker: DatePickerLocale{SelectWeek: "请选择周", SelectMonth: "请选择月份", SelectQuarter: "请选择季度", SelectYear: "请选择年份",
		StartWeek: "开始周", EndWeek: "结束周", StartMonth: "开始月份", EndMonth: "结束月份",
		StartQuarter: "开始季度", EndQuarter: "结束季度", StartYear: "开始年份", EndYear: "结束年份",
		PrevDecade: "上一年代", NextDecade: "下一年代", WeekFmt: "%[1]d-第%[2]d周", QuarterFmt: "%[1]d-Q%[2]d", QuarterCellFmt: "Q%d"},
	TimePicker:    TimePickerLocale{StartTime: "开始时间", EndTime: "结束时间", AM: "上午", PM: "下午", Meridiem: "上午/下午"},
	Tabs:          TabsLocale{More: "更多标签页", Add: "添加标签页"},
	Pagination:    PaginationLocale{Jump: "跳转页码", Current: "当前页", Confirm: "确定", Prev3: "向前 3 页", Next3: "向后 3 页"},
	Slider:        SliderLocale{Min: "最小值", Max: "最大值"},
	DropZone:      DropZoneLocale{Name: "拖放区域", Release: "松开即可把文件放到这里"},
	EditableTable: EditableTableLocale{Actions: "操作", DeleteConfirm: "删除此行?"},
	PageContainer: PageContainerLocale{FooterToolbar: "页面操作"},
	ProCard:       ProCardLocale{MoreInfo: "更多信息"},
	StatisticCard: StatisticCardLocale{Up: "上升", Down: "下降"},
	ProField: ProFieldLocale{On: "开", Off: "关", StartFmt: "%s开始", EndFmt: "%s结束", Min: "最小值", Max: "最大值", RangeEndFmt: "%s:%s",
		JustNow: "刚刚", AgoFmt: "%s前", LaterFmt: "%s后", SecondFmt: "%d 秒", MinuteFmt: "%d 分钟", HourFmt: "%d 小时", DayFmt: "%d 天", MonthFmt: "%d 个月", YearFmt: "%d 年", InvalidJSON: "JSON 格式错误"},
	ProDescriptions: ProDescriptionsLocale{EditFmt: "编辑%s"},
	LightFilter:     LightFilterLocale{Name: "筛选", ClearFmt: "清除%s", PillFmt: "%s:%s", More: "更多筛选", MoreFmt: "更多筛选(%d)"},
	LoginForm: LoginFormLocale{AccountTab: "账户密码登录", MobileTab: "手机号登录",
		Username: "用户名", UsernameRequired: "请输入用户名", Password: "密码", PasswordRequired: "请输入密码",
		Mobile: "手机号", MobileRequired: "请输入手机号", MobileInvalid: "手机号格式错误",
		Captcha: "验证码", CaptchaRequired: "请输入验证码", GetCode: "获取验证码", ResendFmt: "%d 秒后重新获取",
		CodeSentFmt: "验证码已发送,%d 秒后可重新获取。", CodeReady: "现在可以重新获取验证码。",
		Remember: "自动登录", Forgot: "忘记密码", Submit: "登录", Others: "其他登录方式"},
	Chat: ChatLocale{User: "我", Assistant: "助手", System: "系统", Messages: "消息列表", ScrollToBottom: "回到底部",
		Thinking: "正在思考", Generating: "正在生成",
		Placeholder: "输入消息,Enter 发送,Shift+Enter 换行", Send: "发送", Stop: "停止生成", Attach: "添加附件",
		Suggestions: "建议", Uploading: "上传中", Failed: "上传失败", EditPlaceholder: "编辑消息",
		Pending: "等待中", Running: "进行中", Done: "已完成", Error: "失败", StepsFmt: "%d/%d",
		SecondsFmt: "%.1f 秒", MinutesFmt: "%d 分 %d 秒", ToolCall: "工具调用", Arguments: "参数", Result: "结果",
		ApprovalTitle: "需要你的确认", AllowOnce: "允许", AllowSession: "本次会话允许", AllowAlways: "总是允许", Deny: "拒绝",
		Allowed: "已允许", Denied: "已拒绝", FeedbackPlaceholder: "补充说明(可选)", RiskWarning: "需确认", RiskDanger: "高风险",
		Conversations: "会话列表", Rename: "重命名", Untitled: "未命名对话", Today: "今天", Yesterday: "昨天",
		Last7Days: "近 7 天", Last30Days: "近 30 天", Earlier: "更早", Prompts: "提示词"},
	SettingDrawer: SettingDrawerLocale{Open: "打开页面设置", Title: "页面设置",
		NavTheme: "整体风格", Light: "亮色菜单", Dark: "暗色菜单", RealDark: "暗色模式",
		PrimaryColor: "主题色", Layout: "导航模式", Side: "侧边菜单", Top: "顶部菜单", Mix: "混合菜单",
		ContentWidth: "内容区域宽度", Fluid: "流式", Fixed: "定宽",
		FixedHeader: "固定顶栏", FixSiderbar: "固定侧边菜单", ColorWeak: "色弱模式",
		Other: "其他设置", Compact: "紧凑模式", ColorFmt: "主题色 %s"},
	CodeBlock: CodeBlockLocale{Code: "代码"},
	JSONView:  JSONViewLocale{Name: "JSON 查看器", CopyValue: "复制值", CopyPath: "复制路径", ExpandAll: "全部展开", CollapseAll: "全部折叠", ItemsFmt: "%d 项", KeysFmt: "%d 个键", Search: "搜索键或值", PrevMatch: "上一个匹配", NextMatch: "下一个匹配", MatchFmt: "%d/%d", NoMatch: "无匹配", ParseErrorFmt: "JSON 解析失败:%s"},
	LogView:   LogViewLocale{Name: "日志", Search: "搜索日志", PrevMatch: "上一个匹配", NextMatch: "下一个匹配", MatchFmt: "%d/%d", NoMatch: "无匹配", Wrap: "自动换行", Follow: "跟随最新", Level: "级别", AllLevels: "全部级别", Levels: [5]string{"Trace", "Debug", "Info", "Warn", "Error"}, LinesFmt: "%d 行"},
	StatusBar: StatusBarLocale{Label: "状态栏"},
	TitleBar:  TitleBarLocale{Minimize: "最小化", Maximize: "最大化", Restore: "向下还原", WindowControls: "窗口控制"},
	NotificationCenter: NotificationCenterLocale{MarkAllRead: "全部标为已读", ClearAll: "清空通知", Dismiss: "移除通知",
		Empty: "暂无通知", UnreadFmt: "%d 条未读", JustNow: "刚刚", MinutesAgoFmt: "%d 分钟前", HoursAgoFmt: "%d 小时前", DaysAgoFmt: "%d 天前"},
	HotkeyInput: HotkeyInputLocale{Placeholder: "点击录制快捷键", Recording: "请按下组合键,Esc 取消", ClearLabel: "清除快捷键"},
	Dock:        DockLocale{Maximize: "最大化", Restore: "还原", Split: "向右拆分", Empty: "将标签页拖到这里", Group: "标签组"},
}

ZhCN is the Simplified Chinese locale (default).

go
var ZhTW = &Locale{
	Code: "zh-TW", Name: "繁體中文",
	OK: "確定", Cancel: "取消", Close: "關閉", Confirm: "確認", Back: "返回", Clear: "清除", Reset: "重設",
	Search: "搜尋", Save: "儲存", Delete: "刪除", Edit: "編輯", Copy: "複製", Copied: "已複製", More: "更多",
	Expand: "展開", Collapse: "收合", SelectAll: "全選", Loading: "載入中", Retry: "重試", GotIt: "知道了",
	NoData: "暫無資料", NoMore: "沒有更多了", LoadMore: "載入更多", LoadFailed: "載入失敗",
	TotalFmt: "共 %d 筆", RangeTotalFmt: "第 %d-%d 筆/共 %d 筆", PageSizeFmt: "%d 筆/頁",
	PrevPage: "上一頁", NextPage: "下一頁", Prev5: "向前 5 頁", Next5: "向後 5 頁", JumpTo: "跳至", PageSuffix: "頁",
	Placeholder: "請輸入", SelectPlaceholder: "請選擇", Required: "此欄位為必填", NotFound: "無符合資料",
	LabelColon: ":", SelectedFmt: "已選擇 %d 項",
	Today: "今天", Now: "此刻", SelectDate: "請選擇日期", SelectTime: "請選擇時間", SelectDateTime: "請選擇日期時間",
	StartDate: "開始日期", EndDate: "結束日期",
	PrevYear: "上一年", NextYear: "下一年", PrevMonth: "上個月", NextMonth: "下個月", RangeSeparator: "至",
	YearFmt: "%d年", MonthFmt: "%d月", YearMonthFmt: "%d年%d月",
	Weekdays:      [7]string{"日", "一", "二", "三", "四", "五", "六"},
	Months:        [12]string{"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"},
	WeekStart:     time.Sunday,
	FilterConfirm: "確定", FilterReset: "重設", SortAsc: "點擊升序", SortDesc: "點擊降序", CancelSort: "取消排序",
	SelectionAll: "全部選取", SelectionInvert: "反向選取", ExpandRow: "展開列", CollapseRow: "收合列",
	ItemUnit: "項", ItemsUnit: "項", Searching: "搜尋中", Currency: "NT$",
	MessageBoxTitle: "提示", Info: "提示", Success: "成功", Warning: "警告", Error: "錯誤", BackTop: "回到頂端",
	CollapseMenu: "收合選單", ExpandMenu: "展開選單", Fullscreen: "全螢幕", ExitFullscreen: "離開全螢幕",
	PromptPlaceholder: "請輸入內容", PromptInvalid: "輸入的資料不合法", CloseAll: "全部關閉", Steps: "步驟",

	Calendar: CalendarLocale{Month: "月", Year: "年"},
	Carousel: CarouselLocale{Prev: "上一張", Next: "下一張"},
	Image: ImageLocale{
		Preview: "預覽", PreviewLabel: "預覽圖片", ClosePreview: "關閉預覽", Prev: "上一張", Next: "下一張",
		ZoomIn: "放大", ZoomOut: "縮小", RotateLeft: "向左旋轉", RotateRight: "向右旋轉",
		FlipHorizontal: "左右翻轉", FlipVertical: "上下翻轉",
	},
	ColorPicker: ColorPickerLocale{Presets: "推薦", None: "無", ClearColor: "清除顏色", Clear: "清空",
		Saturation: "飽和度", Hue: "色相", Alpha: "透明度", Format: "色彩格式", Value: "色彩值", Gradient: "漸層色標", Angle: "角度"},
	Tour:    TourLocale{Close: "關閉導覽", Prev: "上一步", Next: "下一步", Finish: "結束導覽"},
	Command: CommandLocale{Placeholder: "輸入指令或搜尋…", Empty: "找不到結果。"},
	QRCode:  QRCodeLocale{Expired: "QR 碼已過期", Refresh: "點擊重新整理", Scanned: "已掃描"},
	Table: TableLocale{FilterSearch: "在篩選項目中搜尋", FilterAll: "全部", Filter: "篩選", FixedLeft: "固定在左側", NoFixed: "不固定", FixedRight: "固定在右側", PinLeft: "固定在列首", PinRight: "固定在列尾", Unpin: "不固定", SelectRowFmt: "選擇第 %d 列",
		Selections: "選取選項", SelectPage: "選取本頁", SelectNone: "清除所有選取", SumText: "合計"},
	Mobile: MobileLocale{PullToRefresh: "下拉重新整理", ReleaseToRefresh: "放開立即重新整理", Refreshed: "重新整理成功", TapToRetry: ",點擊重試", DayFmt: "%d日", HourFmt: "%02d時", MinuteFmt: "%02d分"},
	Graph: GraphLocale{Diagram: "關係圖", ER: "ER 圖", GitGraph: "提交圖", ZoomIn: "放大", ZoomOut: "縮小", FitView: "適應視圖", AutoLayout: "自動配置", MiniMap: "小地圖",
		PrimaryKey: "主鍵", ForeignKey: "外鍵", SummaryFmt: "%[1]d 個節點,%[2]d 條連線", CommitsFmt: "%d 個提交"},
	Chart: ChartLocale{Total: "總計", Conversion: "轉換率", Line: "折線圖", Area: "面積圖", Column: "直條圖", Bar: "橫條圖", Pie: "圓餅圖", Donut: "環形圖", Scatter: "散佈圖", Radar: "雷達圖",
		Gauge: "儀表板", Funnel: "漏斗圖", Heatmap: "熱度圖", DualAxes: "雙軸圖", Liquid: "水波圖", Sparkline: "迷你圖",
		SummaryFmt: "%[1]s,%[2]d 個數列,%[3]d 個資料點", XRangeFmt: ";橫軸從 %s 到 %s", YRangeFmt: ";數值從 %s 到 %s", ValueFmt: "%s:%s"},
	ProTable: ProTableLocale{Query: "查詢", Reload: "重新整理", Density: "密度",
		DensityDefault: "預設", DensityMiddle: "中等", DensityCompact: "緊湊",
		ColumnSetting: "欄位設定", ColumnDisplay: "欄位顯示", ClearSelection: "取消選擇", LoadErrorFmt: "資料載入失敗:%s"},
	Transfer: TransferLocale{Source: "來源清單", Target: "目的清單", SearchPlaceholder: "請輸入搜尋內容"},
	Upload: UploadLocale{Trigger: "上傳", Uploading: "檔案上傳中", Remove: "刪除檔案", Preview: "預覽檔案",
		Button: "點擊上傳", DragTitle: "點擊或將檔案拖曳到此區域上傳", DropPrefix: "將檔案拖到此處,或",
		DoneFmt: "%s 上傳成功", FailedFmt: "%s 上傳失敗", TooManyFmt: "%s:檔案數量已達上限", BadTypeFmt: "%s:不支援此檔案類型",
		TooLargeFmt: "%s 超過 %s", IsDirFmt: "%s 是資料夾"},
	Markdown: MarkdownLocale{ImagePrefix: "[圖片] ", CopyCode: "複製程式碼", Copied: "已複製"},
	MarkdownEditor: MarkdownEditorLocale{Placeholder: "在此輸入 Markdown……",
		Heading: "標題", Bold: "粗體", Italic: "斜體", Strike: "刪除線", Code: "程式碼", Link: "連結", Quote: "引用",
		BulletList: "項目清單", OrderedList: "編號清單", Task: "待辦", CodeBlock: "程式碼區塊", Table: "表格", Divider: "分隔線",
		BoldSample: "粗體文字", ItalicSample: "斜體文字", StrikeSample: "刪除文字", LinkSample: "連結文字", TableColumnFmt: "欄 %d",
		Edit: "編輯", Split: "分割", Preview: "預覽"},
	Form: FormLocale{Validating: "驗證中…", RequiredInputFmt: "請輸入%s", RequiredSelectFmt: "請選擇%s", Submit: "提交", Query: "查詢", PrevStep: "上一步", NextStep: "下一步", MoveUp: "上移", MoveDown: "下移", AddRow: "新增一列資料", Optional: "(選填)"},
	A11y: A11yLocale{Navigation: "導覽", Breadcrumb: "麵包屑", Pagination: "分頁", Notifications: "通知", Toolbar: "工具列", Menu: "選單",
		PageFmt: "第 %d 頁", MoreActions: "更多操作", OpenMenu: "開啟選單", Remove: "移除", DragHandle: "拖曳排序", Resize: "調整大小", Splitter: "分隔線",
		ShowPassword: "顯示密碼", HidePassword: "隱藏密碼", Increase: "增加", Decrease: "減少",
		Avatar: "頭像", Image: "圖片", Chart: "圖表", Progress: "進度", Rating: "評分", Color: "顏色", Loading: "載入中",
		SlideFmt: "第 %d 張,共 %d 張", RateFmt: "%[1]g 顆星,共 %[2]d 顆星",
		DateFmt: "%d年%d月%d日", DigitFmt: "第 %d 位,共 %d 位", RemoveFmt: "移除 %s", Day: "日", Hour: "時", Minute: "分", Second: "秒",
		MoveToTarget: "移到目標列表", MoveToSource: "移回來源列表",
		PageSize: "每頁筆數"},
	DatePicker: DatePickerLocale{SelectWeek: "請選擇週", SelectMonth: "請選擇月份", SelectQuarter: "請選擇季度", SelectYear: "請選擇年份",
		StartWeek: "開始週", EndWeek: "結束週", StartMonth: "開始月份", EndMonth: "結束月份",
		StartQuarter: "開始季度", EndQuarter: "結束季度", StartYear: "開始年份", EndYear: "結束年份",
		PrevDecade: "上一個年代", NextDecade: "下一個年代", WeekFmt: "%[1]d-第%[2]d週", QuarterFmt: "%[1]d-Q%[2]d", QuarterCellFmt: "Q%d"},
	TimePicker:    TimePickerLocale{StartTime: "開始時間", EndTime: "結束時間", AM: "上午", PM: "下午", Meridiem: "上午/下午"},
	Tabs:          TabsLocale{More: "更多分頁", Add: "新增分頁"},
	Pagination:    PaginationLocale{Jump: "跳至頁碼", Current: "目前頁碼", Confirm: "確定", Prev3: "向前 3 頁", Next3: "向後 3 頁"},
	Slider:        SliderLocale{Min: "最小值", Max: "最大值"},
	DropZone:      DropZoneLocale{Name: "拖放區域", Release: "放開即可將檔案放到這裡"},
	EditableTable: EditableTableLocale{Actions: "操作", DeleteConfirm: "確定刪除此列?"},
	PageContainer: PageContainerLocale{FooterToolbar: "頁面操作"},
	ProCard:       ProCardLocale{MoreInfo: "更多資訊"},
	StatisticCard: StatisticCardLocale{Up: "上升", Down: "下降"},
	ProField: ProFieldLocale{On: "開", Off: "關", StartFmt: "%s開始", EndFmt: "%s結束", Min: "最小值", Max: "最大值", RangeEndFmt: "%s:%s",
		JustNow: "剛剛", AgoFmt: "%s前", LaterFmt: "%s後", SecondFmt: "%d 秒", MinuteFmt: "%d 分鐘", HourFmt: "%d 小時", DayFmt: "%d 天", MonthFmt: "%d 個月", YearFmt: "%d 年", InvalidJSON: "JSON 格式錯誤"},
	ProDescriptions: ProDescriptionsLocale{EditFmt: "編輯%s"},
	LightFilter:     LightFilterLocale{Name: "篩選", ClearFmt: "清除%s", PillFmt: "%s:%s", More: "更多篩選", MoreFmt: "更多篩選(%d)"},
	LoginForm: LoginFormLocale{AccountTab: "帳號密碼登入", MobileTab: "手機號碼登入",
		Username: "帳號", UsernameRequired: "請輸入帳號", Password: "密碼", PasswordRequired: "請輸入密碼",
		Mobile: "手機號碼", MobileRequired: "請輸入手機號碼", MobileInvalid: "手機號碼格式錯誤",
		Captcha: "驗證碼", CaptchaRequired: "請輸入驗證碼", GetCode: "取得驗證碼", ResendFmt: "%d 秒後重新取得",
		CodeSentFmt: "驗證碼已傳送,%d 秒後可重新取得。", CodeReady: "現在可以重新取得驗證碼。",
		Remember: "自動登入", Forgot: "忘記密碼", Submit: "登入", Others: "其他登入方式"},
	Chat: ChatLocale{User: "我", Assistant: "助理", System: "系統", Messages: "訊息列表", ScrollToBottom: "回到底部",
		Thinking: "正在思考", Generating: "正在產生",
		Placeholder: "輸入訊息,Enter 傳送,Shift+Enter 換行", Send: "傳送", Stop: "停止產生", Attach: "新增附件",
		Suggestions: "建議", Uploading: "上傳中", Failed: "上傳失敗", EditPlaceholder: "編輯訊息",
		Pending: "等待中", Running: "進行中", Done: "已完成", Error: "失敗", StepsFmt: "%d/%d",
		SecondsFmt: "%.1f 秒", MinutesFmt: "%d 分 %d 秒", ToolCall: "工具呼叫", Arguments: "參數", Result: "結果",
		ApprovalTitle: "需要你的確認", AllowOnce: "允許", AllowSession: "本次對話允許", AllowAlways: "一律允許", Deny: "拒絕",
		Allowed: "已允許", Denied: "已拒絕", FeedbackPlaceholder: "補充說明(選填)", RiskWarning: "需確認", RiskDanger: "高風險",
		Conversations: "對話列表", Rename: "重新命名", Untitled: "未命名對話", Today: "今天", Yesterday: "昨天",
		Last7Days: "過去 7 天", Last30Days: "過去 30 天", Earlier: "更早", Prompts: "提示詞"},
	SettingDrawer: SettingDrawerLocale{Open: "開啟頁面設定", Title: "頁面設定",
		NavTheme: "整體風格", Light: "亮色選單", Dark: "暗色選單", RealDark: "暗色模式",
		PrimaryColor: "主題色", Layout: "導覽模式", Side: "側邊選單", Top: "頂部選單", Mix: "混合選單",
		ContentWidth: "內容區域寬度", Fluid: "流式", Fixed: "定寬",
		FixedHeader: "固定頂欄", FixSiderbar: "固定側邊選單", ColorWeak: "色弱模式",
		Other: "其他設定", Compact: "緊湊模式", ColorFmt: "主題色 %s"},
	CodeBlock: CodeBlockLocale{Code: "程式碼"},
	JSONView:  JSONViewLocale{Name: "JSON 檢視器", CopyValue: "複製值", CopyPath: "複製路徑", ExpandAll: "全部展開", CollapseAll: "全部摺疊", ItemsFmt: "%d 項", KeysFmt: "%d 個鍵", Search: "搜尋鍵或值", PrevMatch: "上一個相符項", NextMatch: "下一個相符項", MatchFmt: "%d/%d", NoMatch: "無相符項", ParseErrorFmt: "JSON 解析失敗:%s"},
	LogView:   LogViewLocale{Name: "日誌", Search: "搜尋日誌", PrevMatch: "上一個相符項", NextMatch: "下一個相符項", MatchFmt: "%d/%d", NoMatch: "無相符項", Wrap: "自動換行", Follow: "跟隨最新", Level: "等級", AllLevels: "全部等級", Levels: [5]string{"Trace", "Debug", "Info", "Warn", "Error"}, LinesFmt: "%d 行"},
	StatusBar: StatusBarLocale{Label: "狀態列"},
	TitleBar:  TitleBarLocale{Minimize: "最小化", Maximize: "最大化", Restore: "還原", WindowControls: "視窗控制"},
	NotificationCenter: NotificationCenterLocale{MarkAllRead: "全部標為已讀", ClearAll: "清除所有通知", Dismiss: "移除通知",
		Empty: "沒有通知", UnreadFmt: "%d 則未讀", JustNow: "剛剛", MinutesAgoFmt: "%d 分鐘前", HoursAgoFmt: "%d 小時前", DaysAgoFmt: "%d 天前"},
	HotkeyInput: HotkeyInputLocale{Placeholder: "按一下以錄製快速鍵", Recording: "請按下組合鍵,Esc 取消", ClearLabel: "清除快速鍵"},
	Dock:        DockLocale{Maximize: "最大化", Restore: "還原", Split: "向右分割", Empty: "將分頁拖曳到這裡", Group: "分頁群組"},
}

ZhTW is the Traditional Chinese locale with Taiwan usage. LocaleByCode maps zh-TW, zh-HK, zh-MO and zh-Hant to it.

函数 ​

func AcceptPatterns 实验性 ​

go
func AcceptPatterns(accept string) []string

AcceptPatterns turns an accept list into file-dialog patterns ("*.png"); MIME wildcards expand to common extensions. Hosts use it to build the native dialog's filter (uihost.FilePicker).

func BreakpointMins 实验性 ​

go
func BreakpointMins(th *theme.Theme) [5]float32

BreakpointMins returns the minimum widths of SM..XXL for the theme: Ant 576/768/992/1200/1600, Element 768/992/1200/1920 (no xxl), shadcn Tailwind's sm..2xl 640/768/1024/1280/1536.

func CloseContextMenu 实验性 ​

go
func CloseContextMenu(c *Context, owner ID)

CloseContextMenu closes the context menu opened for owner, if any, returning focus to owner when it was inside the menu.

func ContextMenuAt 实验性 ​

go
func ContextMenuAt(c *Context, owner ID, pos geom.Point, items []MenuItem, onSelect func(key string))

ContextMenuAt opens a context menu of items with its top-left corner at the window point pos (top-right in right-to-left scopes); it opens upwards / towards the inline start when it does not fit below / after the point. owner is the widget the menu belongs to: keyboard focus moves to the first enabled item on open (to the panel itself with ContextMenuOptions.NoAutoSelect, see ContextMenuAtWith) and returns to owner when the menu closes (an item is chosen, Escape, or a press outside the menu). onSelect receives the key of the chosen leaf item. The menu takes the theme, locale and direction of the scope ContextMenuAt is called in.

Call it once to open the menu (not every frame):

if p, ok := c.ContextMenuFor(area.ID()); ok {
	ui.ContextMenuAt(c, area.ID(), p, items, func(key string) { ... })
}

Calling it again while the menu is open at the same point for the same owner only updates items and onSelect; a new point or owner reopens it.

func ContextMenuAtWith 实验性 ​

go
func ContextMenuAtWith(c *Context, owner ID, pos geom.Point, items []MenuItem, onSelect func(key string), opts ContextMenuOptions)

ContextMenuAtWith is ContextMenuAt with options. Options take effect when the menu (re)opens.

func ContextMenuOpen 实验性 ​

go
func ContextMenuOpen(c *Context, owner ID) bool

ContextMenuOpen reports whether a context menu opened for owner is shown.

func Disabled ​

go
func Disabled(c *Context, on bool, fn func())

Disabled runs fn with every widget inside disabled.

func FieldSet 实验性 ​

go
func FieldSet(c *Context, f *FormW, fs ProFieldSet, vals ProValues)

FieldSet builds a field set as a labelled item of form f (outside a ProForm); vals holds the values. While vals has no fs.Key entry it is filled with a copy of fs.Initial (checked every frame, like ProForm's initial values), so an existing value is never overwritten; to clear the set store nil parts (e.g. []any{nil, nil}) instead of deleting the key.

func FillLocale ​

go
func FillLocale(l, base *Locale)

FillLocale copies every empty text of l (string fields, entries of the fixed arrays, fields of the component groups and missing Extra keys) from base. RegisterLocale calls it with EnUS so a partial translation never shows blank labels, and new fields added later fall back automatically. WeekStart is not copied (its zero value, Sunday, is valid).

func FormStatus 实验性 ​

go
func FormStatus(err string) string

FormStatus returns the status string to pass to a control for an error.

func FormatDuration 实验性 ​

go
func FormatDuration(d time.Duration, format string) string

FormatDuration renders d with tokens D (days), HH, mm, ss, SSS. Larger units absent from the format carry into the largest present one.

func FormatMoney 实验性 ​

go
func FormatMoney(loc *Locale, amount float64, currency string) string

FormatMoney formats amount in a currency for loc. currency is an ISO 4217 code or a symbol; "" means loc.Currency (itself a code or a symbol), else the default of the locale's region (see ProColumn.Currency). A nil loc formats like zh-CN.

func FormatNumber 实验性 ​

go
func FormatNumber(v float64, precision int) string

FormatNumber formats v with thousands separators.

func Gap ​

go
func Gap(c *Context, size float32)

Gap inserts a fixed-size blank.

func HoverDelay 实验性 ​

go
func HoverDelay(c *Context, key ID, hovering bool, enter, leave time.Duration) bool

HoverDelay turns a raw hover signal into a debounced open state: it becomes true after hovering has held for enter and false after it has been off for leave (Ant mouseEnterDelay/mouseLeaveDelay, Element show-after/hide-after). key identifies the trigger across frames.

func Invalidate ​

go
func Invalidate(w Window)

Invalidate requests a frame of the window w; it is safe to call from any goroutine. Equivalent to w.Invalidate, but tolerates a nil window.

func Key ​

go
func Key(c *Context, key any, fn func())

Key runs fn in an identity scope named by key, so widgets inside keep their state when siblings are inserted or removed (list rows, tabs).

func MarkdownInsertBlock 实验性 ​

go
func MarkdownInsertBlock(src string, at int, block string) (string, int, int)

MarkdownInsertBlock inserts block on its own lines at position at; the caret lands on the block's first empty line (or after it).

func MarkdownLinePrefix 实验性 ​

go
func MarkdownLinePrefix(src string, a, b int, prefix string) (string, int, int)

MarkdownLinePrefix toggles prefix on every line touched by [a,b).

func MarkdownWrap 实验性 ​

go
func MarkdownWrap(src string, a, b int, pre, suf, placeholder string) (string, int, int)

MarkdownWrap surrounds the selection [a,b) with pre/suf, or inserts pre+placeholder+suf at a when nothing is selected; the inner text stays selected. Wrapping an already wrapped selection unwraps it.

func MessageDestroy 实验性 ​

go
func MessageDestroy(c *Context, key string)

MessageDestroy closes the message with key ("" closes all).

func NotificationDestroy 实验性 ​

go
func NotificationDestroy(c *Context, key string)

NotificationDestroy closes the card with key ("" closes all).

func OpenDialogs 实验性 ​

go
func OpenDialogs(c *Context) int

OpenDialogs returns how many Confirm/MessageBox/Prompt dialogs are open.

func PlainText 实验性 ​

go
func PlainText(spans []Span) string

PlainText returns the concatenated text of spans.

func ProFormItems 实验性 ​

go
func ProFormItems(c *Context, f *FormW, fields []ProField, vals ProValues)

ProFormItems builds the form items of fields inside f (for use in ProForm.Children, ProFormGroup bodies and custom form layouts).

func ProFormat 实验性 ​

go
func ProFormat(valueType string, enum []ProEnum, v any) string

ProFormat renders a value as text for a value type, formatting money like zh-CN (ProFormatLocale(nil, ...)). Code with a Context should call ProFormatLocale(c.Locale(), ...) so money follows the active Locale, as ProTable, ProDescriptions and the other Pro components do.

func ProFormatLocale 实验性 ​

go
func ProFormatLocale(loc *Locale, valueType string, enum []ProEnum, v any) string

ProFormatLocale is ProFormat with money in the currency and number style of loc (see FormatMoney).

func ProLayout 实验性 ​

go
func ProLayout(c *Context, cfg ProLayoutConfig, content func())

ProLayout builds an Ant Design Pro style admin shell: sider with logo and menu, header with collapse toggle, breadcrumb and user, page title, then content, then footer. cfg.Layout selects the top and mix layouts.

ConfigProvider.Defaults("ProLayout", ...) keys: "layout" (string), "noPadding" (bool), "siderWidth" (number), "breakpoint" (Breakpoint), "title", "footer" (string), "navTheme" ("light" | "dark"), "contentWidth" ("Fluid" | "Fixed"), "fixedHeader", "fixSiderbar" (bool).

func ProSettingsProvider 实验性 ​

go
func ProSettingsProvider(c *Context, s *ProSettings, fn func())

ProSettingsProvider builds fn inside a ConfigProvider following s: realDark selects the dark algorithm, PrimaryColor the brand color, Compact the compact sizes, and ColorWeak the high-contrast theme. Like ConfigProvider.Theme, the theme applies to the whole window: call it at the root.

func Prop 实验性 ​

go
func Prop[T any](c *Context, component, key string, def T) T

Prop returns the typed default property, or def when it is unset or of another type.

func QRDataCapacity 实验性 ​

go
func QRDataCapacity(v int, level QRLevel) int

QRDataCapacity returns the number of data codewords of version v at level.

func QRFormatBits 实验性 ​

go
func QRFormatBits(level QRLevel, mask int) uint32

QRFormatBits returns the 15-bit masked format information.

func QRVersionBits 实验性 ​

go
func QRVersionBits(v int) uint32

QRVersionBits returns the 18-bit version information (v >= 7).

func RegisterLocale ​

go
func RegisterLocale(l *Locale)

RegisterLocale adds (or replaces) a locale under l.Code. Empty texts are filled from EnUS (see FillLocale), so a partial translation works:

ko := &ui.Locale{Code: "ko-KR", Name: "한국어", OK: "확인", Cancel: "취소"}
ui.RegisterLocale(ko)

func SetCodeHighlighter 实验性 ​

go
func SetCodeHighlighter(h CodeHighlighter)

SetCodeHighlighter installs the highlighter CodeBlock and Markdown use when they are not given one of their own (nil: plain text).

ui.SetCodeHighlighter(codehl.New())

func SetDefaultDirection ​

go
func SetDefaultDirection(d Direction)

SetDefaultDirection sets the window-level direction used where no ConfigProvider decides: pages without a provider and the global layers. DirAuto (the default) derives it from the default locale. Hosts that follow the system layout direction inject it here. It takes effect on the next frame.

func SetDefaultLocale ​

go
func SetDefaultLocale(l *Locale)

SetDefaultLocale sets the locale used outside any ConfigProvider.

func SetHoverOpen 实验性 ​

go
func SetHoverOpen(c *Context, key ID, open bool)

SetHoverOpen forces the debounced state (used when a click closes a hover-triggered popup).

func ShortcutKeys 实验性 ​

go
func ShortcutKeys(accel string) []string

ShortcutKeys returns the key caps of an accelerator for this platform: on macOS the modifier symbols in Apple's order ("⌃", "⌥", "⇧", "⌘") then the key, elsewhere "Ctrl", "Alt", "Shift", "Win" / "Super" then the key; nil when accel does not parse. Kbd draws one cap.

func ShortcutLabel 实验性 ​

go
func ShortcutLabel(accel string) string

ShortcutLabel returns an accelerator as one string for this platform: "⌘⇧K" on macOS, "Ctrl+Shift+K" elsewhere ("" when it does not parse). Use it for MenuItem.Shortcut and similar hints.

func SkeletonAvatar 实验性 ​

go
func SkeletonAvatar(c *Context, size float32, square, active bool)

SkeletonAvatar adds an avatar placeholder.

func SkeletonButton 实验性 ​

go
func SkeletonButton(c *Context, size ControlSize, shape string, active bool)

SkeletonButton adds a button-shaped placeholder (shape: "default", "round", "circle").

func SkeletonImage 实验性 ​

go
func SkeletonImage(c *Context, w, h float32, active bool)

SkeletonImage adds a picture placeholder with a mountain glyph.

func SkeletonInput 实验性 ​

go
func SkeletonInput(c *Context, size ControlSize, active bool)

SkeletonInput adds an input-shaped placeholder.

func Spacer ​

go
func Spacer(c *Context)

Spacer grows to take free space.

func State ​

go
func State[T any](c *Context, id ID, init func() T) *T

State returns retained per-widget state, creating it with init on first use. State that is not requested for a while is dropped.

func ToggleMarkdownTask 实验性 ​

go
func ToggleMarkdownTask(src string, index int) string

ToggleMarkdownTask flips the index-th task checkbox ("- [ ]" / "- [x]", in document order) in src and returns the new source.

func VDivider ​

go
func VDivider(c *Context)

VDivider draws a short vertical separator for inline content.

类型 ​

A11yLocale ​

go
type A11yLocale struct {
	Navigation, Breadcrumb, Pagination, Notifications, Toolbar, Menu string
	PageFmt                                                          string // pagination item, arg: page number ("第 %d 页")
	MoreActions, OpenMenu, Remove, DragHandle, Resize, Splitter      string
	ShowPassword, HidePassword, Increase, Decrease                   string
	Avatar, Image, Chart, Progress, Rating, Color, Loading           string
	SlideFmt                                                         string // carousel slide, args: n, total ("第 %d 张,共 %d 张")
	RateFmt                                                          string // rating value, args: value, count ("%[1]g 星,共 %[2]d 星")
	DateFmt                                                          string // full date of a calendar cell, args: year, month number, day, Months entry ("%d年%d月%d日")
	DigitFmt                                                         string // one-time-code cell, args: n, total ("第 %d 位,共 %d 位")
	RemoveFmt                                                        string // remove button of a tag / file, arg: its label ("移除 %s")
	Hour, Minute, Second                                             string // time picker columns
	MoveToTarget, MoveToSource                                       string // Transfer move buttons
	PageSize                                                         string // page-size select of Pagination ("每页条数")
	Day                                                              string // day column of a date picker wheel (mobile)
	// contains filtered or unexported fields
}

A11yLocale holds accessible names and descriptions that are read by screen readers but not shown (icon-only controls, regions, summaries).

ANSIColor 实验性 ​

go
type ANSIColor struct {
	Kind    ANSIColorKind
	Index   uint8 // ANSIIndexed
	R, G, B uint8 // ANSIRGB
}

ANSIColor is a foreground or background color of an SGR sequence.

ANSIColorKind 实验性 ​

go
type ANSIColorKind uint8

ANSIColorKind says how an ANSIColor is given.

go
const (
	ANSIDefault ANSIColorKind = iota
	ANSIIndexed
	ANSIRGB
)

The color kinds: the default color, one of the 256 indexed colors (0–15 are the theme's ANSI colors, 16–231 the 6×6×6 cube, 232–255 grays) or a 24-bit color.

实验性

ANSIParser 实验性 ​

go
type ANSIParser struct {
	// contains filtered or unexported fields
}

ANSIParser strips escape sequences from lines of terminal output and turns SGR sequences ("\x1b[1;31m") into styled spans. The style carries over from one line to the next, as in a terminal. Supported: reset, bold, faint, italic, underline, inverse, strike-through and their resets; the 8 + 8 colors (30–37, 90–97, 40–47, 100–107), 256 colors (38;5;n) and 24-bit colors (38;2;r;g;b, also with ":" separators). Other CSI sequences, OSC strings and control characters are removed; a carriage return inside a line discards what came before it (progress output). The zero value is ready to use.

func (*ANSIParser) Line 实验性 ​

go
func (p *ANSIParser) Line(s string, dst []ANSISpan) (string, []ANSISpan)

Line parses one line (without "\n"): it returns the plain text and appends its styled spans (default-styled text has none) to dst.

func (*ANSIParser) Reset 实验性 ​

go
func (p *ANSIParser) Reset()

Reset returns the parser to the default style.

ANSISpan 实验性 ​

go
type ANSISpan struct {
	Start, End int
	Style      ANSIStyle
}

ANSISpan styles bytes [Start, End) of the plain text ParseANSI returns.

func ParseANSI 实验性 ​

go
func ParseANSI(s string) (string, []ANSISpan)

ParseANSI parses s (one line, or several separated by "\n" sharing one style state) into plain text and styled spans of it.

ANSIStyle 实验性 ​

go
type ANSIStyle struct {
	Fg, Bg                                          ANSIColor
	Bold, Faint, Italic, Underline, Inverse, Strike bool
}

ANSIStyle is the text style set by SGR sequences.

AccessibilityHost 实验性 ​

go
type AccessibilityHost interface {
	AccessibilityEnabled() bool
	// AccessibilityUpdate delivers the tree of the last frame. changed
	// lists added and modified nodes and then removed ones (tree.Node
	// returns nil for those). tree.Focus is the focused node and
	// tree.Announcements the messages to speak once.
	AccessibilityUpdate(tree *a11y.Tree, changed []a11y.NodeID)
}

AccessibilityHost is an optional interface of Window. A platform backend implements it to receive the semantics tree and expose it through the native accessibility API (NSAccessibility, UI Automation, AT-SPI, UIAccessibility, AccessibilityNodeInfo); docs/accessibility.md has the role mapping and the expected update protocol.

The runner calls AccessibilityEnabled at the start of every frame (it must be cheap) and, while it returns true, AccessibilityUpdate after every frame whose tree differs from the previous one. When an assistive technology attaches, the host flips its flag and calls Runner.Invalidate so the first full tree (every node reported as changed) arrives promptly. Both methods run on the UI thread. The tree must not be modified; it stays valid after the call (the runner builds a new one each frame).

AddonW 实验性 ​

go
type AddonW struct {
	// contains filtered or unexported fields
}

AddonW is a static (or clickable) label attached before/after an input inside Compact (Ant addonBefore/addonAfter, Element prepend/append).

func Addon 实验性 ​

go
func Addon(c *Context, label string) *AddonW

Addon adds an addon box with a label.

func (*AddonW) A11yLabel 实验性 ​

go
func (a *AddonW) A11yLabel(s string) *AddonW

A11yLabel sets the accessible name (needed for an icon-only addon button).

func (*AddonW) Clicked 实验性 ​

go
func (a *AddonW) Clicked() bool

Clicked makes the addon a button (Element append button) and reports a click.

func (*AddonW) Disabled 实验性 ​

go
func (a *AddonW) Disabled(on bool) *AddonW

func (*AddonW) Icon 实验性 ​

go
func (a *AddonW) Icon(ic *icon.Icon) *AddonW

Icon shows an icon before (or instead of) the label.

func (*AddonW) Layout 实验性 ​

go
func (a *AddonW) Layout(o ...layout.Option) *AddonW

func (*AddonW) Size 实验性 ​

go
func (a *AddonW) Size(s ControlSize) *AddonW

AffixW 实验性 ​

go
type AffixW struct {
	// contains filtered or unexported fields
}

AffixW pins its content to the viewport (or to a scroll container) once it would scroll past OffsetTop / OffsetBottom.

func Affix 实验性 ​

go
func Affix(c *Context) *AffixW

Affix starts a pinned block (default: offset top 0 in the window). Give it Target(scrollBox.ID()) when the page scrolls inside a container.

ConfigProvider.Defaults("Affix", ...) keys: "offsetTop", "offsetBottom" (numbers). Element's position="bottom" + offset is OffsetBottom.

func (*AffixW) Affixed 实验性 ​

go
func (a *AffixW) Affixed() bool

Affixed reports whether the content is currently pinned.

func (*AffixW) Body 实验性 ​

go
func (a *AffixW) Body(fn func()) *AffixW

Body builds the pinned content.

func (*AffixW) Changed 实验性 ​

go
func (a *AffixW) Changed() bool

Changed reports a pin state change on the first build after it was detected.

func (*AffixW) OffsetBottom 实验性 ​

go
func (a *AffixW) OffsetBottom(px float32) *AffixW

OffsetBottom pins the content this far above the bottom of the viewport.

func (*AffixW) OffsetTop 实验性 ​

go
func (a *AffixW) OffsetTop(px float32) *AffixW

OffsetTop pins the content this far below the top of the viewport.

func (*AffixW) Target 实验性 ​

go
func (a *AffixW) Target(id ID) *AffixW

Target uses a scroll container (ScrollBox.ID()) as viewport.

AlertEffect ​

go
type AlertEffect string

AlertEffect selects how an Alert is filled (Element's effect).

go
const (
	// AlertEffectLight tints the box with the light status background
	// (the default).
	AlertEffectLight AlertEffect = "light"
	// AlertEffectDark fills the box with the solid status color and
	// draws the text and icon on it in a contrasting color.
	AlertEffectDark AlertEffect = "dark"
)

AlertW ​

go
type AlertW struct {
	// contains filtered or unexported fields
}

AlertW is an inline status banner.

func Alert ​

go
func Alert(c *Context, status, title string) *AlertW

Alert adds a banner; call Show after options. status: success, info, warning, error. title is antd's title (v6; message before).

As in antd and Element Plus the icon is off unless ShowIcon(true) (or Banner, which shows it by default).

ConfigProvider.Defaults("Alert", ...) keys: "showIcon", "closable", "banner" (bool), "variant" (string: "outlined" | "filled").

Under shadcn/ui it is the bordered Alert card with an outlined (lucide-style) icon; "error" is the destructive variant.

func (*AlertW) Action ​

go
func (a *AlertW) Action(fn func()) *AlertW

Action builds an operation area at the right of the text (Ant action), e.g. a small button.

func (*AlertW) Banner ​

go
func (a *AlertW) Banner() *AlertW

Banner styles the alert as a page-top banner: no border or radius, and the icon on unless ShowIcon(false) (antd banner).

func (*AlertW) Center ​

go
func (a *AlertW) Center() *AlertW

Center centers the icon and text horizontally (Element center); the close button stays at the end.

func (*AlertW) Closable ​

go
func (a *AlertW) Closable() *AlertW

Closable adds the close button.

func (*AlertW) CloseDisabled ​

go
func (a *AlertW) CloseDisabled(on bool) *AlertW

CloseDisabled disables the close button (antd closable.disabled); ConfigProvider.ComponentDisabled disables it too.

func (*AlertW) CloseIcon ​

go
func (a *AlertW) CloseIcon(ic *icon.Icon) *AlertW

CloseIcon replaces the close icon and makes the alert closable (antd closable.closeIcon).

func (*AlertW) CloseText ​

go
func (a *AlertW) CloseText(s string) *AlertW

CloseText shows text instead of the close icon and makes the alert closable (EP close-text).

func (*AlertW) Closed ​

go
func (a *AlertW) Closed() bool

Closed reports a click on the close button.

func (*AlertW) Description ​

go
func (a *AlertW) Description(d string) *AlertW

func (*AlertW) Effect ​

go
func (a *AlertW) Effect(e AlertEffect) *AlertW

Effect selects the fill: AlertEffectLight (default) or AlertEffectDark, the solid status color with contrasting text (Element effect="dark").

func (*AlertW) Icon ​

go
func (a *AlertW) Icon(ic *icon.Icon) *AlertW

Icon replaces the status icon (antd icon) and shows it.

func (*AlertW) NoIcon ​

go
func (a *AlertW) NoIcon() *AlertW

NoIcon hides the status icon (same as ShowIcon(false)).

func (*AlertW) Show ​

go
func (a *AlertW) Show() *AlertW

Show builds the alert.

func (*AlertW) ShowIcon ​

go
func (a *AlertW) ShowIcon(on bool) *AlertW

ShowIcon shows or hides the status icon (antd showIcon, EP show-icon; default off, on for a Banner).

func (*AlertW) Variant ​

go
func (a *AlertW) Variant(v string) *AlertW

Variant selects "outlined" (default, status border) or "filled" (no border) (antd 6.4 variant). Element and shadcn alerts are drawn without / with their own border either way.

AnchorItem 实验性 ​

go
type AnchorItem struct {
	Key, Title string
	Children   []AnchorItem
}

AnchorItem is one link of an Anchor; Key matches an AnchorSection.

AnchorSectionW 实验性 ​

go
type AnchorSectionW struct {
	*Box
	// contains filtered or unexported fields
}

AnchorSectionW is the section AnchorSection returns; it embeds the section's Box.

func AnchorSection 实验性 ​

go
func AnchorSection(c *Context, key string, fn func(), opts ...layout.Option) *AnchorSectionW

AnchorSection wraps a block of page content that an Anchor link with the same key scrolls to and highlights.

AnchorW 实验性 ​

go
type AnchorW struct {
	// contains filtered or unexported fields
}

AnchorW is an in-page table of contents that follows scrolling.

func Anchor 实验性 ​

go
func Anchor(c *Context, items []AnchorItem) *AnchorW

Anchor starts a table of contents; call Target with the scroll container holding the AnchorSections, then Show.

func (*AnchorW) Active 实验性 ​

go
func (a *AnchorW) Active() string

Active returns the highlighted key.

func (*AnchorW) Bounds 实验性 ​

go
func (a *AnchorW) Bounds(px float32) *AnchorW

Bounds sets how close (px) a section's top must come to the offset line to become active (antd bounds 5, Element bound 15; default from AnchorToken.Bounds).

func (*AnchorW) Changed 实验性 ​

go
func (a *AnchorW) Changed() bool

Changed reports that the active link changed this frame.

func (*AnchorW) Clicked 实验性 ​

go
func (a *AnchorW) Clicked() string

Clicked returns the key clicked this frame.

func (*AnchorW) CurrentAnchor 实验性 ​

go
func (a *AnchorW) CurrentAnchor(fn func(active string) string) *AnchorW

CurrentAnchor customizes the highlighted link (antd getCurrentAnchor): fn gets the key scrolling selected and returns the key to highlight.

func (*AnchorW) Direction 实验性 ​

go
func (a *AnchorW) Direction(d string) *AnchorW

Direction lays the links out "vertical" (default) or "horizontal" (antd direction, Element direction).

func (*AnchorW) Horizontal 实验性 ​

go
func (a *AnchorW) Horizontal() *AnchorW

Horizontal lays links out in a row with a bottom ink bar.

func (*AnchorW) NoInk 实验性 ​

go
func (a *AnchorW) NoInk() *AnchorW

NoInk hides the ink rail (Element "underline" off).

func (*AnchorW) Show 实验性 ​

go
func (a *AnchorW) Show() *AnchorW

Show builds the anchor.

func (*AnchorW) Target 实验性 ​

go
func (a *AnchorW) Target(id ID) *AnchorW

Target sets the scroll container (ScrollBox.ID()).

func (*AnchorW) TargetOffset 实验性 ​

go
func (a *AnchorW) TargetOffset(px float32) *AnchorW

TargetOffset scrolls sections this far below the container top (fixed headers) and uses it for the active test.

func (*AnchorW) Type 实验性 ​

go
func (a *AnchorW) Type(t string) *AnchorW

Type picks Element's look: "underline" draws the rail with a thin marker, "default" only a rounded marker. "" follows the theme (Ant and shadcn draw the rail, Element does not).

AppAPI 实验性 ​

go
type AppAPI struct {
	// contains filtered or unexported fields
}

AppAPI opens messages, notifications and confirm boxes with the configuration of the enclosing App (Ant App.useApp()).

func UseApp 实验性 ​

go
func UseApp(c *Context) AppAPI

UseApp returns the API of the innermost App being built (outside an App it opens plain messages with the defaults).

func (AppAPI) Confirm 实验性 ​

go
func (a AppAPI) Confirm(o ConfirmOptions) *ConfirmRef

Confirm opens a confirm box (see Confirm; Ant modal.confirm).

func (AppAPI) InApp 实验性 ​

go
func (a AppAPI) InApp() bool

InApp reports whether the API comes from an enclosing App.

func (AppAPI) Info 实验性 ​

go
func (a AppAPI) Info(o ConfirmOptions) *ConfirmRef

Info opens an alert box (see MessageBox; Ant modal.info).

func (AppAPI) Message 实验性 ​

go
func (a AppAPI) Message(status, content string) *MessageRef

Message opens a message (see Message), closing the oldest ones beyond MaxCount.

func (AppAPI) Notification 实验性 ​

go
func (a AppAPI) Notification(status, title string) *NotificationRef

Notification opens a notification (see Notification), closing the oldest cards beyond MaxCount.

AppMessageConfig 实验性 ​

go
type AppMessageConfig struct {
	Duration time.Duration // default display time (0: MessageDuration)
	MaxCount int           // most messages on screen; the oldest close first (0: no limit)
	// contains filtered or unexported fields
}

AppMessageConfig configures the messages opened inside an App (Ant App message prop).

AppNotificationConfig 实验性 ​

go
type AppNotificationConfig struct {
	Placement    NotifyPlacement
	PlacementSet bool          // Placement given (NotifyTopEnd is the zero value)
	Duration     time.Duration // 0: the default
	MaxCount     int           // most cards on screen (0: no limit)
	ShowProgress bool
	// contains filtered or unexported fields
}

AppNotificationConfig configures the notifications opened inside an App (Ant App notification prop).

AppW 实验性 ​

go
type AppW struct {
	// contains filtered or unexported fields
}

AppW builds an App.

func App 实验性 ​

go
func App(c *Context) *AppW

App starts an application root; chain options, then Body.

ConfigProvider.Defaults("App", ...) keys: "messageMaxCount", "notificationMaxCount" (number).

func (*AppW) Body 实验性 ​

go
func (a *AppW) Body(fn func()) *Box

Body builds fn inside the App.

func (*AppW) Layout 实验性 ​

go
func (a *AppW) Layout(o ...layout.Option) *AppW

Layout applies layout options to the App column.

func (*AppW) Message 实验性 ​

go
func (a *AppW) Message(cfg AppMessageConfig) *AppW

Message sets the message configuration.

func (*AppW) Notification 实验性 ​

go
func (a *AppW) Notification(cfg AppNotificationConfig) *AppW

Notification sets the notification configuration.

ApprovalChoice 实验性 ​

go
type ApprovalChoice uint8

ApprovalChoice is a decision on an Approval.

go
const (
	ApproveNone    ApprovalChoice = iota // undecided
	ApproveOnce                          // allow this request
	ApproveSession                       // allow for the rest of the conversation
	ApproveAlways                        // allow from now on
	ApproveDeny
)

实验性

ApprovalW 实验性 ​

go
type ApprovalW struct {
	// contains filtered or unexported fields
}

ApprovalW is a card asking the user to allow or deny an action (a tool call, a command, a file write) before the assistant goes on.

func Approval 实验性 ​

go
func Approval(c *Context, title string) *ApprovalW

Approval adds a permission card; title "" uses Locale.Chat.ApprovalTitle.

a := ui.Approval(c, "").Description("运行 shell 命令").Command("rm -rf build", "sh")
if d, ok := a.Decided(); ok { resolve(d) }

func (*ApprovalW) Body 实验性 ​

go
func (w *ApprovalW) Body(fn func()) *ApprovalW

Body adds custom content above the buttons.

func (*ApprovalW) Choices 实验性 ​

go
func (w *ApprovalW) Choices(ch ...ApprovalChoice) *ApprovalW

Choices sets the buttons in order (default Deny, Always, Once; the last one is the primary button).

func (*ApprovalW) Command 实验性 ​

go
func (w *ApprovalW) Command(code, lang string) *ApprovalW

Command shows the command or parameters as a code block in lang.

func (*ApprovalW) Decided 实验性 ​

go
func (w *ApprovalW) Decided() (ApprovalChoice, bool)

Decided returns the choice clicked this frame.

func (*ApprovalW) Decision 实验性 ​

go
func (w *ApprovalW) Decision(d ApprovalChoice) *ApprovalW

Decision shows a decided card: the buttons give way to the outcome.

func (*ApprovalW) Description 实验性 ​

go
func (w *ApprovalW) Description(s string) *ApprovalW

Description explains what will happen.

func (*ApprovalW) Feedback 实验性 ​

go
func (w *ApprovalW) Feedback(note *string) *ApprovalW

Feedback adds an optional note input bound to *note, sent with the decision.

func (*ApprovalW) Field 实验性 ​

go
func (w *ApprovalW) Field(label, value string) *ApprovalW

Field adds a labelled detail row (tool, resource, scope …).

func (*ApprovalW) Layout 实验性 ​

go
func (w *ApprovalW) Layout(opts ...layout.Option) *ApprovalW

Layout applies layout options to the card.

func (*ApprovalW) Risk 实验性 ​

go
func (w *ApprovalW) Risk(level string) *ApprovalW

Risk sets the level: "warning" (default) or "error" (dangerous).

AspectRatioW 实验性 ​

go
type AspectRatioW struct {
	// contains filtered or unexported fields
}

AspectRatioW is a container that keeps a fixed width-to-height ratio (shadcn/ui AspectRatio, CSS aspect-ratio): it takes the width its parent gives it and is ratio times less tall; the content fills it.

func AspectRatio 实验性 ​

go
func AspectRatio(c *Context, ratio float32, fn func(), opts ...layout.Option) *AspectRatioW

AspectRatio adds a ratio box (width / height, e.g. 16.0/9) and builds fn inside it, stretched over the whole box:

ui.AspectRatio(c, 16.0/9, func() { ui.Image(c, src).Fill() }).Radius(8)

In a column it spans the column's width; where nothing gives it a width (a row, a stack) it is zero wide unless MaxWidth or layout options set one. A ratio <= 0 is taken as 1.

func (*AspectRatioW) A11yLabel 实验性 ​

go
func (w *AspectRatioW) A11yLabel(s string) *AspectRatioW

A11yLabel exposes the box as a named group (a figure caption).

func (*AspectRatioW) ID 实验性 ​

go
func (w *AspectRatioW) ID() ID

ID returns the box ID.

func (*AspectRatioW) MaxWidth 实验性 ​

go
func (w *AspectRatioW) MaxWidth(px float32) *AspectRatioW

MaxWidth limits the width (and with it the height).

func (*AspectRatioW) Radius 实验性 ​

go
func (w *AspectRatioW) Radius(r float32) *AspectRatioW

Radius rounds the corners and clips the content to them.

func (*AspectRatioW) Ratio 实验性 ​

go
func (w *AspectRatioW) Ratio() float32

Ratio returns the width-to-height ratio in effect.

func (*AspectRatioW) Rect 实验性 ​

go
func (w *AspectRatioW) Rect() geom.Rect

Rect returns the box rectangle of the last frame.

AuditIssue 实验性 ​

go
type AuditIssue struct {
	Kind        AuditKind
	Role        a11y.Role
	Name        string // accessible name (empty for missing-name)
	Label       string // the widget's internal label (to locate it)
	Rect        geom.Rect
	Interactive bool   // the node is a control (counts toward the zero-missing-name goal)
	Detail      string // contrast pair, reason
}

AuditIssue is one finding of Driver.Audit.

func AuditTheme 实验性 ​

go
func AuditTheme(th *theme.Theme) []AuditIssue

AuditTheme reports the contrast findings of th as audit issues.

func (AuditIssue) String 实验性 ​

go
func (i AuditIssue) String() string

AuditKind 实验性 ​

go
type AuditKind uint8

AuditKind classifies an accessibility audit finding.

Append-only: never reorder or insert; the zero value stays AuditMissingName.

go
const (
	// AuditMissingName: an interactive (or image / dialog) node without an
	// accessible name. Icon-only controls need an A11yLabel / label.
	AuditMissingName AuditKind = iota
	// AuditNoRole: a pointer target that declares no role; it is exposed
	// as a generic button so it stays reachable, but the widget should
	// annotate it.
	AuditNoRole
	// AuditNotKeyboard: an interactive widget that Tab cannot reach and
	// that is not an item of a keyboard-operated composite (list, menu,
	// tree, grid, popup of a focusable trigger).
	AuditNotKeyboard
	// AuditContrast: a theme token pair below its WCAG contrast minimum.
	AuditContrast
	// AuditUnmirroredIcon (warning): a directional icon (an arrow, a
	// chevron, text lines) drawn without mirroring in a right-to-left
	// scope, so it points against the reading direction. Draw it with the
	// direction-aware helper (Context.paintIcon) instead of icon.Draw.
	AuditUnmirroredIcon
)

实验性

func (AuditKind) String 实验性 ​

go
func (k AuditKind) String() string

AuditReport 实验性 ​

go
type AuditReport struct {
	Issues      []AuditIssue
	Nodes       int // semantic nodes in the tree
	Interactive int // interactive nodes in the tree
}

AuditReport is the result of Driver.Audit.

func (AuditReport) Count 实验性 ​

go
func (r AuditReport) Count(k AuditKind) int

Count returns the number of issues of kind k.

func (AuditReport) MissingInteractiveNames 实验性 ​

go
func (r AuditReport) MissingInteractiveNames() int

MissingInteractiveNames counts interactive nodes without a name (the gallery gate keeps it at zero).

func (AuditReport) String 实验性 ​

go
func (r AuditReport) String() string

String lists the issues, one per line.

AutoCompleteW 实验性 ​

go
type AutoCompleteW struct {
	// contains filtered or unexported fields
}

AutoCompleteW is a text input with a suggestion dropdown.

func AutoComplete 实验性 ​

go
func AutoComplete(c *Context, val *string, opts []Option) *AutoCompleteW

AutoComplete adds an input bound to *val that suggests opts (filtered by the typed text). Picking a suggestion writes its Value.

func (*AutoCompleteW) A11yLabel 实验性 ​

go
func (w *AutoCompleteW) A11yLabel(s string) *AutoCompleteW

A11yLabel sets the accessible name (inside a FormItem the item label is used; the placeholder is the last resort).

func (*AutoCompleteW) AllowClear 实验性 ​

go
func (w *AutoCompleteW) AllowClear() *AutoCompleteW

func (*AutoCompleteW) Changed 实验性 ​

go
func (w *AutoCompleteW) Changed() bool

Changed reports a typed edit or a picked suggestion this frame.

func (*AutoCompleteW) DataVersion 实验性 ​

go
func (w *AutoCompleteW) DataVersion(v int) *AutoCompleteW

DataVersion tells the autocomplete that the options slice was modified in place (a virtual list caches its matches and label widths by slice identity, length and this number): after editing options of the same slice without changing its length, change v (or pass a new slice) so the matches and the list's width are recomputed on the next frame.

func (*AutoCompleteW) Debounce 实验性 ​

go
func (w *AutoCompleteW) Debounce(d time.Duration) *AutoCompleteW

Debounce sets the delay before a Remote call.

func (*AutoCompleteW) Disabled 实验性 ​

go
func (w *AutoCompleteW) Disabled(on bool) *AutoCompleteW

func (*AutoCompleteW) Highlight 实验性 ​

go
func (w *AutoCompleteW) Highlight() *AutoCompleteW

Highlight emphasises the matched part of each suggestion.

func (*AutoCompleteW) IsOpen 实验性 ​

go
func (w *AutoCompleteW) IsOpen() bool

IsOpen reports whether the dropdown (suggestions or the loading row) is shown.

func (*AutoCompleteW) Layout 实验性 ​

go
func (w *AutoCompleteW) Layout(o ...layout.Option) *AutoCompleteW

func (*AutoCompleteW) Loading 实验性 ​

go
func (w *AutoCompleteW) Loading(on bool) *AutoCompleteW

Loading shows a spinner and the loading text in the dropdown (in place of the suggestions with Remote, or when there are none).

func (*AutoCompleteW) NotFoundContent 实验性 ​

go
func (w *AutoCompleteW) NotFoundContent(s string) *AutoCompleteW

NotFoundContent keeps the dropdown open with text s when nothing matches (Ant notFoundContent; without it an empty list closes).

func (*AutoCompleteW) Open 实验性 ​

go
func (w *AutoCompleteW) Open() *AutoCompleteW

Open forces the dropdown open (screenshots, tests).

func (*AutoCompleteW) Placeholder 实验性 ​

go
func (w *AutoCompleteW) Placeholder(s string) *AutoCompleteW

func (*AutoCompleteW) Placement 实验性 ​

go
func (w *AutoCompleteW) Placement(p Placement) *AutoCompleteW

Placement sets where the suggestions open: BottomStart (default), BottomEnd, TopStart or TopEnd (Ant placement, Element placement); they flip when there is no room. ConfigProvider.Defaults("AutoComplete", "placement") takes the Ant names.

func (*AutoCompleteW) Prefix 实验性 ​

go
func (w *AutoCompleteW) Prefix(ic *icon.Icon) *AutoCompleteW

func (*AutoCompleteW) Remote 实验性 ​

go
func (w *AutoCompleteW) Remote(fn func(query string)) *AutoCompleteW

Remote turns on server-side suggestions: fn receives the typed text after Debounce (300ms by default) on the UI thread. Start the request in the background, pass Loading(true) while it runs, then replace the options given to AutoComplete (they are shown as-is, not filtered by the typed text) and wake the window with Invalidate. A Source, when set, still computes the options.

ui.AutoComplete(c, &q, hits).Remote(func(s string) { go fetch(s) }).Loading(busy)

func (*AutoCompleteW) Selected 实验性 ​

go
func (w *AutoCompleteW) Selected() (string, bool)

Selected returns the value picked this frame and whether one was picked.

func (*AutoCompleteW) Size 实验性 ​

go
func (w *AutoCompleteW) Size(s ControlSize) *AutoCompleteW

func (*AutoCompleteW) Source 实验性 ​

go
func (w *AutoCompleteW) Source(fn func(q string) []Option) *AutoCompleteW

Source computes suggestions from the typed text (replaces filtering of the static options).

func (*AutoCompleteW) Status 实验性 ​

go
func (w *AutoCompleteW) Status(s string) *AutoCompleteW

func (*AutoCompleteW) TriggerOnFocus 实验性 ​

go
func (w *AutoCompleteW) TriggerOnFocus() *AutoCompleteW

TriggerOnFocus opens the suggestions as soon as the input gains focus (Element trigger-on-focus), before anything is typed: the options (or Source's result) for the current text, all of them when it is empty. With Remote the callback runs at once for the current text.

func (*AutoCompleteW) Variant 实验性 ​

go
func (w *AutoCompleteW) Variant(v FieldVariant) *AutoCompleteW

Variant sets the frame look (FieldOutlined by default; the inner Input's Variant).

func (*AutoCompleteW) Virtual 实验性 ​

go
func (w *AutoCompleteW) Virtual(on bool) *AutoCompleteW

Virtual forces the virtual suggestion list on or off; by default lists longer than 100 suggestions are virtual (only the visible rows and the keyboard row are built; the dropdown keeps the width, height and scroll range of the full list, but suggestions out of view are not in the accessibility tree). Labels, values and Disabled are always read live. A virtual list of static options keeps which options match while the options slice (identity and length), the typed text and the DataVersion stay the same, and measures label widths once per slice, DataVersion and theme: an option renamed in place (same slice, same length) does not join or leave the matches, nor change the list's width, until the text, the slice or the DataVersion (or the theme pointer) changes. Virtual(false) builds every row.

func (*AutoCompleteW) Width 实验性 ​

go
func (w *AutoCompleteW) Width(px float32) *AutoCompleteW

AvatarGroupW 实验性 ​

go
type AvatarGroupW struct {
	// contains filtered or unexported fields
}

AvatarGroupW stacks avatars with overlap.

func AvatarGroup 实验性 ​

go
func AvatarGroup(c *Context) *AvatarGroupW

AvatarGroup starts a group; call Body with the avatars.

ConfigProvider.Defaults("AvatarGroup", ...) keys: "maxCount" (int).

func (*AvatarGroupW) Body 实验性 ​

go
func (g *AvatarGroupW) Body(fn func()) *Box

Body builds the avatars.

func (*AvatarGroupW) Max 实验性 ​

go
func (g *AvatarGroupW) Max(n int) *AvatarGroupW

Max folds avatars beyond n into a "+k" avatar; hovering it shows the folded avatars in a popover (antd max.count / max.popover).

func (*AvatarGroupW) MaxPopover 实验性 ​

go
func (g *AvatarGroupW) MaxPopover(on bool, placement, trigger string) *AvatarGroupW

MaxPopover shows (default) or hides the popover listing the folded avatars; placement and trigger as in Popover (default "top", "hover"). Element's collapse-avatars-tooltip is MaxPopover(true, "top", "hover").

func (*AvatarGroupW) MoreBg 实验性 ​

go
func (g *AvatarGroupW) MoreBg(col theme.Color) *AvatarGroupW

MoreBg sets the background of the "+k" avatar (antd max.style).

func (*AvatarGroupW) Size 实验性 ​

go
func (g *AvatarGroupW) Size(px float32) *AvatarGroupW

Size sets the size of the "+k" avatar (match your avatars; default 32).

AvatarW ​

go
type AvatarW struct {
	// contains filtered or unexported fields
}

AvatarW is a round user avatar.

func Avatar ​

go
func Avatar(c *Context, label string) *AvatarW

Avatar shows text initials (or an icon when label is "").

ConfigProvider.Defaults("Avatar", ...) keys: "size" (float32 px or ControlSize), "shape" ("circle" | "square"), "gap" (px, default 4).

func (*AvatarW) A11yLabel ​

go
func (a *AvatarW) A11yLabel(s string) *AvatarW

A11yLabel sets the accessible name (the person's name; the default is the avatar text, or "avatar" for an icon or image avatar).

func (*AvatarW) Bg ​

go
func (a *AvatarW) Bg(col theme.Color) *AvatarW

func (*AvatarW) Gap ​

go
func (a *AvatarW) Gap(px float32) *AvatarW

Gap sets the space kept on each side of the text; longer text is scaled down to fit (antd gap, default 4).

func (*AvatarW) Icon ​

go
func (a *AvatarW) Icon(ic *icon.Icon) *AvatarW

Icon shows an icon instead of the text (icon avatar).

func (*AvatarW) Image ​

go
func (a *AvatarW) Image(img image.Image) *AvatarW

func (*AvatarW) Large ​

go
func (a *AvatarW) Large() *AvatarW

Large uses the large container size (antd 40px, Element 56px).

func (*AvatarW) Shape ​

go
func (a *AvatarW) Shape(s string) *AvatarW

Shape sets "circle" (default) or "square".

func (*AvatarW) Size ​

go
func (a *AvatarW) Size(px float32) *AvatarW

func (*AvatarW) Small ​

go
func (a *AvatarW) Small() *AvatarW

Small uses the small container size (antd size="small": 24px).

func (*AvatarW) Square ​

go
func (a *AvatarW) Square() *AvatarW

BackTopW 实验性 ​

go
type BackTopW struct {
	// contains filtered or unexported fields
}

BackTopW is the "back to top" floating button of a scroll container.

func BackTop 实验性 ​

go
func BackTop(c *Context, target ID) *BackTopW

BackTop adds the button for the scroll container target (ScrollBox.ID()); it appears once scrolled past VisibilityHeight (antd 400, Element 200: FloatButtonToken.BackTop*) and scrolls back smoothly in Duration (450ms, antd duration). Call Show. It is antd's FloatButton.BackTop: Icon, Description, Primary and Square style it like a FloatButton.

func (*BackTopW) Clicked 实验性 ​

go
func (b *BackTopW) Clicked() bool

Clicked reports a click this frame.

func (*BackTopW) Content 实验性 ​

go
func (b *BackTopW) Content(fn func()) *BackTopW

Content replaces the default icon with custom content (Element slot).

func (*BackTopW) Description 实验性 ​

go
func (b *BackTopW) Description(s string) *BackTopW

Description shows a text under the icon in a square button (antd 6 content, description deprecated).

func (*BackTopW) Duration 实验性 ​

go
func (b *BackTopW) Duration(d time.Duration) *BackTopW

Duration sets the scroll animation time.

func (*BackTopW) Icon 实验性 ​

go
func (b *BackTopW) Icon(ic *icon.Icon) *BackTopW

Icon replaces the default icon (antd icon).

func (*BackTopW) Position 实验性 ​

go
func (b *BackTopW) Position(right, bottom float32) *BackTopW

Position sets the distance from the right and bottom window edges.

func (*BackTopW) Primary 实验性 ​

go
func (b *BackTopW) Primary() *BackTopW

Primary uses the primary button type (antd type="primary").

func (*BackTopW) Show 实验性 ​

go
func (b *BackTopW) Show() *BackTopW

Show builds the button.

func (*BackTopW) Square 实验性 ​

go
func (b *BackTopW) Square() *BackTopW

Square uses the square shape (antd shape="square").

func (*BackTopW) VisibilityHeight 实验性 ​

go
func (b *BackTopW) VisibilityHeight(px float32) *BackTopW

VisibilityHeight sets the scroll distance after which it shows.

BackWindow 实验性 ​

go
type BackWindow interface {
	SetBackHandling(on bool)
}

BackWindow is implemented by windows on platforms with a system Back action. The runner calls SetBackHandling after a frame whenever Context.WantBack changes (never twice with the same value; the first call is SetBackHandling(true)). While on, the host delivers Back as KeyEscape down and up; while off, Back does what the platform does without the UI (go back in the page stack, leave the app). UI thread.

BadgeRibbonW 实验性 ​

go
type BadgeRibbonW struct {
	*Box
	// contains filtered or unexported fields
}

BadgeRibbonW is the ribbon wrapper BadgeRibbon returns; it embeds the wrapper's Box.

func BadgeRibbon 实验性 ​

go
func BadgeRibbon(c *Context, label, color, placement string, fn func()) *BadgeRibbonW

BadgeRibbon wraps fn's content (usually a card) with a corner ribbon. placement is "end" (default) or "start" (logical: mirrored in RTL); color as in Badge.Color. With placement "", the "placement" key of ConfigProvider.Defaults("BadgeRibbon", ...) applies.

BadgeW ​

go
type BadgeW struct {
	// contains filtered or unexported fields
}

BadgeW is a badge: count / dot / text bubble, overflow, show-zero, preset or custom color, offset, small size, standalone use and the status form with the "processing" ripple.

func Badge ​

go
func Badge(c *Context) *BadgeW

Badge adds a badge. Body(fn) wraps content and draws the bubble at its top-end corner (top-right; top-left in RTL); without Body the badge stands alone (an inline bubble, or a status dot with a label when Status is set).

ui.Badge(c).Count(5).Body(func() { ui.Avatar(c, "U") })
ui.Badge(c).Status("success", "成功")

ConfigProvider.Defaults("Badge", ...) keys: "size" ("small" / Small), "overflowCount" (int), "showZero" (bool), "color" (string), "dot" (bool).

func (*BadgeW) Body ​

go
func (b *BadgeW) Body(fn func()) *Box

Body wraps fn's content and draws the bubble at its top-end corner.

func (*BadgeW) Color ​

go
func (b *BadgeW) Color(col string) *BadgeW

Color: status name ("success", "warning", "processing", ...), Ant preset ("pink", "green", ...) or hex.

func (*BadgeW) Count ​

go
func (b *BadgeW) Count(n int) *BadgeW

Count sets the number. Zero hides the bubble unless ShowZero; negative numbers are shown as they are (antd, Element).

func (*BadgeW) Dot ​

go
func (b *BadgeW) Dot() *BadgeW

Dot shows a small dot.

func (*BadgeW) Hidden ​

go
func (b *BadgeW) Hidden(on bool) *BadgeW

Hidden hides the bubble or dot (Element hidden).

func (*BadgeW) Layout ​

go
func (b *BadgeW) Layout(o ...layout.Option) *BadgeW

Layout applies layout options to the badge.

func (*BadgeW) Max ​

go
func (b *BadgeW) Max(n int) *BadgeW

Max sets the overflow count (99 → "99+").

func (*BadgeW) Offset ​

go
func (b *BadgeW) Offset(x, y float32) *BadgeW

Offset moves the bubble by (x, y) from the top-end corner; x points away from the content (mirrored in RTL).

func (*BadgeW) ShowZero ​

go
func (b *BadgeW) ShowZero() *BadgeW

ShowZero shows a zero count.

func (*BadgeW) Small ​

go
func (b *BadgeW) Small() *BadgeW

Small uses the 14px bubble.

func (*BadgeW) Status ​

go
func (b *BadgeW) Status(status, label string) *BadgeW

Status turns a standalone badge into a status dot with a label ("success", "processing" (ripples), "default", "error", "warning", or "custom" with Color).

func (*BadgeW) Text ​

go
func (b *BadgeW) Text(s string) *BadgeW

Text shows a word instead of a number (Element value="new").

func (*BadgeW) Title ​

go
func (b *BadgeW) Title(s string) *BadgeW

Title sets the text announced for the bubble instead of the count (antd title).

BeamStop 实验性 ​

go
type BeamStop struct {
	Color   theme.Color
	Percent float32
}

BeamStop is a color stop of a BorderBeam gradient (Percent 0..100 from tail to head).

BorderBeamW 实验性 ​

go
type BorderBeamW struct {
	// contains filtered or unexported fields
}

BorderBeamW decorates its body with moving border beams.

func BorderBeam 实验性 ​

go
func BorderBeam(c *Context) *BorderBeamW

BorderBeam starts a beam decoration; add the content with Body.

ui.BorderBeam(c).Duration(3 * time.Second).Body(func() { ui.Card(c, "AI").Body(...) })

func (*BorderBeamW) Active 实验性 ​

go
func (w *BorderBeamW) Active(on bool) *BorderBeamW

Active shows or hides the beam (e.g. only while hovered).

func (*BorderBeamW) Body 实验性 ​

go
func (w *BorderBeamW) Body(fn func()) *Box

Body builds the decorated content and returns the wrapper box.

func (*BorderBeamW) Color 实验性 ​

go
func (w *BorderBeamW) Color(col theme.Color) *BorderBeamW

Color sets a single beam color (fading to transparent at the tail).

func (*BorderBeamW) Count 实验性 ​

go
func (w *BorderBeamW) Count(n int) *BorderBeamW

Count spaces n beams evenly (default 1).

func (*BorderBeamW) Duration 实验性 ​

go
func (w *BorderBeamW) Duration(d time.Duration) *BorderBeamW

Duration sets the time of one loop (default 6s).

func (*BorderBeamW) Gradient 实验性 ​

go
func (w *BorderBeamW) Gradient(stops ...BeamStop) *BorderBeamW

Gradient sets the beam colors from tail (0) to head (100).

func (*BorderBeamW) Layout 实验性 ​

go
func (w *BorderBeamW) Layout(o ...layout.Option) *BorderBeamW

Layout applies layout options to the wrapper.

func (*BorderBeamW) LineWidth 实验性 ​

go
func (w *BorderBeamW) LineWidth(px float32) *BorderBeamW

LineWidth sets the beam thickness (default 1px).

func (*BorderBeamW) Outset 实验性 ​

go
func (w *BorderBeamW) Outset(px float32) *BorderBeamW

Outset moves the beam outside (positive) or inside (negative) the edge.

func (*BorderBeamW) Radius 实验性 ​

go
func (w *BorderBeamW) Radius(px float32) *BorderBeamW

Radius sets the corner radius the beam follows (default th.RadiusLG, the Card radius).

func (*BorderBeamW) Size 实验性 ​

go
func (w *BorderBeamW) Size(px float32) *BorderBeamW

Size sets the beam length (default 100px).

Box ​

go
type Box struct {
	// contains filtered or unexported fields
}

Box is a styled layout container.

只有部分成员是稳定的:未标「实验性」的方法和全部字段受兼容性承诺约束。

func Column ​

go
func Column(c *Context, fn func(), opts ...layout.Option) *Box

Column lays out children vertically.

func Content ​

go
func Content(c *Context, fn func(), opts ...layout.Option) *Box

Content is the main area; it takes the free space.

func Custom ​

go
func Custom(c *Context, measure func(maxW, maxH float32) geom.Size, p PaintFunc, opts ...layout.Option) *Box

Custom adds a leaf with a measure and paint function.

func Div ​

go
func Div(c *Context, opts ...layout.Option) *Box

Div creates an empty styled box (Column by default); add children with Body.

go
func Footer(c *Context, fn func(), opts ...layout.Option) *Box

Footer is the bottom bar (Ant: 24px/50px padding on the layout background; Element: 60px high, 20px padding). Its content starts at the inline start like Ant's and Element's footers (neither centres it; pass layout.Center() for the centred footer of the Ant demos).

go
func Header(c *Context, fn func(), opts ...layout.Option) *Box

Header is the top bar.

func Layout ​

go
func Layout(c *Context, fn func(), opts ...layout.Option) *Box

Layout is the page frame holding Header / Sider / Content / Footer (or nested Layouts). It fills the free space of its parent.

func Overlay 实验性 ​

go
func Overlay(c *Context, o OverlayOptions, fn func(), opts ...layout.Option) *Box

Overlay builds fn in a new layer above everything built so far. Layers swallow pointer input over their area (and over the whole window for ScreenFill). The overlay is placed during layout of the current frame, using its measured size, so it never needs a frame to settle.

Dismissible overlays close through Dismissed (or EscapeAt and PressedOutside) with the returned box's ID: Escape and outside presses then reach only the top-most open layer.

func Row ​

go
func Row(c *Context, fn func(), opts ...layout.Option) *Box

Row lays out children horizontally.

func StackBox ​

go
func StackBox(c *Context, fn func(), opts ...layout.Option) *Box

StackBox overlaps children.

func (*Box) A11y ​

go
func (b *Box) A11y(fn func(s *a11y.Node)) *Box

A11y sets a function that completes the box's semantics node (description, value, range, relations) while the tree is built. fn runs only when accessibility is on.

func (*Box) A11yHidden ​

go
func (b *Box) A11yHidden() *Box

A11yHidden hides the box and its subtree from the semantics tree (decoration, or content another node already describes).

func (*Box) A11yKeyboard ​

go
func (b *Box) A11yKeyboard() *Box

A11yKeyboard declares that a pointer-only box has a keyboard equivalent elsewhere (arrow keys of its composite, a focusable twin), so Audit does not report it as unreachable.

func (*Box) A11yScroller 实验性 ​

go
func (b *Box) A11yScroller() *Box

A11yScroller declares that the box is a scroll container that moves its content itself (a touch scroll view with its own scroller) rather than a ui scroll container. Semantic nodes inside it get the ScrollIntoView action, and the container reads a request for it with Context.A11yScrollRequest and scrolls the widget into view. Such a container normally clips (Clip), which also marks content scrolled out of it Offscreen.

func (*Box) A11yState ​

go
func (b *Box) A11yState(s a11y.State) *Box

A11yState adds accessibility states to the box (Selected, Expanded …).

func (*Box) Bg ​

go
func (b *Box) Bg(col theme.Color) *Box

Bg sets the background color.

func (*Box) Body ​

go
func (b *Box) Body(fn func()) *Box

Body adds children.

func (*Box) Border ​

go
func (b *Box) Border(w float32, col theme.Color) *Box

Border draws a border inside the box.

func (*Box) Clicked ​

go
func (b *Box) Clicked() bool

Clicked reports a click on the box.

func (*Box) Clip ​

go
func (b *Box) Clip() *Box

Clip clips children to the (rounded) box.

func (*Box) Cursor 实验性 ​

go
func (b *Box) Cursor(cursor input.Cursor) *Box

Cursor sets the pointer cursor for an interactive box. It can be set during custom painting when hit geometry depends on layout.

func (*Box) DashedBorder ​

go
func (b *Box) DashedBorder(w float32, col theme.Color) *Box

DashedBorder draws a dashed border.

func (*Box) Focusable ​

go
func (b *Box) Focusable(cursor input.Cursor) Interaction

Focusable makes the box a keyboard focus stop (Tab, focus ring state, Enter / Space activate it) and returns its interaction, like Interact.

func (*Box) Hovered ​

go
func (b *Box) Hovered() bool

Hovered reports pointer hover (registers the box for hit testing).

func (*Box) ID ​

go
func (b *Box) ID() ID

ID returns the box's widget ID.

func (*Box) Interact ​

go
func (b *Box) Interact(cursor input.Cursor) Interaction

Interact makes the box hoverable/clickable and returns its state.

func (*Box) Label ​

go
func (b *Box) Label(s string) *Box

Label gives a box (Custom, Div, Row …) a text label: Driver.Find, FindText and ClickLabel locate it by that text, and it is the box's accessible name unless Semantics set another. The widget ID is not affected (it was computed when the box was created).

func (*Box) Opacity ​

go
func (b *Box) Opacity(a float32) *Box

Opacity fades the box and its children.

func (*Box) Paint ​

go
func (b *Box) Paint(fn PaintFunc) *Box

Paint adds a custom painter drawn above the background, below children.

func (*Box) PaintOver ​

go
func (b *Box) PaintOver(fn PaintFunc) *Box

PaintOver adds a painter drawn above children.

func (*Box) Radii ​

go
func (b *Box) Radii(r geom.Radii) *Box

Radii sets per-corner radii.

func (*Box) Radius ​

go
func (b *Box) Radius(r float32) *Box

Radius rounds the corners.

func (*Box) RawTouch 实验性 ​

go
func (b *Box) RawTouch() *Box

RawTouch stops the fingers that go down inside b from being turned into pointer events: b handles them through Touches alone (drawing surfaces, maps, custom multi-finger gestures).

func (*Box) Rect ​

go
func (b *Box) Rect() geom.Rect

Rect returns the box's absolute rect from the previous frame.

func (*Box) Scale ​

go
func (b *Box) Scale(k float32) *Box

Scale scales the box and its subtree by k about its centre (enter / leave motion); 1 removes the transform.

func (*Box) ScrollShift 实验性 ​

go
func (b *Box) ScrollShift(r geom.Rect, d geom.Point)

ScrollShift is Context.ScrollShift for a widget that paints scrolled content itself (the lines of a code editor): it declares that what b paints, with b's subtree, moved by d inside r. Unlike Context.ScrollShift it may also be called from b's paint function, once the widget knows where it scrolled to; the rules are the same (the backgrounds behind r must look the same everywhere in r, nodes that do not move with b are damaged by the Runner, and an unclassifiable region is redrawn whole).

UI thread only, during the page build or b's paint.

func (*Box) Semantics ​

go
func (b *Box) Semantics(role a11y.Role, name string) *Box

Semantics sets the box's role and accessible name (an empty name is computed from the text inside for roles such as buttons and cells).

func (*Box) Shadow ​

go
func (b *Box) Shadow(s []paint.Shadow) *Box

Shadow sets layered box shadows.

func (*Box) Style ​

go
func (b *Box) Style(opts ...layout.Option) *Box

Style tweaks layout after creation.

func (*Box) TakePointer 实验性 ​

go
func (b *Box) TakePointer(axes PanAxis) *Box

TakePointer makes b take over drags that start on widgets inside it and move along axes (see the package notes above on pointer takeover). b should register a hit (Interact, Focusable) so that it can also be dragged directly. Declare it every frame, like other modifiers.

func (*Box) Touches 实验性 ​

go
func (b *Box) Touches() []input.TouchEvent

Touches makes b receive touch events and returns those of this frame for the fingers bound to b (see the notes on multi-touch above), in the order they happened. Call it every frame: fingers are routed by the last frame's geometry, so b receives fingers that go down inside it from the frame after its first call. Single-finger pointer emulation keeps running unless b also sets RawTouch.

func (*Box) Transform ​

go
func (b *Box) Transform(m geom.Affine) *Box

Transform draws the box and its subtree through m, given in the box's own coordinates (origin at its top-left corner), like a CSS transform with transform-origin 0 0. Layout is unaffected; hit testing and Rect use the transformed bounding box. Combine with geom.ScaleAround / RotateAround for other origins, e.g. scaling about the centre:

b.Transform(geom.ScaleAround(k, k, geom.Pt(w/2, h/2)))
go
type BreadcrumbItem struct {
	Label   string
	Icon    *icon.Icon // shown before the label (alone when Label is "")
	Href    string     // reported by ClickedHref; the app navigates
	OnClick func()     // runs when the item is clicked
	Menu    []MenuItem // dropdown menu on the item (read MenuClicked)
	// Separator replaces the separator after this item (antd items[]
	// {type: "separator", separator}); "" keeps the breadcrumb's.
	Separator string
}

BreadcrumbItem is a structured breadcrumb entry.

go
type BreadcrumbW struct {
	// contains filtered or unexported fields
}

BreadcrumbW is a breadcrumb with structured items: icons, dropdown menus, click handlers and a custom separator.

go
func Breadcrumb(c *Context, items ...string) *BreadcrumbW

Breadcrumb shows a path of plain labels; Clicked on the result returns the index of the item clicked this frame, or -1. BreadcrumbItems builds the structured form.

go
func BreadcrumbItems(c *Context, items []BreadcrumbItem) *BreadcrumbW

BreadcrumbItems starts a breadcrumb of structured items; chain options, then Show.

ConfigProvider.Defaults("Breadcrumb", ...) keys: "separator" (string).

go
func (b *BreadcrumbW) Clicked() int

Clicked returns the index of the item clicked this frame, or -1.

go
func (b *BreadcrumbW) ClickedHref() string

ClickedHref returns the Href of the item clicked this frame ("" when none was clicked or it has no Href).

go
func (b *BreadcrumbW) DropdownIcon(ic *icon.Icon) *BreadcrumbW

DropdownIcon replaces the down arrow of items with a Menu (antd dropdownIcon).

go
func (b *BreadcrumbW) MenuClicked() string

MenuClicked returns the key chosen in an item's dropdown menu this frame.

go
func (b *BreadcrumbW) Separator(s string) *BreadcrumbW

Separator replaces the "/" between items (Ant separator, Element separator).

go
func (b *BreadcrumbW) SeparatorIcon(ic *icon.Icon) *BreadcrumbW

SeparatorIcon uses an icon between items (Element separator-icon).

go
func (b *BreadcrumbW) Show() *BreadcrumbW

Show builds the breadcrumb.

Breakpoint ​

go
type Breakpoint uint8

Breakpoint names a window width range.

Append-only: never reorder or insert; the zero value stays XS.

go
const (
	XS Breakpoint = iota
	SM
	MD
	LG
	XL
	XXL
)

func ScreenBreakpoint 实验性 ​

go
func ScreenBreakpoint(c *Context) Breakpoint

ScreenBreakpoint returns the breakpoint of the current window width.

func (Breakpoint) String ​

go
func (b Breakpoint) String() string

String returns "xs" ... "xxl".

BubbleAction 实验性 ​

go
type BubbleAction uint8

BubbleAction is a set of built-in message actions (bit flags).

go
const (
	BubbleCopy  BubbleAction = 1 << iota // copy the content to the clipboard
	BubbleRetry                          // ask for a new answer (Retried)
	BubbleEdit                           // edit the message in place (Edited)
)

实验性

BubbleListW 实验性 ​

go
type BubbleListW struct {
	// contains filtered or unexported fields
}

BubbleListW is a scrolling message stream that only builds the messages near the viewport (heights are measured and cached by key), keeps the bottom in view while new content streams in, and stops following when the user scrolls up, showing a "back to bottom" button instead.

func BubbleList 实验性 ​

go
func BubbleList(c *Context, n int, key func(i int) string, item func(i int), opts ...layout.Option) *BubbleListW

BubbleList adds a message list of n items; key(i) must be a stable, unique key of message i (heights and widget state are kept by key) and item(i) builds it (usually a Bubble). Give the list a bounded height (Grow inside a sized parent, or layout.H).

ui.BubbleList(c, len(msgs), func(i int) string { return msgs[i].ID }, func(i int) {
	ui.Bubble(c, msgs[i].Role, msgs[i].Text)
}, layout.Grow(1))

func (*BubbleListW) A11yLabel 实验性 ​

go
func (w *BubbleListW) A11yLabel(s string) *BubbleListW

A11yLabel sets the accessible name (default Locale.Chat.Messages).

func (*BubbleListW) Following 实验性 ​

go
func (w *BubbleListW) Following() bool

Following reports whether the list sticks to the bottom.

func (*BubbleListW) Gap 实验性 ​

go
func (w *BubbleListW) Gap(px float32) *BubbleListW

Gap sets the space between messages (default 8; the action row under a message reserves its own space).

func (*BubbleListW) ID 实验性 ​

go
func (w *BubbleListW) ID() ID

ID returns the scroll container's ID.

func (*BubbleListW) NoAutoScroll 实验性 ​

go
func (w *BubbleListW) NoAutoScroll() *BubbleListW

NoAutoScroll stops following new content at the bottom.

func (*BubbleListW) Overscan 实验性 ​

go
func (w *BubbleListW) Overscan(px float32) *BubbleListW

Overscan sets how far beyond the viewport messages are built, in px (default 600).

func (*BubbleListW) Padding 实验性 ​

go
func (w *BubbleListW) Padding(px float32) *BubbleListW

Padding sets the space around the messages (default 16).

func (*BubbleListW) Range 实验性 ​

go
func (w *BubbleListW) Range() (first, end int)

Range returns the half-open range of messages built this frame.

func (*BubbleListW) ScrollToBottom 实验性 ​

go
func (w *BubbleListW) ScrollToBottom() *BubbleListW

ScrollToBottom jumps to the end and resumes following new content.

func (*BubbleListW) TopReached 实验性 ​

go
func (w *BubbleListW) TopReached() bool

TopReached reports the frame the user scrolled to the very top (load earlier messages then; the view keeps its place when they are prepended).

BubbleVariant 实验性 ​

go
type BubbleVariant uint8

BubbleVariant is the look of a Bubble.

go
const (
	BubbleAuto       BubbleVariant = iota // user filled, assistant borderless
	BubbleFilled                          // tinted background
	BubbleOutlined                        // border, no fill
	BubbleShadow                          // elevated card
	BubbleBorderless                      // content only (full width)
)

实验性

BubbleW 实验性 ​

go
type BubbleW struct {
	// contains filtered or unexported fields
}

BubbleW is one chat message: avatar, optional name, content and actions.

func Bubble 实验性 ​

go
func Bubble(c *Context, role ChatRole, content string) *BubbleW

Bubble adds a chat message of role with content (Markdown for the assistant, plain text for the user; see Markdown/Plain).

ui.Bubble(c, ui.ChatAssistant, reply).Typing(streaming).Actions(ui.BubbleCopy | ui.BubbleRetry)

func (*BubbleW) Actions 实验性 ​

go
func (w *BubbleW) Actions(a BubbleAction) *BubbleW

Actions shows the built-in action buttons under the bubble. They appear while the pointer is over the message or focus is inside it (see ActionsAlways) and stay reachable with Tab.

func (*BubbleW) ActionsAlways 实验性 ​

go
func (w *BubbleW) ActionsAlways() *BubbleW

ActionsAlways keeps the action buttons visible (the last answer).

func (*BubbleW) Avatar 实验性 ​

go
func (w *BubbleW) Avatar(fn func()) *BubbleW

Avatar replaces the default avatar with custom content.

func (*BubbleW) AvatarIcon 实验性 ​

go
func (w *BubbleW) AvatarIcon(ic *icon.Icon) *BubbleW

AvatarIcon sets the icon of the default avatar.

func (*BubbleW) AvatarText 实验性 ​

go
func (w *BubbleW) AvatarText(s string) *BubbleW

AvatarText shows initials in the default avatar.

go
func (w *BubbleW) ClickedLink() string

ClickedLink returns the URL of a Markdown link clicked this frame.

func (*BubbleW) Copied 实验性 ​

go
func (w *BubbleW) Copied() bool

Copied reports that the copy action put the content on the clipboard this frame.

func (*BubbleW) Edited 实验性 ​

go
func (w *BubbleW) Edited() (string, bool)

Edited returns the new text when an in-place edit was saved this frame.

func (*BubbleW) Editing 实验性 ​

go
func (w *BubbleW) Editing() bool

Editing reports whether the in-place editor is open.

func (*BubbleW) Extra 实验性 ​

go
func (w *BubbleW) Extra(fn func()) *BubbleW

Extra adds content under the bubble (tool cards, thought chains, attachments, custom actions).

func (*BubbleW) ID 实验性 ​

go
func (w *BubbleW) ID() ID

ID returns the message row's ID.

func (*BubbleW) Layout 实验性 ​

go
func (w *BubbleW) Layout(opts ...layout.Option) *BubbleW

Layout applies layout options to the message row.

func (*BubbleW) Loading 实验性 ​

go
func (w *BubbleW) Loading(on bool) *BubbleW

Loading shows animated dots while the content is still empty.

func (*BubbleW) Markdown 实验性 ​

go
func (w *BubbleW) Markdown() *BubbleW

Markdown renders the content as Markdown (default for the assistant).

func (*BubbleW) Meta 实验性 ​

go
func (w *BubbleW) Meta(s string) *BubbleW

Meta shows a footer text after the actions (time, model, tokens).

func (*BubbleW) Name 实验性 ​

go
func (w *BubbleW) Name(s string) *BubbleW

Name shows the author's name above the bubble (also its accessible name).

func (*BubbleW) NoAvatar 实验性 ​

go
func (w *BubbleW) NoAvatar() *BubbleW

NoAvatar hides the avatar column.

func (*BubbleW) Plain 实验性 ​

go
func (w *BubbleW) Plain() *BubbleW

Plain renders the content as plain text keeping line breaks (default for the user and system).

func (*BubbleW) Retried 实验性 ​

go
func (w *BubbleW) Retried() bool

Retried reports a click on the retry action.

func (*BubbleW) Typing 实验性 ​

go
func (w *BubbleW) Typing(on bool) *BubbleW

Typing marks the content as still streaming: it is revealed at TypingSpeed (catching up quickly when far behind) with a caret at the end. Turning it off shows the whole content.

func (*BubbleW) TypingSpeed 实验性 ​

go
func (w *BubbleW) TypingSpeed(cps float32) *BubbleW

TypingSpeed sets the reveal speed in characters per second (default 60).

func (*BubbleW) Variant 实验性 ​

go
func (w *BubbleW) Variant(v BubbleVariant) *BubbleW

Variant sets the look (default BubbleAuto).

ButtonAppearance ​

go
type ButtonAppearance string

ButtonAppearance is how a button wears its color (Ant v6 variant, plus Element's plain).

go
const (
	ButtonSolid    ButtonAppearance = "solid"    // filled with the color
	ButtonOutlined ButtonAppearance = "outlined" // colored border and label
	ButtonDashed   ButtonAppearance = "dashed"   // outlined with a dashed border
	ButtonFilled   ButtonAppearance = "filled"   // light tint, no border
	ButtonText     ButtonAppearance = "text"     // label only, tint under the pointer
	ButtonLink     ButtonAppearance = "link"     // link-styled label
	ButtonPlain    ButtonAppearance = "plain"    // Element plain: tint + tinted border, solid on hover
)

ButtonColor ​

go
type ButtonColor string

ButtonColor names a button color: a role (default, primary, danger, success, warning, info), an Ant Design preset (blue … gold) or a hex color such as "#13c2c2". The set is open; unknown names fall back to primary.

go
const (
	ButtonColorDefault ButtonColor = "default"
	ButtonColorPrimary ButtonColor = "primary"
	ButtonColorDanger  ButtonColor = "danger"
	ButtonColorSuccess ButtonColor = "success" // Element type="success"
	ButtonColorWarning ButtonColor = "warning" // Element type="warning"
	ButtonColorInfo    ButtonColor = "info"    // Element type="info"

	ButtonColorBlue     ButtonColor = "blue"
	ButtonColorPurple   ButtonColor = "purple"
	ButtonColorCyan     ButtonColor = "cyan"
	ButtonColorGreen    ButtonColor = "green"
	ButtonColorMagenta  ButtonColor = "magenta"
	ButtonColorPink     ButtonColor = "pink"
	ButtonColorRed      ButtonColor = "red"
	ButtonColorOrange   ButtonColor = "orange"
	ButtonColorYellow   ButtonColor = "yellow"
	ButtonColorVolcano  ButtonColor = "volcano"
	ButtonColorGeekblue ButtonColor = "geekblue"
	ButtonColorLime     ButtonColor = "lime"
	ButtonColorGold     ButtonColor = "gold"
)

ButtonGroupW 实验性 ​

go
type ButtonGroupW struct {
	// contains filtered or unexported fields
}

ButtonGroupW joins buttons into one group (Ant Button.Group, Element el-button-group, shadcn ButtonGroup): neighbours share a one-pixel border, only the outer corners stay rounded, and size, color, appearance or variant can be set once for every button. Buttons keep their own modifiers, which win over the group's.

ui.ButtonGroup(c).Variant(ui.VariantPrimary).Body(func() {
	ui.Button(c, "上一页").Icon(icon.Left)
	ui.Button(c, "下一页").IconRight(icon.Right)
})

Buttons that are direct children join, and so does a button that is the whole trigger of a Dropdown placed directly in the group (Element split-button: a main button and a menu caret sharing one seam). Each button stays its own Tab stop.

func ButtonGroup 实验性 ​

go
func ButtonGroup(c *Context) *ButtonGroupW

ButtonGroup starts a button group; chain options, then Body.

ConfigProvider.Defaults("ButtonGroup", ...) keys: "size", "type" (a Button type / variant name such as "primary").

func (*ButtonGroupW) A11yLabel 实验性 ​

go
func (g *ButtonGroupW) A11yLabel(s string) *ButtonGroupW

A11yLabel names the group for screen readers.

func (*ButtonGroupW) Appearance 实验性 ​

go
func (g *ButtonGroupW) Appearance(a ButtonAppearance) *ButtonGroupW

Appearance sets the appearance of every button (see ButtonW.Appearance).

func (*ButtonGroupW) Body 实验性 ​

go
func (g *ButtonGroupW) Body(fn func()) *ButtonGroupW

Body adds the buttons.

func (*ButtonGroupW) Color 实验性 ​

go
func (g *ButtonGroupW) Color(col ButtonColor) *ButtonGroupW

Color sets the color of every button (see ButtonW.Color).

func (*ButtonGroupW) ID 实验性 ​

go
func (g *ButtonGroupW) ID() ID

ID returns the group's widget ID (valid after Body).

func (*ButtonGroupW) Layout 实验性 ​

go
func (g *ButtonGroupW) Layout(o ...layout.Option) *ButtonGroupW

Layout applies layout options to the group.

func (*ButtonGroupW) Size 实验性 ​

go
func (g *ButtonGroupW) Size(s ControlSize) *ButtonGroupW

Size sets the size of every button.

func (*ButtonGroupW) Variant 实验性 ​

go
func (g *ButtonGroupW) Variant(v ButtonVariant) *ButtonGroupW

Variant sets the variant of every button (Element group type="primary" is Variant(ui.VariantPrimary)).

func (*ButtonGroupW) Vertical 实验性 ​

go
func (g *ButtonGroupW) Vertical() *ButtonGroupW

Vertical stacks the buttons (joined top / bottom edges).

ButtonVariant ​

go
type ButtonVariant uint8

ButtonVariant is the visual type of a button.

Append-only: never reorder or insert; the zero value stays VariantDefault.

go
const (
	VariantDefault ButtonVariant = iota
	VariantPrimary
	VariantDashed
	VariantText
	VariantLink
	// VariantSecondary is a neutral filled button (shadcn "secondary", Ant
	// variant="filled", Element type="info" plain).
	VariantSecondary
)

ButtonW ​

go
type ButtonW struct {
	// contains filtered or unexported fields
}

ButtonW is a button under construction; chain modifiers then query.

func Button ​

go
func Button(c *Context, label string) *ButtonW

Button adds a button.

func (*ButtonW) A11yLabel ​

go
func (b *ButtonW) A11yLabel(s string) *ButtonW

A11yLabel sets the accessible name read by screen readers. Icon-only buttons (no label) must set one, from the Locale: Button(c, "").Icon(ic).A11yLabel(loc.Search).

func (*ButtonW) Appearance ​

go
func (b *ButtonW) Appearance(a ButtonAppearance) *ButtonW

Appearance sets how the button wears its color (Ant v6 variant, plus Element's plain).

func (*ButtonW) AutoInsertSpace ​

go
func (b *ButtonW) AutoInsertSpace(on bool) *ButtonW

AutoInsertSpace sets whether a label of exactly two Chinese characters is drawn with a space between them ("确定" shows as "确 定"; Ant / Element ConfigProvider button.autoInsertSpace). It applies only to buttons without an icon whose appearance is not text or link; the accessible name keeps the label as given. The default follows the design system (ButtonToken.AutoInsertSpace: on for Ant, off for Element and shadcn); Defaults("Button", Props{"autoInsertSpace": …}) overrides it for a scope and this method for one button.

func (*ButtonW) Block ​

go
func (b *ButtonW) Block() *ButtonW

Block stretches the button to the container width.

func (*ButtonW) Circle ​

go
func (b *ButtonW) Circle() *ButtonW

Circle makes an icon-only round button.

func (*ButtonW) Clicked ​

go
func (b *ButtonW) Clicked() bool

Clicked reports activation (never when disabled or loading).

func (*ButtonW) Color ​

go
func (b *ButtonW) Color(col ButtonColor) *ButtonW

Color sets the button color (Ant v6 color): a role, an Ant preset or a hex color ("#13c2c2"). Combine it with Appearance, or with the variant modifiers: Primary is solid, Dashed dashed, Text text, Link link, Secondary filled. With neither, the success / warning / info colors are solid (Element type="success") and the other colors outlined.

ui.Button(c, "紫色").Color(ui.ButtonColorPurple).Appearance(ui.ButtonFilled)

func (*ButtonW) Danger ​

go
func (b *ButtonW) Danger() *ButtonW

func (*ButtonW) Dashed ​

go
func (b *ButtonW) Dashed() *ButtonW

func (*ButtonW) Disabled ​

go
func (b *ButtonW) Disabled(on bool) *ButtonW

Disabled disables the button when on.

func (*ButtonW) Ghost ​

go
func (b *ButtonW) Ghost() *ButtonW

func (*ButtonW) Hovered ​

go
func (b *ButtonW) Hovered() bool

Hovered reports hover.

func (*ButtonW) ID ​

go
func (b *ButtonW) ID() ID

ID returns the widget ID.

func (*ButtonW) Icon ​

go
func (b *ButtonW) Icon(ic *icon.Icon) *ButtonW

Icon puts an icon before the label.

func (*ButtonW) IconPlacement ​

go
func (b *ButtonW) IconPlacement(p string) *ButtonW

IconPlacement places the icon at the inline "start" of the label (default) or at its "end" (Ant v6 iconPlacement, which replaces iconPosition). Both are logical: "end" is on the left in a right-to-left scope. Other values are ignored.

ui.Button(c, "下一步").Icon(icon.Right).IconPlacement("end")

func (*ButtonW) IconRight ​

go
func (b *ButtonW) IconRight(ic *icon.Icon) *ButtonW

IconRight puts the icon after the label (Icon(ic).IconPlacement("end")).

func (*ButtonW) Info ​

go
func (b *ButtonW) Info() *ButtonW

Info makes a solid info button (Element type="info").

func (*ButtonW) Large ​

go
func (b *ButtonW) Large() *ButtonW

func (*ButtonW) Layout ​

go
func (b *ButtonW) Layout(opts ...layout.Option) *ButtonW

Layout applies layout options.

go
func (b *ButtonW) Link() *ButtonW

func (*ButtonW) Loading ​

go
func (b *ButtonW) Loading(on bool) *ButtonW

Loading shows a spinner and blocks clicks.

func (*ButtonW) LoadingDelay ​

go
func (b *ButtonW) LoadingDelay(d time.Duration) *ButtonW

LoadingDelay postpones the loading state (Ant loading.delay): after Loading(true) the button stays clickable and shows no spinner until d has passed; a loading that ends sooner never shows.

func (*ButtonW) LoadingIcon ​

go
func (b *ButtonW) LoadingIcon(ic *icon.Icon) *ButtonW

LoadingIcon replaces the loading spinner with ic, drawn spinning (Ant loading.icon, Element loading-icon).

func (*ButtonW) Plain ​

go
func (b *ButtonW) Plain() *ButtonW

Plain uses Element's plain style: a light tint of the color with a tinted border, filled with the color under the pointer. It combines with every color: Plain() alone, Primary().Plain(), Success().Plain(), Danger().Plain(), Color(ui.ButtonColorPurple).Plain() …

func (*ButtonW) Primary ​

go
func (b *ButtonW) Primary() *ButtonW

func (*ButtonW) Round ​

go
func (b *ButtonW) Round() *ButtonW

func (*ButtonW) Secondary ​

go
func (b *ButtonW) Secondary() *ButtonW

Secondary makes a neutral filled button (shadcn "secondary").

func (*ButtonW) Size ​

go
func (b *ButtonW) Size(s ControlSize) *ButtonW

Size sets the control size.

func (*ButtonW) Small ​

go
func (b *ButtonW) Small() *ButtonW

func (*ButtonW) Success ​

go
func (b *ButtonW) Success() *ButtonW

Success makes a solid success button (Element type="success"); add Plain for the plain style.

func (*ButtonW) Text ​

go
func (b *ButtonW) Text() *ButtonW

func (*ButtonW) Variant ​

go
func (b *ButtonW) Variant(v ButtonVariant) *ButtonW

Variant sets the variant explicitly.

func (*ButtonW) Warning ​

go
func (b *ButtonW) Warning() *ButtonW

Warning makes a solid warning button (Element type="warning").

CalendarLocale 实验性 ​

go
type CalendarLocale struct {
	Month, Year string
	// contains filtered or unexported fields
}

CalendarLocale holds the Calendar mode switch.

CalendarW 实验性 ​

go
type CalendarW struct {
	// contains filtered or unexported fields
}

CalendarW is a calendar.

func Calendar 实验性 ​

go
func Calendar(c *Context, val *time.Time) *CalendarW

Calendar adds a calendar bound to *val (zero means today, nothing selected). Modifiers apply until the end of the build; the content is built then (or at Changed/PanelChanged).

ui.Calendar(c, &day).CellRender(func(d time.Time) { ... })
ui.Calendar(c, &day).Card().DisabledDate(isWeekend)

func (*CalendarW) Card 实验性 ​

go
func (w *CalendarW) Card() *CalendarW

Card uses Ant's compact card mode (fullscreen=false).

func (*CalendarW) CellHeight 实验性 ​

go
func (w *CalendarW) CellHeight(px float32) *CalendarW

CellHeight overrides the fullscreen cell height.

func (*CalendarW) CellRender 实验性 ​

go
func (w *CalendarW) CellRender(fn func(d time.Time)) *CalendarW

CellRender adds content below the date in month view.

func (*CalendarW) Changed 实验性 ​

go
func (w *CalendarW) Changed() bool

Changed reports a date pick.

func (*CalendarW) ControllerType 实验性 ​

go
func (w *CalendarW) ControllerType(t string) *CalendarW

ControllerType sets the Element header's month navigation: "button" (previous / today / next, default) or "select" (year and month selects; Element controller-type). The Ant header always uses selects.

func (*CalendarW) DisabledDate 实验性 ​

go
func (w *CalendarW) DisabledDate(fn func(d time.Time) bool) *CalendarW

DisabledDate greys out and blocks dates.

func (*CalendarW) Formatter 实验性 ​

go
func (w *CalendarW) Formatter(fn func(v int, kind string) string) *CalendarW

Formatter formats the labels of the header's year and month selects: fn(v, kind) gets the year or the month number (1-12) and kind "year" or "month" (Element formatter); empty results fall back to the default.

func (*CalendarW) Layout 实验性 ​

go
func (w *CalendarW) Layout(o ...layout.Option) *CalendarW

Layout applies layout options to the calendar.

func (*CalendarW) Mode 实验性 ​

go
func (w *CalendarW) Mode(m *string) *CalendarW

Mode binds the view mode ("month" or "year").

func (*CalendarW) MonthCellRender 实验性 ​

go
func (w *CalendarW) MonthCellRender(fn func(m time.Time)) *CalendarW

MonthCellRender adds content below the month in year view.

func (*CalendarW) NoHeader 实验性 ​

go
func (w *CalendarW) NoHeader() *CalendarW

NoHeader hides the header.

func (*CalendarW) PanelChanged 实验性 ​

go
func (w *CalendarW) PanelChanged() bool

PanelChanged reports a month/year/mode navigation.

func (*CalendarW) Range 实验性 ​

go
func (w *CalendarW) Range(start, end time.Time) *CalendarW

Range shows only the weeks from start to end (Element range): the grid starts with start's week and ends with end's week, the header shows the range instead of the month navigation, days outside [start, end] are greyed out and cannot be picked, and the year view is off. Element asks for a start on the first day of a week and an end on the last day, at most two months apart; other ranges are padded to whole weeks.

func (*CalendarW) ShowWeek 实验性 ​

go
func (w *CalendarW) ShowWeek(on bool) *CalendarW

ShowWeek adds a column of week numbers (ISO weeks) before the days of the month view (Ant showWeek).

func (*CalendarW) ValidRange 实验性 ​

go
func (w *CalendarW) ValidRange(start, end time.Time) *CalendarW

ValidRange limits the dates that can be picked and shown (Ant validRange): days outside [start, end] are disabled, the header's year and month choices and the month navigation stay inside the range.

CardActionW 实验性 ​

go
type CardActionW struct {
	// contains filtered or unexported fields
}

CardActionW is the action slot CardAction returns.

func CardAction 实验性 ​

go
func CardAction(c *Context, ic *icon.Icon, label string) *CardActionW

CardAction is a convenience action slot: a clickable icon (e.g. icon.Setting, icon.Edit, icon.More, icon.Like) in the secondary text color that turns primary on hover. Clicked on the result reports an activation.

func (*CardActionW) Clicked 实验性 ​

go
func (a *CardActionW) Clicked() bool

Clicked reports whether the action was activated this frame.

CardMetaW 实验性 ​

go
type CardMetaW struct {
	*Box
	// contains filtered or unexported fields
}

CardMetaW is the Card.Meta block CardMeta returns; it embeds the row's Box.

func CardMeta 实验性 ​

go
func CardMeta(c *Context, avatar func(), title, desc string) *CardMetaW

CardMeta lays out Card.Meta: avatar on the left, title and description.

CardW ​

go
type CardW struct {
	// contains filtered or unexported fields
}

CardW is a bordered container: cover, header with extra, body, action bar, footer, loading skeleton, inner type, hover/always/never shadow.

func Card ​

go
func Card(c *Context, title string) *CardW

Card starts a card ("" title = no header); set options then call Body.

ConfigProvider.Defaults("Card", ...) keys: "size" ("small" / Small), "variant" ("outlined" | "borderless"; the deprecated "bordered" bool is still read), "hoverable" (bool), "shadow" (Element: "always" | "hover" | "never"), "type" ("inner").

func (*CardW) Actions ​

go
func (w *CardW) Actions(fns ...func()) *CardW

Actions adds the bottom action bar; each fn builds one equal-width slot.

func (*CardW) Body ​

go
func (w *CardW) Body(fn func()) *CardW

Body builds the card.

func (*CardW) Borderless ​

go
func (w *CardW) Borderless() *CardW

Borderless removes the border.

Deprecated: use Variant("borderless") (antd 6 replaced bordered with variant).

func (*CardW) Clicked ​

go
func (w *CardW) Clicked() bool

Clicked reports a click on a hoverable card.

func (*CardW) Cover ​

go
func (w *CardW) Cover(fn func()) *CardW

Cover places content (usually an image) above the header, edge to edge.

func (*CardW) Extra ​

go
func (w *CardW) Extra(fn func()) *CardW

func (*CardW) Footer ​

go
func (w *CardW) Footer(fn func()) *CardW

Footer adds an Element-style footer below the body.

func (*CardW) Hoverable ​

go
func (w *CardW) Hoverable() *CardW

Hoverable lifts the card with a shadow on hover.

func (*CardW) Inner ​

go
func (w *CardW) Inner() *CardW

Inner uses Ant's inner-card header (grey header band).

func (*CardW) Layout ​

go
func (w *CardW) Layout(o ...layout.Option) *CardW

Layout applies layout options to the card.

func (*CardW) Loading ​

go
func (w *CardW) Loading(on bool) *CardW

Loading shows an active skeleton instead of the body.

func (*CardW) Padding ​

go
func (w *CardW) Padding(in geom.Insets) *CardW

Padding overrides the body padding.

func (*CardW) Shadow ​

go
func (w *CardW) Shadow(mode string) *CardW

Shadow sets the shadow mode: "always", "hover" or "never" (Element's el-card shadow prop). The default comes from the theme (CardToken.ShadowAlways: never for Ant, except a borderless card, which keeps a soft shadow; always for Element and shadcn).

func (*CardW) Small ​

go
func (w *CardW) Small() *CardW

Small uses the compact header and padding.

func (*CardW) TabBarExtra ​

go
func (w *CardW) TabBarExtra(fn func()) *CardW

TabBarExtra builds content at the end of the card's tab bar (Ant tabBarExtraContent).

func (*CardW) TabChanged ​

go
func (w *CardW) TabChanged() bool

TabChanged reports that the user switched tabs this frame (Ant onTabChange). Call it after Body.

func (*CardW) Tabs ​

go
func (w *CardW) Tabs(active *string, items []TabItem) *CardW

Tabs adds a tab bar under the title (Ant tabList / activeTabKey): it switches *active, and the body is built as the active tab's panel, so Body's fn shows the content for *active. Without a title the tab bar is the whole header.

func (*CardW) Variant ​

go
func (w *CardW) Variant(v string) *CardW

Variant sets the card variant (antd 6 variant): "outlined" (the default, a 1px outline) or "borderless" (no outline; an Ant card then keeps a soft shadow, antd .ant-card:not(.ant-card-bordered)).

CarouselLocale 实验性 ​

go
type CarouselLocale struct {
	Prev, Next string
	// contains filtered or unexported fields
}

CarouselLocale holds the accessible names of the Carousel arrows.

CarouselW 实验性 ​

go
type CarouselW struct {
	// contains filtered or unexported fields
}

CarouselW is a slideshow: scroll or fade transitions, autoplay with pause on hover, indicator dots/lines and arrows.

go
func Carousel(c *Context, n int, slide func(i int)) *CarouselW

Carousel adds a slideshow of n slides; slide(i) builds slide i.

ConfigProvider.Defaults("Carousel", ...) keys: "autoplay" (time.Duration), "dots" (bool), "arrows" (string), "dotPlacement" ("top" | "bottom" | "start" | "end"; the deprecated "dotPosition" also takes "left" | "right" | "outside"), "type" ("card"), "effect" ("fade"), "height" (float32), "trigger" ("click" | "hover"), "pauseOnHover" (bool).

The index bound with Current is clamped to [0, n): an index past the ends shows the first or last slide.

func (*CarouselW) Arrows 实验性 ​

go
func (w *CarouselW) Arrows(mode string) *CarouselW

Arrows: "always", "hover" or "never". The arrows sit ArrowOffset px inside the frame (theme token CarouselToken.ArrowOffset); a negative offset (shadcn's -left-12 is -48) puts them outside, which needs that much free room beside the carousel or they are clipped by the parent.

func (*CarouselW) Autoplay 实验性 ​

go
func (w *CarouselW) Autoplay(d time.Duration) *CarouselW

Autoplay advances every d (0 disables).

func (*CarouselW) Card 实验性 ​

go
func (w *CarouselW) Card() *CarouselW

Card shows three slides at once: the current one in the middle and its neighbours scaled down and dimmed at the sides (Element type="card"); clicking a side card moves to it.

func (*CarouselW) CardScale 实验性 ​

go
func (w *CarouselW) CardScale(k float32) *CarouselW

CardScale sets the scale of the side cards of Card mode (Element cards-scale, default 0.83).

func (*CarouselW) Changed 实验性 ​

go
func (w *CarouselW) Changed() bool

Changed reports a slide change in the last Show.

func (*CarouselW) Current 实验性 ​

go
func (w *CarouselW) Current(i *int) *CarouselW

Current binds the active slide index.

func (*CarouselW) DotDuration 实验性 ​

go
func (w *CarouselW) DotDuration(on bool) *CarouselW

DotDuration fills the active indicator over the autoplay interval, as a progress bar (Ant autoplay.dotDuration).

func (*CarouselW) DotOutside 实验性 ​

go
func (w *CarouselW) DotOutside() *CarouselW

DotOutside puts the indicators under the frame, on the page (Element indicator-position="outside").

func (*CarouselW) DotPlacement 实验性 ​

go
func (w *CarouselW) DotPlacement(p string) *CarouselW

DotPlacement puts the indicators at the "bottom" (default), "top", "start" or "end" (Ant v6 dotPlacement; logical sides, mirrored in RTL). "start" and "end" also make the slides move vertically, as in Ant.

func (*CarouselW) DotPosition 实验性 ​

go
func (w *CarouselW) DotPosition(p string) *CarouselW

DotPosition: bottom, top, left, right, or outside (below the frame, Element indicator-position="outside").

Deprecated: use DotPlacement (and Dots / DotOutside for "outside").

func (*CarouselW) Dots 实验性 ​

go
func (w *CarouselW) Dots(on bool) *CarouselW

Dots shows/hides the indicators.

func (*CarouselW) Draggable 实验性 ​

go
func (w *CarouselW) Draggable(on bool) *CarouselW

Draggable lets a pointer drag or a finger swipe move the slides: the slides follow the pointer, and on release a travel past the swipe threshold (or a quick flick) turns the page, otherwise they spring back. Drags that start on a control inside a slide are taken over once they move sideways.

func (*CarouselW) Fade 实验性 ​

go
func (w *CarouselW) Fade() *CarouselW

Fade cross-fades instead of sliding.

func (*CarouselW) Height 实验性 ​

go
func (w *CarouselW) Height(px float32) *CarouselW

Height sets the frame height.

func (*CarouselW) Loop 实验性 ​

go
func (w *CarouselW) Loop(on bool) *CarouselW

Loop(false) stops at the ends: the first slide has no previous one and the last no next one (arrows and keys do nothing there, the arrows look disabled, autoplay stops at the last slide). Default true.

func (*CarouselW) PauseOnHover 实验性 ​

go
func (w *CarouselW) PauseOnHover(on bool) *CarouselW

PauseOnHover(false) keeps autoplay running while the pointer is over the carousel (default true; Ant / Element pause-on-hover). Keyboard focus inside still pauses it (WAI-ARIA).

func (*CarouselW) Show 实验性 ​

go
func (w *CarouselW) Show() *Box

Show builds the carousel.

func (*CarouselW) SwipeThreshold 实验性 ​

go
func (w *CarouselW) SwipeThreshold(frac float32) *CarouselW

SwipeThreshold sets the fraction of the slide size a drag must travel to turn the page (default 0.2).

func (*CarouselW) Trigger 实验性 ​

go
func (w *CarouselW) Trigger(t string) *CarouselW

Trigger sets how the indicators select a slide: "click" (Ant) or "hover" (Element's default). The theme picks the default.

func (*CarouselW) Vertical 实验性 ​

go
func (w *CarouselW) Vertical() *CarouselW

Vertical slides up/down (indicators on the right).

CascaderOption 实验性 ​

go
type CascaderOption struct {
	Label, Value string
	Disabled     bool
	Children     []CascaderOption
	IsLeaf       bool // never has children (relevant with LoadData)
}

CascaderOption is a node of a Cascader tree. With LoadData, a node without Children that is not IsLeaf loads its children when expanded.

CascaderPanelW 实验性 ​

go
type CascaderPanelW struct {
	// contains filtered or unexported fields
}

CascaderPanelW is an inline cascader; chain options, read Changed.

func CascaderPanel 实验性 ​

go
func CascaderPanel(c *Context, val *[]string, opts []CascaderOption) *CascaderPanelW

CascaderPanel adds the column menus of a Cascader inline, bound to *val (the selected value path). Clicking a leaf selects it (the menus stay); the panel is one Tab stop whose arrow keys move through the columns (Right / Enter opens the next column, Left goes back; mirrored in RTL), Enter / Space on a leaf selects it.

ui.CascaderPanel(c, &path, options).ChangeOnSelect()

func (*CascaderPanelW) A11yLabel 实验性 ​

go
func (p *CascaderPanelW) A11yLabel(s string) *CascaderPanelW

A11yLabel names the panel and its first column (default: the generic "please select").

func (*CascaderPanelW) Border 实验性 ​

go
func (p *CascaderPanelW) Border(on bool) *CascaderPanelW

Border toggles the panel frame (default on).

func (*CascaderPanelW) ChangeOnSelect 实验性 ​

go
func (p *CascaderPanelW) ChangeOnSelect() *CascaderPanelW

ChangeOnSelect selects parents too (clicking a parent selects it and opens its column).

func (*CascaderPanelW) Changed 实验性 ​

go
func (p *CascaderPanelW) Changed() bool

Changed reports a new selection this frame.

func (*CascaderPanelW) CheckedPaths 实验性 ​

go
func (p *CascaderPanelW) CheckedPaths() [][]string

CheckedPaths returns the checked paths of multiple mode by the checked strategy.

func (*CascaderPanelW) DataVersion 实验性 ​

go
func (p *CascaderPanelW) DataVersion(v int) *CascaderPanelW

DataVersion tells the panel that the options were modified in place (see CascaderW.DataVersion): change v after editing options of the same slice without changing its length.

func (*CascaderPanelW) Disabled 实验性 ​

go
func (p *CascaderPanelW) Disabled(on bool) *CascaderPanelW

Disabled turns the panel off.

func (*CascaderPanelW) Expand 实验性 ​

go
func (p *CascaderPanelW) Expand(path ...string) *CascaderPanelW

Expand sets the expanded path (by default it follows the value).

func (*CascaderPanelW) ExpandOnHover 实验性 ​

go
func (p *CascaderPanelW) ExpandOnHover() *CascaderPanelW

ExpandOnHover opens a parent's column on hover.

func (*CascaderPanelW) Height 实验性 ​

go
func (p *CascaderPanelW) Height(px float32) *CascaderPanelW

Height sets the column height (default: the Cascader token's DropdownHeight).

func (*CascaderPanelW) ID 实验性 ​

go
func (p *CascaderPanelW) ID() ID

ID returns the panel's ID.

func (*CascaderPanelW) LoadData 实验性 ​

go
func (p *CascaderPanelW) LoadData(fn func(path []string, done func([]CascaderOption))) *CascaderPanelW

LoadData loads children lazily (see CascaderW.LoadData).

func (*CascaderPanelW) Multiple 实验性 ​

go
func (p *CascaderPanelW) Multiple(vals *[][]string) *CascaderPanelW

Multiple switches to checkboxes bound to *vals (the checked leaf paths; see ShowCheckedStrategy and StrategyValue).

func (*CascaderPanelW) ShowCheckedStrategy 实验性 ​

go
func (p *CascaderPanelW) ShowCheckedStrategy(s CheckedStrategy) *CascaderPanelW

ShowCheckedStrategy sets the checked strategy of multiple mode (see CascaderW.ShowCheckedStrategy); CheckedPaths returns its paths.

func (*CascaderPanelW) StrategyValue 实验性 ​

go
func (p *CascaderPanelW) StrategyValue(on bool) *CascaderPanelW

StrategyValue makes the bound value of multiple mode follow the checked strategy (see CascaderW.StrategyValue).

func (*CascaderPanelW) Virtual 实验性 ​

go
func (p *CascaderPanelW) Virtual(on bool) *CascaderPanelW

Virtual forces virtual columns on or off (see CascaderW.Virtual; by default columns longer than 100 options are virtual).

CascaderW 实验性 ​

go
type CascaderW struct {
	// contains filtered or unexported fields
}

CascaderW selects a path in a tree through cascading menus.

func Cascader 实验性 ​

go
func Cascader(c *Context, val *[]string, opts []CascaderOption) *CascaderW

Cascader adds a cascading select bound to *val (the selected value path).

func (*CascaderW) A11yLabel 实验性 ​

go
func (w *CascaderW) A11yLabel(s string) *CascaderW

A11yLabel sets the accessible name (inside a FormItem the item label is used; the placeholder is the last resort).

func (*CascaderW) AllowClear 实验性 ​

go
func (w *CascaderW) AllowClear() *CascaderW

func (*CascaderW) ChangeOnSelect 实验性 ​

go
func (w *CascaderW) ChangeOnSelect() *CascaderW

func (*CascaderW) Changed 实验性 ​

go
func (w *CascaderW) Changed() bool

Changed reports a new selection this frame.

func (*CascaderW) CheckedPaths 实验性 ​

go
func (w *CascaderW) CheckedPaths() [][]string

CheckedPaths returns the checked paths of multiple mode by the checked strategy (the paths shown as tags).

func (*CascaderW) DataVersion 实验性 ​

go
func (w *CascaderW) DataVersion(v int) *CascaderW

DataVersion tells the cascader that the options were modified in place (a virtual column caches its width by slice identity, length and this number): after editing options of the same slice without changing its length, change v (or pass a new slice) so the widths are recomputed on the next frame.

func (*CascaderW) Disabled 实验性 ​

go
func (w *CascaderW) Disabled(on bool) *CascaderW

func (*CascaderW) DisplayRender 实验性 ​

go
func (w *CascaderW) DisplayRender(fn func(labels []string, path []CascaderOption) string) *CascaderW

DisplayRender sets the text shown for the selected path (single selection; default the labels joined by " / "): fn receives the labels and the options of the path, root first (Ant displayRender, Element show-all-levels / separator). A value no longer in the tree shows as an option whose Label and Value are the stored value.

ui.Cascader(c, &v, opts).DisplayRender(func(ls []string, _ []ui.CascaderOption) string { return ls[len(ls)-1] })

func (*CascaderW) Expand 实验性 ​

go
func (w *CascaderW) Expand(path ...string) *CascaderW

Expand sets the expanded path of an open menu (screenshots).

func (*CascaderW) ExpandOnHover 实验性 ​

go
func (w *CascaderW) ExpandOnHover() *CascaderW

func (*CascaderW) FilterMethod 实验性 ​

go
func (w *CascaderW) FilterMethod(fn func(query string, path []CascaderOption) bool) *CascaderW

FilterMethod replaces the search match (by default the "a / b / c" label path containing the typed text, case-insensitively) with fn: it receives the typed text and the options along a candidate path, root first (Ant showSearch.filter, Element filter-method). Implies Searchable.

ui.Cascader(c, &v, opts).FilterMethod(func(q string, p []ui.CascaderOption) bool {
	return strings.HasPrefix(p[len(p)-1].Value, q)
})

func (*CascaderW) IsOpen 实验性 ​

go
func (w *CascaderW) IsOpen() bool

IsOpen reports whether the menus are shown.

func (*CascaderW) Layout 实验性 ​

go
func (w *CascaderW) Layout(o ...layout.Option) *CascaderW

func (*CascaderW) LoadData 实验性 ​

go
func (w *CascaderW) LoadData(fn func(path []string, done func([]CascaderOption))) *CascaderW

LoadData enables lazy loading: expanding an option that has no Children and is not IsLeaf calls fn with its value path; fn (now or later, on any goroutine) calls done with the children. A spinner replaces the arrow meanwhile; done(nil) marks the option as a leaf.

ui.Cascader(c, &v, roots).LoadData(func(path []string, done func([]ui.CascaderOption)) {
	go func() { done(fetchChildren(path)) }()
})

func (*CascaderW) MaxTagCount 实验性 ​

go
func (w *CascaderW) MaxTagCount(n int) *CascaderW

func (*CascaderW) MaxTagPlaceholder 实验性 ​

go
func (w *CascaderW) MaxTagPlaceholder(fn func(omitted []string) string) *CascaderW

MaxTagPlaceholder builds the text of the collapsed tag of multiple mode from the hidden labels (Ant maxTagPlaceholder; default "+ N ...").

func (*CascaderW) Multiple 实验性 ​

go
func (w *CascaderW) Multiple(vals *[][]string) *CascaderW

func (*CascaderW) NotFoundContent 实验性 ​

go
func (w *CascaderW) NotFoundContent(s string) *CascaderW

NotFoundContent sets the text shown when a search finds nothing (Ant notFoundContent, Element empty slot).

func (*CascaderW) Open 实验性 ​

go
func (w *CascaderW) Open() *CascaderW

Open forces the menus open (screenshots, tests).

func (*CascaderW) Placeholder 实验性 ​

go
func (w *CascaderW) Placeholder(s string) *CascaderW

func (*CascaderW) Placement 实验性 ​

go
func (w *CascaderW) Placement(p Placement) *CascaderW

Placement sets where the menus open: BottomStart (default), BottomEnd, TopStart or TopEnd (Ant placement, Element placement); they flip when there is no room. ConfigProvider.Defaults("Cascader", "placement") takes the Ant names.

func (*CascaderW) Searchable 实验性 ​

go
func (w *CascaderW) Searchable() *CascaderW

func (*CascaderW) Separator 实验性 ​

go
func (w *CascaderW) Separator(s string) *CascaderW

Separator sets the text between path labels in the selected value, tags and search results (Element separator; default " / " as Ant's displayRender). "" joins the labels directly.

func (*CascaderW) ShowCheckedStrategy 实验性 ​

go
func (w *CascaderW) ShowCheckedStrategy(s CheckedStrategy) *CascaderW

ShowCheckedStrategy chooses the tags of multiple mode (default ShowParent: a fully checked parent replaces its children; ShowChild: every checked leaf; ShowAll: every checked node). By default the bound value holds the checked leaf paths and CheckedPaths returns the strategy's paths; with StrategyValue(true) the bound value itself follows the strategy (Ant).

func (*CascaderW) Size 实验性 ​

go
func (w *CascaderW) Size(s ControlSize) *CascaderW

func (*CascaderW) Status 实验性 ​

go
func (w *CascaderW) Status(s string) *CascaderW

func (*CascaderW) StrategyValue 实验性 ​

go
func (w *CascaderW) StrategyValue(on bool) *CascaderW

StrategyValue makes the bound value of multiple mode follow the checked strategy, as Ant's value does (ShowParent, the default, stores a fully checked parent path instead of its leaf paths). Paths written by the application are read the same way: a parent path checks its subtree. Default false: the value holds the checked leaf paths (what earlier versions stored).

func (*CascaderW) Variant 实验性 ​

go
func (w *CascaderW) Variant(v FieldVariant) *CascaderW

Variant sets the frame look (FieldOutlined by default).

func (*CascaderW) Virtual 实验性 ​

go
func (w *CascaderW) Virtual(on bool) *CascaderW

Virtual forces virtual columns on or off; by default a column (or a search result list) longer than 100 options is virtual: only its visible rows and the row on the expanded path are built. The column keeps the width, height and scroll range of the full list (its width is measured once while the column's options slice, identity and length, and the DataVersion stay the same: an option renamed in place does not change the column's width until one of them changes), but options out of view are not in the accessibility tree. Search results are matched and measured every frame. Virtual(false) builds every row.

func (*CascaderW) Width 实验性 ​

go
func (w *CascaderW) Width(px float32) *CascaderW

CellEditorTableW 实验性 ​

go
type CellEditorTableW[T any] struct {
	// contains filtered or unexported fields
}

CellEditorTableW is an editable table that edits one cell at a time (Pro Components v3 CellEditorTable): double-click a cell of a column with an Editor (or press Enter on the keyboard-active cell) to edit it; Enter or moving focus away validates that cell and saves the row, Escape cancels and drops the draft. Only the edited column is validated. It is an EditableProTable preset (same editors, validation and OnSave flow), bordered and without pagination by default.

func CellEditorTable 实验性 ​

go
func CellEditorTable[T any](c *Context, cols []ProColumn[T], rows *[]T) *CellEditorTableW[T]

CellEditorTable starts a cell-editing table over *rows; chain options, then Show.

ConfigProvider.Defaults("CellEditorTable", ...) keys: "bordered" (bool, default true), "size", "pagination" (page size or Props{"pageSize": n}; default none).

func (*CellEditorTableW[T]) Bordered 实验性 ​

go
func (w *CellEditorTableW[T]) Bordered(on bool) *CellEditorTableW[T]

Bordered turns the cell borders on or off (default on).

func (*CellEditorTableW[T]) Cancel 实验性 ​

go
func (w *CellEditorTableW[T]) Cancel()

Cancel leaves the edited cell without saving (as Escape does).

func (*CellEditorTableW[T]) Changed 实验性 ​

go
func (w *CellEditorTableW[T]) Changed() bool

Changed reports a change of *rows in the last Show.

func (*CellEditorTableW[T]) Edit 实验性 ​

go
func (w *CellEditorTableW[T]) Edit(k, col string)

Edit starts editing the cell of row key k in column col (valid after Show; ignored for a column without an Editor).

func (*CellEditorTableW[T]) EditingCell 实验性 ​

go
func (w *CellEditorTableW[T]) EditingCell() (key, col string)

EditingCell returns the row key and column key of the edited cell ("" when none).

func (*CellEditorTableW[T]) Errors 实验性 ​

go
func (w *CellEditorTableW[T]) Errors(k string) map[string]string

Errors returns the validation messages of row k by column key.

func (*CellEditorTableW[T]) ID 实验性 ​

go
func (w *CellEditorTableW[T]) ID() ID

ID returns the widget ID (valid after Show).

func (*CellEditorTableW[T]) OnSave 实验性 ​

go
func (w *CellEditorTableW[T]) OnSave(fn func(row T, index int, done func(error))) *CellEditorTableW[T]

OnSave receives the row with the validated cell applied before it is written back (see EditableProTableW.OnSave).

func (*CellEditorTableW[T]) Pagination 实验性 ​

go
func (w *CellEditorTableW[T]) Pagination(n int) *CellEditorTableW[T]

Pagination pages the rows locally, n per page (default: no pagination).

func (*CellEditorTableW[T]) RowEditable 实验性 ​

go
func (w *CellEditorTableW[T]) RowEditable(fn func(row T) bool) *CellEditorTableW[T]

RowEditable limits which rows can be edited.

func (*CellEditorTableW[T]) RowKey 实验性 ​

go
func (w *CellEditorTableW[T]) RowKey(f func(T) string) *CellEditorTableW[T]

RowKey gives rows stable keys (default: the row index).

func (*CellEditorTableW[T]) Save 实验性 ​

go
func (w *CellEditorTableW[T]) Save()

Save validates the edited cell and saves its row (as Enter does).

func (*CellEditorTableW[T]) Saved 实验性 ​

go
func (w *CellEditorTableW[T]) Saved() bool

Saved reports a row written back in the last Show.

func (*CellEditorTableW[T]) ScrollX 实验性 ​

go
func (w *CellEditorTableW[T]) ScrollX(px float32) *CellEditorTableW[T]

ScrollX sets the table's scroll width.

func (*CellEditorTableW[T]) ScrollY 实验性 ​

go
func (w *CellEditorTableW[T]) ScrollY(maxH float32) *CellEditorTableW[T]

ScrollY bounds the table body to maxH (EditableProTableW.ScrollY): only the visible rows are built. The edited cell's row is always built, even scrolled out of view, so its draft and focus survive; starting to edit it (Edit), focus moving into it (Tab), typing in it and a failed validation scroll it into view. Default 0: unbounded, every row is built.

func (*CellEditorTableW[T]) Show 实验性 ​

go
func (w *CellEditorTableW[T]) Show() *CellEditorTableW[T]

Show builds the table.

func (*CellEditorTableW[T]) Size 实验性 ​

go
func (w *CellEditorTableW[T]) Size(s ControlSize) *CellEditorTableW[T]

Size sets the density.

func (*CellEditorTableW[T]) Table 实验性 ​

go
func (w *CellEditorTableW[T]) Table() *TableW

Table returns the inner table of the last Show.

func (*CellEditorTableW[T]) Title 实验性 ​

go
func (w *CellEditorTableW[T]) Title(s string) *CellEditorTableW[T]

Title sets the toolbar title.

func (*CellEditorTableW[T]) ToolBar 实验性 ​

go
func (w *CellEditorTableW[T]) ToolBar(fn func()) *CellEditorTableW[T]

ToolBar adds actions at the right of the toolbar.

func (*CellEditorTableW[T]) Validating 实验性 ​

go
func (w *CellEditorTableW[T]) Validating(k string) bool

Validating reports async validation or a save in flight for row k.

func (*CellEditorTableW[T]) Virtual 实验性 ​

go
func (w *CellEditorTableW[T]) Virtual() *CellEditorTableW[T]

Virtual is TableW.Virtual for the inner table (see EditableProTableW.Virtual): with ScrollY the body is windowed either way; rows keep the height of the density (Size) unless the theme has a Table V2 row height (Element Plus).

ChainItem 实验性 ​

go
type ChainItem struct {
	Key         string // stable key (default: the index)
	Title       string
	Description string        // secondary line under the title
	Status      ChainStatus   //
	Duration    time.Duration // shown at the end (0: hidden)
	Started     time.Time     // a running step shows the time elapsed since then
	Detail      string        // collapsible Markdown detail
	Content     func()        // collapsible custom detail (instead of Detail)
	// contains filtered or unexported fields
}

ChainItem is one step of a ThoughtChain.

ChainStatus 实验性 ​

go
type ChainStatus uint8

ChainStatus is the state of a step or tool call.

go
const (
	ChainPending ChainStatus = iota // not started
	ChainRunning                    // in progress (spinner, live duration)
	ChainSuccess
	ChainError
)

实验性

ChartLocale 实验性 ​

go
type ChartLocale struct {
	Line, Area, Column, Bar, Pie, Donut, Scatter, Radar, Gauge, Funnel, Heatmap, DualAxes, Liquid, Sparkline string
	SummaryFmt                                                                                               string // args: kind, series count, point count ("%[1]s,%[2]d 个系列,%[3]d 个数据点")
	XRangeFmt                                                                                                string // appended to the summary, args: first, last x (";横轴从 %s 到 %s")
	YRangeFmt                                                                                                string // appended to the summary, args: min, max value (";数值从 %s 到 %s")
	ValueFmt                                                                                                 string // single-value charts, args: kind, value ("%s:%s")
	Total                                                                                                    string // pie / donut centre title ("总计")
	Conversion                                                                                               string // funnel conversion-rate label ("转化率")
	// contains filtered or unexported fields
}

ChartLocale holds the accessible names and summaries of ui/chart charts: the chart kinds (default names) and the summary read as the description.

ChatAttachment 实验性 ​

go
type ChatAttachment struct {
	Name    string
	Size    int64       // bytes (0: not shown)
	Image   image.Image // thumbnail of an image (nil: file icon)
	Status  string      // "" ready, "uploading" or "error"
	Percent float32     // upload progress 0..100 while uploading
	// contains filtered or unexported fields
}

ChatAttachment is a file attached to a message being composed.

ChatLocale 实验性 ​

go
type ChatLocale struct {
	User, Assistant, System string // role names (accessible names of bubbles)
	Messages                string // accessible name of a BubbleList
	ScrollToBottom          string // BubbleList "back to bottom" button
	Thinking                string // loading bubble (accessible name)
	Generating              string // streaming bubble (accessible description)

	Placeholder         string // Sender placeholder
	Send, Stop, Attach  string // Sender buttons
	Suggestions         string // accessible name of the @ / command popup
	Uploading, Failed   string // attachment states
	EditPlaceholder     string // inline edit of a user message
	Pending, Running    string // step states
	Done, Error         string
	StepsFmt            string // chain progress, args: done, total ("%d/%d")
	SecondsFmt          string // duration under a minute, arg: seconds as float ("%.1fs")
	MinutesFmt          string // longer duration, args: minutes, seconds ("%dm %ds")
	ToolCall            string // accessible name prefix of a tool card
	Arguments, Result   string // tool card sections
	ApprovalTitle       string // default Approval title
	AllowOnce           string
	AllowSession        string
	AllowAlways         string
	Deny                string
	Allowed, Denied     string // decided Approval
	FeedbackPlaceholder string // optional note sent with a decision
	RiskWarning         string // risk tag of a warning-level request
	RiskDanger          string // risk tag of a dangerous request
	Conversations       string // accessible name of the list
	Rename              string
	Untitled            string // conversation without a title
	Today, Yesterday    string // time groups
	Last7Days           string
	Last30Days          string
	Earlier             string
	Prompts             string // accessible name of a Prompts group
	// contains filtered or unexported fields
}

ChatLocale holds the texts of the AI chat components (Bubble, BubbleList, Sender, ThoughtChain, ToolCall, Approval, Conversations, Prompts). Copy, Copied, Retry, Edit, Save and Cancel come from the common Locale fields.

ChatRole 实验性 ​

go
type ChatRole uint8

ChatRole is the author of a chat message.

go
const (
	ChatAssistant ChatRole = iota // start-aligned, Markdown content
	ChatUser                      // end-aligned filled bubble, plain text
	ChatSystem                    // centered notice without avatar
)

实验性

CheckAllW 实验性 ​

go
type CheckAllW struct {
	// contains filtered or unexported fields
}

CheckAllW is the select-all group CheckAll returns.

func CheckAll 实验性 ​

go
func CheckAll(c *Context, selected *[]string, opts []Option) *CheckAllW

CheckAll renders a "全选" checkbox (indeterminate when only part of the options is selected) above a checkbox group bound to *selected. Disabled options keep their state. Changed on the result reports a selection change.

func (*CheckAllW) Changed 实验性 ​

go
func (w *CheckAllW) Changed() bool

Changed reports whether the selection changed this frame.

CheckCardGroupW 实验性 ​

go
type CheckCardGroupW struct {
	// contains filtered or unexported fields
}

CheckCardGroupW builds a single- or multiple-choice card group.

func CheckCardGroup 实验性 ​

go
func CheckCardGroup(c *Context, opts []CheckCardOption) *CheckCardGroupW

CheckCardGroup starts a group. Value / Values bind application state; without a binding the group owns its state, initialized by DefaultValue or DefaultValues. Values also selects multiple-choice mode.

func (*CheckCardGroupW) Body 实验性 ​

go
func (g *CheckCardGroupW) Body(fn func()) *CheckCardGroupW

Body builds custom CheckCards linked to this group by Value.

func (*CheckCardGroupW) Borderless 实验性 ​

go
func (g *CheckCardGroupW) Borderless() *CheckCardGroupW

Borderless removes option card borders.

func (*CheckCardGroupW) Changed 实验性 ​

go
func (g *CheckCardGroupW) Changed() bool

Changed reports a user selection change this frame.

func (*CheckCardGroupW) DefaultValue 实验性 ​

go
func (g *CheckCardGroupW) DefaultValue(v string) *CheckCardGroupW

DefaultValue sets the initial single selection, ignored when bound.

func (*CheckCardGroupW) DefaultValues 实验性 ​

go
func (g *CheckCardGroupW) DefaultValues(v ...string) *CheckCardGroupW

DefaultValues sets initial multiple selections, ignored when bound.

func (*CheckCardGroupW) Disabled 实验性 ​

go
func (g *CheckCardGroupW) Disabled(on bool) *CheckCardGroupW

Disabled disables every card.

func (*CheckCardGroupW) Layout 实验性 ​

go
func (g *CheckCardGroupW) Layout(opts ...layout.Option) *CheckCardGroupW

Layout sets wrapping-row layout options.

func (*CheckCardGroupW) Loading 实验性 ​

go
func (g *CheckCardGroupW) Loading(on bool) *CheckCardGroupW

Loading shows noninteractive, unchecked loading placeholders.

func (*CheckCardGroupW) Multiple 实验性 ​

go
func (g *CheckCardGroupW) Multiple() *CheckCardGroupW

Multiple enables multiple choices with internally owned state.

func (*CheckCardGroupW) Selected 实验性 ​

go
func (g *CheckCardGroupW) Selected() string

Selected reports the single selection after Show / Body.

func (*CheckCardGroupW) SelectedValues 实验性 ​

go
func (g *CheckCardGroupW) SelectedValues() []string

SelectedValues reports a copy of the multiple selections after Show / Body.

func (*CheckCardGroupW) Show 实验性 ​

go
func (g *CheckCardGroupW) Show() *CheckCardGroupW

Show renders the configured options.

func (*CheckCardGroupW) Size 实验性 ​

go
func (g *CheckCardGroupW) Size(s ControlSize) *CheckCardGroupW

Size sets the group size.

func (*CheckCardGroupW) Value 实验性 ​

go
func (g *CheckCardGroupW) Value(v *string) *CheckCardGroupW

Value binds the single choice. Re-clicking a selected card clears it.

func (*CheckCardGroupW) Values 实验性 ​

go
func (g *CheckCardGroupW) Values(v *[]string) *CheckCardGroupW

Values binds multiple choices, maintained in option order.

func (*CheckCardGroupW) Width 实验性 ​

go
func (g *CheckCardGroupW) Width(px float32) *CheckCardGroupW

Width overrides every option card's width.

CheckCardOption 实验性 ​

go
type CheckCardOption struct {
	Value       string
	Title       string
	Description string
	Avatar      string     // text avatar (first character)
	Icon        *icon.Icon // icon avatar
	Disabled    bool
	Size        ControlSize // zero without SizeSet: inherit group size
	SizeSet     bool        // allows explicit Middle to override the group size
	Cover       func()
	Children    []CheckCardOption
	// contains filtered or unexported fields
}

CheckCardOption is one card of a CheckCardGroup.

CheckCardW 实验性 ​

go
type CheckCardW struct {
	// contains filtered or unexported fields
}

CheckCardW builds a checkable card.

func CheckCard 实验性 ​

go
func CheckCard(c *Context, title string, checked *bool) *CheckCardW

CheckCard starts a checkable card bound to checked; chain options, then Show.

func (*CheckCardW) Actions 实验性 ​

go
func (w *CheckCardW) Actions(fns ...func()) *CheckCardW

Actions builds the bottom action bar.

func (*CheckCardW) Avatar 实验性 ​

go
func (w *CheckCardW) Avatar(s string) *CheckCardW

Avatar shows a text avatar (first character) left of the title.

func (*CheckCardW) AvatarIcon 实验性 ​

go
func (w *CheckCardW) AvatarIcon(ic *icon.Icon) *CheckCardW

AvatarIcon shows an icon avatar left of the title.

func (*CheckCardW) Borderless 实验性 ​

go
func (w *CheckCardW) Borderless() *CheckCardW

Borderless removes the border (the checked state still colors it).

func (*CheckCardW) Changed 实验性 ​

go
func (w *CheckCardW) Changed() bool

Changed reports a toggle by the user this frame (after Show).

func (*CheckCardW) Clicked 实验性 ​

go
func (w *CheckCardW) Clicked() bool

Clicked reports a click this frame (after Show).

func (*CheckCardW) Content 实验性 ​

go
func (w *CheckCardW) Content(fn func()) *CheckCardW

Content builds body content below the card's metadata.

func (*CheckCardW) Cover 实验性 ​

go
func (w *CheckCardW) Cover(fn func()) *CheckCardW

Cover replaces the content with fn (an image or any block).

func (*CheckCardW) DefaultChecked 实验性 ​

go
func (w *CheckCardW) DefaultChecked(on bool) *CheckCardW

DefaultChecked sets the initial checked state when checked is nil.

func (*CheckCardW) Description 实验性 ​

go
func (w *CheckCardW) Description(s string) *CheckCardW

Description sets the secondary text under the title.

func (*CheckCardW) Disabled 实验性 ​

go
func (w *CheckCardW) Disabled(on bool) *CheckCardW

Disabled disables the card.

func (*CheckCardW) Extra 实验性 ​

go
func (w *CheckCardW) Extra(fn func()) *CheckCardW

Extra builds content at the top right.

func (*CheckCardW) ID 实验性 ​

go
func (w *CheckCardW) ID() ID

ID returns the card's widget ID (after Show).

func (*CheckCardW) IsChecked 实验性 ​

go
func (w *CheckCardW) IsChecked() bool

IsChecked reports the current selection after Show.

func (*CheckCardW) Large 实验性 ​

go
func (w *CheckCardW) Large() *CheckCardW

Large is Size(Large).

func (*CheckCardW) Loading 实验性 ​

go
func (w *CheckCardW) Loading(on bool) *CheckCardW

Loading shows a skeleton instead of the content.

func (*CheckCardW) Show 实验性 ​

go
func (w *CheckCardW) Show() *CheckCardW

Show builds the card and toggles it on click / Enter / Space.

func (*CheckCardW) Size 实验性 ​

go
func (w *CheckCardW) Size(s ControlSize) *CheckCardW

Size sets the size: Small (212px), Middle (320px) or Large (440px).

func (*CheckCardW) Small 实验性 ​

go
func (w *CheckCardW) Small() *CheckCardW

Small is Size(Small).

func (*CheckCardW) SubTitle 实验性 ​

go
func (w *CheckCardW) SubTitle(s string) *CheckCardW

SubTitle sets text beside the title.

func (*CheckCardW) Value 实验性 ​

go
func (w *CheckCardW) Value(s string) *CheckCardW

Value sets this card's key when built in CheckCardGroup.Body.

func (*CheckCardW) Width 实验性 ​

go
func (w *CheckCardW) Width(px float32) *CheckCardW

Width overrides the width of the size.

CheckableTagGroupW 实验性 ​

go
type CheckableTagGroupW struct {
	// contains filtered or unexported fields
}

CheckableTagGroupW is a row of checkable tags bound to the selected values.

func CheckableTagGroup 实验性 ​

go
func CheckableTagGroup(c *Context, selected *[]string, opts []Option) *CheckableTagGroupW

CheckableTagGroup renders one CheckableTag per option bound to *selected. Single selection by default: checking a tag replaces the value, unchecking it clears the value (antd value null); Multiple toggles each value. Tags wrap with a gap of 8 (antd paddingXS). A nil selected shows nothing checked and ignores clicks.

ConfigProvider.Defaults("CheckableTagGroup", ...) keys: "multiple" (bool).

func (*CheckableTagGroupW) A11yLabel 实验性 ​

go
func (g *CheckableTagGroupW) A11yLabel(s string) *CheckableTagGroupW

A11yLabel names the group for screen readers.

func (*CheckableTagGroupW) Changed 实验性 ​

go
func (g *CheckableTagGroupW) Changed() bool

Changed reports a selection change this frame.

func (*CheckableTagGroupW) Disabled 实验性 ​

go
func (g *CheckableTagGroupW) Disabled(on bool) *CheckableTagGroupW

Disabled disables every tag of the group.

func (*CheckableTagGroupW) Multiple 实验性 ​

go
func (g *CheckableTagGroupW) Multiple(on bool) *CheckableTagGroupW

Multiple allows several checked tags.

CheckableTagW 实验性 ​

go
type CheckableTagW struct {
	// contains filtered or unexported fields
}

CheckableTagW is a tag that toggles between checked and unchecked.

func CheckableTag 实验性 ​

go
func CheckableTag(c *Context, label string, checked *bool) *CheckableTagW

CheckableTag adds a tag bound to *checked; clicking (or Enter/Space when focused) toggles it.

func (*CheckableTagW) A11yLabel 实验性 ​

go
func (w *CheckableTagW) A11yLabel(s string) *CheckableTagW

A11yLabel sets the accessible name (needed for an icon-only tag).

func (*CheckableTagW) Changed 实验性 ​

go
func (w *CheckableTagW) Changed() bool

Changed reports a toggle this frame.

func (*CheckableTagW) Checked 实验性 ​

go
func (w *CheckableTagW) Checked() bool

Checked reports the current value.

func (*CheckableTagW) Disabled 实验性 ​

go
func (w *CheckableTagW) Disabled(on bool) *CheckableTagW

Disabled blocks toggling when on.

func (*CheckableTagW) Icon 实验性 ​

go
func (w *CheckableTagW) Icon(ic *icon.Icon) *CheckableTagW

Icon puts an icon before the label.

func (*CheckableTagW) Type 实验性 ​

go
func (w *CheckableTagW) Type(status string) *CheckableTagW

Type tints the checked state with a status palette ("primary" default, "success", "warning", "error", "info"). Element Plus also tints the unchecked state.

CheckboxGroupW ​

go
type CheckboxGroupW struct {
	// contains filtered or unexported fields
}

CheckboxGroupW is the checkbox group CheckboxGroup returns.

func CheckboxGroup ​

go
func CheckboxGroup(c *Context, selected *[]string, opts []Option) *CheckboxGroupW

CheckboxGroup renders one checkbox per option bound to the selected values. Changed on the result reports a selection change; the builder also takes Disabled, Min/Max, Border, Buttons and Size.

func (*CheckboxGroupW) A11yLabel ​

go
func (g *CheckboxGroupW) A11yLabel(s string) *CheckboxGroupW

A11yLabel names the group for screen readers.

func (*CheckboxGroupW) Border ​

go
func (g *CheckboxGroupW) Border() *CheckboxGroupW

Border draws every checkbox with a frame (see CheckboxW.Border).

func (*CheckboxGroupW) Buttons ​

go
func (g *CheckboxGroupW) Buttons() *CheckboxGroupW

Buttons renders the options as a row of joined toggle buttons (Element el-checkbox-button).

func (*CheckboxGroupW) Changed ​

go
func (g *CheckboxGroupW) Changed() bool

Changed reports a selection change this frame.

func (*CheckboxGroupW) Disabled ​

go
func (g *CheckboxGroupW) Disabled(on bool) *CheckboxGroupW

Disabled disables every checkbox of the group.

func (*CheckboxGroupW) Max ​

go
func (g *CheckboxGroupW) Max(n int) *CheckboxGroupW

Max allows at most n selected values: once n are checked the others are disabled (0 = no maximum).

func (*CheckboxGroupW) Min ​

go
func (g *CheckboxGroupW) Min(n int) *CheckboxGroupW

Min keeps at least n values selected: while only n are checked they cannot be unchecked (0 = no minimum).

func (*CheckboxGroupW) Size ​

go
func (g *CheckboxGroupW) Size(s ControlSize) *CheckboxGroupW

Size sets the size of the checkboxes.

CheckboxW ​

go
type CheckboxW struct {
	// contains filtered or unexported fields
}

CheckboxW is a checkbox with a label.

func Checkbox ​

go
func Checkbox(c *Context, label string, val *bool) *CheckboxW

Checkbox adds a checkbox bound to *val.

func (*CheckboxW) A11yLabel ​

go
func (w *CheckboxW) A11yLabel(s string) *CheckboxW

A11yLabel sets the accessible name of a checkbox without a visible label.

func (*CheckboxW) Border ​

go
func (w *CheckboxW) Border() *CheckboxW

Border draws a frame around the box and the label (Element el-checkbox border); a checked one gets a brand-colored frame.

func (*CheckboxW) Button ​

go
func (w *CheckboxW) Button() *CheckboxW

Button renders the checkbox as a toggle button without a box (Element el-checkbox-button); checked buttons take the brand color. Inside CheckboxGroup(...).Buttons() the buttons join into a segmented row.

func (*CheckboxW) Changed ​

go
func (w *CheckboxW) Changed() bool

Changed reports a toggle this frame.

func (*CheckboxW) Disabled ​

go
func (w *CheckboxW) Disabled(on bool) *CheckboxW

func (*CheckboxW) Indeterminate ​

go
func (w *CheckboxW) Indeterminate(on bool) *CheckboxW

func (*CheckboxW) Size ​

go
func (w *CheckboxW) Size(s ControlSize) *CheckboxW

Size sets the checkbox size: the label font, the box (Element shrinks it when small) and the height of the Border / Button styles.

func (*CheckboxW) Status ​

go
func (w *CheckboxW) Status(s string) *CheckboxW

Status sets the validation status ("error" marks the box invalid; inside a failing FormItem it is set automatically).

CheckedStrategy 实验性 ​

go
type CheckedStrategy int

CheckedStrategy chooses which checked nodes of a tree-shaped multiple selection (Cascader, TreeSelect) are shown as tags and returned by Checked (Ant showCheckedStrategy).

Append-only: never reorder or insert; the zero value stays ShowChild.

go
const (
	// ShowChild shows every checked leaf.
	ShowChild CheckedStrategy = iota
	// ShowParent shows a fully checked parent instead of its children.
	ShowParent
	// ShowAll shows every checked node, parents and children.
	ShowAll
)

实验性

CodeBlockLocale 实验性 ​

go
type CodeBlockLocale struct {
	Code string // accessible name of a block without title or language
	// contains filtered or unexported fields
}

CodeBlockLocale holds the CodeBlock texts (the copy button uses Markdown.CopyCode and Markdown.Copied).

CodeBlockMatch 实验性 ​

go
type CodeBlockMatch struct {
	Start, End int
}

CodeBlockMatch is a half-open UTF-8 byte range in the code after CRLF and CR line endings have been normalized to LF.

CodeBlockW 实验性 ​

go
type CodeBlockW struct {
	// contains filtered or unexported fields
}

CodeBlockW is a read-only code viewer. Long lines scroll sideways; a block taller than its Height / MaxHeight scrolls and only the visible lines are shaped, so it stays fast for files of hundreds of thousands of lines. The text is selectable (drag, double click a word, triple click or click the line number for a line, Cmd/Ctrl+A) and copies with Cmd/Ctrl+C; the copy button copies everything.

func CodeBlock 实验性 ​

go
func CodeBlock(c *Context, code string, opts ...layout.Option) *CodeBlockW

CodeBlock adds a read-only code block for code (lines separated by "\n"; "\r\n" is accepted).

ui.CodeBlock(c, src).Lang("go").LineNumbers(true).MaxHeight(400)

func (*CodeBlockW) A11yLabel 实验性 ​

go
func (w *CodeBlockW) A11yLabel(s string) *CodeBlockW

A11yLabel sets the accessible name of the code area (default: the title or language).

func (*CodeBlockW) ActiveMatch 实验性 ​

go
func (w *CodeBlockW) ActiveMatch(index int) *CodeBlockW

ActiveMatch marks and reveals the zero-based search result at index when the index or result set changes. Pass -1 to clear the active highlight.

func (*CodeBlockW) Copied 实验性 ​

go
func (w *CodeBlockW) Copied() bool

Copied reports a click on the copy button this frame.

func (*CodeBlockW) HeaderStyle 实验性 ​

go
func (w *CodeBlockW) HeaderStyle(style CodeHeaderStyle) *CodeBlockW

HeaderStyle styles the header. An untitled block with a copy button also gets a header when this option is set.

func (*CodeBlockW) Height 实验性 ​

go
func (w *CodeBlockW) Height(px float32) *CodeBlockW

Height fixes the height of the code area (it scrolls).

func (*CodeBlockW) HighlightLines 实验性 ​

go
func (w *CodeBlockW) HighlightLines(lines ...int) *CodeBlockW

HighlightLines tints lines (numbers as shown, see StartLine).

func (*CodeBlockW) Highlighter 实验性 ​

go
func (w *CodeBlockW) Highlighter(h CodeHighlighter) *CodeBlockW

Highlighter sets the highlighter (default DefaultCodeHighlighter; nil: plain text).

func (*CodeBlockW) ID 实验性 ​

go
func (w *CodeBlockW) ID() ID

ID returns the block's ID.

func (*CodeBlockW) Lang 实验性 ​

go
func (w *CodeBlockW) Lang(lang string) *CodeBlockW

Lang sets the language for highlighting: an id, alias or file extension ("go", "ts", "python" …).

func (*CodeBlockW) Layout 实验性 ​

go
func (w *CodeBlockW) Layout(opts ...layout.Option) *CodeBlockW

Layout applies layout options to the block.

func (*CodeBlockW) LineNumbers 实验性 ​

go
func (w *CodeBlockW) LineNumbers(on bool) *CodeBlockW

LineNumbers shows the line-number gutter.

func (*CodeBlockW) MaxHeight 实验性 ​

go
func (w *CodeBlockW) MaxHeight(px float32) *CodeBlockW

MaxHeight lets the code area grow with its lines up to px, then scroll. Without Height or MaxHeight the block is as tall as its code.

func (*CodeBlockW) NoCopy 实验性 ​

go
func (w *CodeBlockW) NoCopy() *CodeBlockW

NoCopy hides the copy button.

func (*CodeBlockW) Reveal 实验性 ​

go
func (w *CodeBlockW) Reveal(offset int) *CodeBlockW

Reveal scrolls to a UTF-8 byte offset in the normalized code. Call this modifier in response to a navigation action. Offsets outside the document are clamped; offsets inside a rune move to its start.

func (*CodeBlockW) Search 实验性 ​

go
func (w *CodeBlockW) Search(query string, caseSensitive bool) *CodeBlockW

Search highlights non-overlapping literal matches throughout the code. An empty query clears the highlights. Use SearchMatches to read the ranges.

func (*CodeBlockW) SearchLimit 实验性 ​

go
func (w *CodeBlockW) SearchLimit(limit int) *CodeBlockW

SearchLimit caps the number of retained results in document order. Zero keeps all results, as in Search without this option.

func (*CodeBlockW) SearchMatchCount 实验性 ​

go
func (w *CodeBlockW) SearchMatchCount() (count int, capped bool)

SearchMatchCount returns the number of retained matches without copying their ranges. Capped is true if additional matches were found.

func (*CodeBlockW) SearchMatches 实验性 ​

go
func (w *CodeBlockW) SearchMatches() []CodeBlockMatch

SearchMatches returns a copy of the matches in document order.

func (*CodeBlockW) Selection 实验性 ​

go
func (w *CodeBlockW) Selection() string

Selection returns the selected text ("" if none).

func (*CodeBlockW) StartLine 实验性 ​

go
func (w *CodeBlockW) StartLine(n int) *CodeBlockW

StartLine sets the number of the first line (default 1).

func (*CodeBlockW) TextID 实验性 ​

go
func (w *CodeBlockW) TextID() ID

TextID returns the keyboard focus target for the selectable, read-only text. Call it after configuring the block, then pass the ID to Context.SetFocus to restore focus when a related control, such as a find panel, closes.

func (*CodeBlockW) Title 实验性 ​

go
func (w *CodeBlockW) Title(s string) *CodeBlockW

Title shows a header row with title (a file name, the language …) and the copy button.

func (*CodeBlockW) VisibleStartByte 实验性 ​

go
func (w *CodeBlockW) VisibleStartByte() (offset int, ok bool)

VisibleStartByte returns the normalized source byte offset of the first visible visual row from the last painted frame. CRLF and CR count as one LF byte. The result is unavailable until the current source and wrap setting have been painted.

func (*CodeBlockW) Wrap 实验性 ​

go
func (w *CodeBlockW) Wrap(on bool) *CodeBlockW

Wrap wraps long lines instead of scrolling sideways.

CodeDocument 实验性 ​

go
type CodeDocument interface {
	// Line appends the spans of line i (0-based) to dst[:0]: in order,
	// not overlapping, gaps are plain text. It reports whether they are
	// final; spans that are not final are a guess made while the lines
	// above are still being tokenized, and the viewer asks again in a
	// later frame.
	Line(i int, dst []CodeSpan) ([]CodeSpan, bool)
}

CodeDocument is the highlighting of one immutable piece of code.

CodeHeaderStyle 实验性 ​

go
type CodeHeaderStyle struct {
	Padding  geom.Insets // logical pixels around the header contents
	Divider  theme.Color // 1px separator, omitted when transparent
	Mono     bool        // use monospace for the title or language
	TextCopy bool        // show the localized Copy label instead of an icon
}

CodeHeaderStyle styles the header shared by CodeBlock and Markdown fences.

CodeHighlighter 实验性 ​

go
type CodeHighlighter interface {
	// Document prepares the highlighting of code (lines separated by
	// "\n") in language lang: a language id, alias or file extension
	// ("go", "ts", "python", "sh" …). It returns nil when the language is
	// unknown, and the code is shown as plain text.
	Document(lang, code string) CodeDocument
}

CodeHighlighter splits code into highlighted spans by language. Implementations must be safe for use from the UI thread of several windows.

func DefaultCodeHighlighter 实验性 ​

go
func DefaultCodeHighlighter() CodeHighlighter

DefaultCodeHighlighter returns the highlighter installed with SetCodeHighlighter (nil if none).

CodeSpan 实验性 ​

go
type CodeSpan struct {
	Start, End int
	Kind       CodeTokenKind
}

CodeSpan is a highlighted piece of one line: bytes [Start, End) of the line (without its "\n").

CodeTokenKind 实验性 ​

go
type CodeTokenKind uint8

CodeTokenKind classifies a span of highlighted code.

Append-only: new kinds go at the end.

go
const (
	CodePlain CodeTokenKind = iota
	CodeKeyword
	CodeString
	CodeNumber
	CodeComment
	CodeType
	CodeFunction
	CodeVariable
	CodeConstant
	CodeOperator
	CodePunctuation
	CodeTag
	CodeAttribute
	CodeProperty
	CodeRegexp
	CodeInvalid
)

The token kinds; CodePlain is unhighlighted text.

实验性

CollapseItem ​

go
type CollapseItem struct {
	Key      string
	Label    string
	Extra    func() // content at the inline end of the header
	Body     func()
	Disabled bool
	NoArrow  bool
	// Collapsible overrides the group's Collapsible for this panel:
	// "header" (only the title and the arrow toggle), "icon" (only the
	// arrow toggles) or "disabled"; "" uses the group's mode.
	Collapsible string
}

CollapseItem is one panel of a Collapse.

CollapseW ​

go
type CollapseW struct {
	// contains filtered or unexported fields
}

CollapseW is an accordion / collapse panel group.

func Collapse ​

go
func Collapse(c *Context, active *[]string, items []CollapseItem) *CollapseW

Collapse starts a collapse group bound to the app's open panel keys. Configure with chained modifiers and finish with Show.

func (*CollapseW) Accordion ​

go
func (w *CollapseW) Accordion() *CollapseW

Accordion keeps at most one panel open.

func (*CollapseW) BeforeCollapse ​

go
func (w *CollapseW) BeforeCollapse(fn func(key string) bool) *CollapseW

BeforeCollapse is asked before a panel opens or closes (Element before-collapse); returning false keeps the panel as it is.

func (*CollapseW) Borderless ​

go
func (w *CollapseW) Borderless() *CollapseW

Borderless removes the outer border (Ant bordered={false}).

func (*CollapseW) Changed ​

go
func (w *CollapseW) Changed() bool

Changed reports a panel toggle in the last Show.

func (*CollapseW) Collapsible ​

go
func (w *CollapseW) Collapsible(mode string) *CollapseW

Collapsible sets which part of every header toggles its panel (antd collapsible): "" the whole header, "header" only the title and the arrow, "icon" only the arrow, "disabled" nothing. CollapseItem.Collapsible overrides it per panel.

func (*CollapseW) ExpandIcon ​

go
func (w *CollapseW) ExpandIcon(ic *icon.Icon) *CollapseW

ExpandIcon replaces the expand arrow (antd expandIcon, Element icon). It points to the inline end when closed and turns 90° when open.

func (*CollapseW) ExpandIconPlacement ​

go
func (w *CollapseW) ExpandIconPlacement(p string) *CollapseW

ExpandIconPlacement places the expand arrow: "start" (before the label, Ant's default) or "end" (Element and shadcn's default); antd expandIconPlacement, Element expand-icon-position ("left" / "right" are accepted too). Other values keep the theme's default.

func (*CollapseW) Ghost ​

go
func (w *CollapseW) Ghost() *CollapseW

Ghost makes the panels transparent and borderless.

func (*CollapseW) IconEnd ​

go
func (w *CollapseW) IconEnd() *CollapseW

IconEnd puts the expand arrow at the end of the header (Element's default).

Deprecated: use ExpandIconPlacement("end").

func (*CollapseW) IconStart ​

go
func (w *CollapseW) IconStart() *CollapseW

IconStart puts the expand arrow before the label (Ant's default).

Deprecated: use ExpandIconPlacement("start").

func (*CollapseW) IsOpen ​

go
func (w *CollapseW) IsOpen(key string) bool

IsOpen reports whether key is open. In accordion mode only the first active key counts (rc-collapse useItems: activeKey[0]).

func (*CollapseW) Layout ​

go
func (w *CollapseW) Layout(o ...layout.Option) *CollapseW

Layout applies layout options to the group (call after Show).

func (*CollapseW) Show ​

go
func (w *CollapseW) Show() *CollapseW

Show builds the panels.

func (*CollapseW) Size ​

go
func (w *CollapseW) Size(s ControlSize) *CollapseW

Size sets header padding (Small / Middle / Large).

ColorPickerLocale 实验性 ​

go
type ColorPickerLocale struct {
	Presets, None, ClearColor, Clear, Saturation, Hue, Alpha string
	Format                                                   string // accessible name of the HEX / RGB format select
	Value                                                    string // accessible name of the value input of ColorPickerPanel ("颜色值")
	Gradient                                                 string // the gradient stop bar of ColorPickerGradient ("渐变色标")
	Angle                                                    string // the gradient angle input ("角度")
	// contains filtered or unexported fields
}

ColorPickerLocale holds the ColorPicker panel texts.

ColorPickerPanelW 实验性 ​

go
type ColorPickerPanelW struct {
	// contains filtered or unexported fields
}

ColorPickerPanelW is an inline color panel bound to a color.

func ColorPickerPanel 实验性 ​

go
func ColorPickerPanel(c *Context, val *theme.Color) *ColorPickerPanelW

ColorPickerPanel adds an inline color panel bound to *val; changes apply immediately in every design system (there is no confirm step).

ui.ColorPickerPanel(c, &col).Presets(theme.Hex("#409eff"), theme.Hex("#67c23a"))

func ColorPickerPanelGradient 实验性 ​

go
func ColorPickerPanelGradient(c *Context, val *theme.Gradient) *ColorPickerPanelW

ColorPickerPanelGradient adds an inline panel bound to a linear gradient: the stop bar and angle input of ColorPickerGradient above the editors of the selected stop's color. ColorPickerPanel (single color) is unchanged.

ui.ColorPickerPanelGradient(c, &g).NoAlpha()

func (*ColorPickerPanelW) AllowClear 实验性 ​

go
func (w *ColorPickerPanelW) AllowClear() *ColorPickerPanelW

AllowClear adds the "no color" control (Ant).

func (*ColorPickerPanelW) Border 实验性 ​

go
func (w *ColorPickerPanelW) Border(on bool) *ColorPickerPanelW

Border toggles the panel border (default on).

func (*ColorPickerPanelW) Changed 实验性 ​

go
func (w *ColorPickerPanelW) Changed() bool

Changed reports a new color this frame.

func (*ColorPickerPanelW) Disabled 实验性 ​

go
func (w *ColorPickerPanelW) Disabled(on bool) *ColorPickerPanelW

Disabled turns the panel off.

func (*ColorPickerPanelW) DisabledFormat 实验性 ​

go
func (w *ColorPickerPanelW) DisabledFormat(on bool) *ColorPickerPanelW

DisabledFormat leaves the format select out (Ant disabledFormat).

func (*ColorPickerPanelW) Format 实验性 ​

go
func (w *ColorPickerPanelW) Format(f string) *ColorPickerPanelW

Format sets the value text format: "hex" (default), "rgb", "hsb" or "hsv".

func (*ColorPickerPanelW) ID 实验性 ​

go
func (w *ColorPickerPanelW) ID() ID

ID returns the panel's ID.

func (*ColorPickerPanelW) NoAlpha 实验性 ​

go
func (w *ColorPickerPanelW) NoAlpha() *ColorPickerPanelW

NoAlpha hides the alpha bar and input.

func (*ColorPickerPanelW) PresetGroups 实验性 ​

go
func (w *ColorPickerPanelW) PresetGroups(groups ...ColorPresetGroup) *ColorPickerPanelW

PresetGroups shows several titled preset groups (see ColorPickerW.PresetGroups).

func (*ColorPickerPanelW) PresetLabel 实验性 ​

go
func (w *ColorPickerPanelW) PresetLabel(s string) *ColorPickerPanelW

PresetLabel names the preset group (Ant).

func (*ColorPickerPanelW) Presets 实验性 ​

go
func (w *ColorPickerPanelW) Presets(cols ...theme.Color) *ColorPickerPanelW

Presets adds preset swatches (Element predefine, Ant presets).

ColorPickerW 实验性 ​

go
type ColorPickerW struct {
	// contains filtered or unexported fields
}

ColorPickerW is a color input with a picker panel.

func ColorPicker 实验性 ​

go
func ColorPicker(c *Context, val *theme.Color) *ColorPickerW

ColorPicker adds a color picker bound to *val. The zero Color means "no color" (cleared).

func ColorPickerGradient 实验性 ​

go
func ColorPickerGradient(c *Context, val *theme.Gradient) *ColorPickerW

ColorPickerGradient adds a color picker bound to a linear gradient (Ant mode="gradient"): the trigger shows the gradient, and the panel adds a stop bar and an angle input above the usual editors, which edit the color of the selected stop. On the stop bar a press on empty rail adds a stop (with the gradient's color there), dragging a handle moves it and dragging it away from the bar removes it (at least two stops stay); from the keyboard Left / Right move the selected stop, Up / Down select the previous / next one, Enter or Insert adds one after it and Delete / Backspace removes it. Changes apply at once in every design system. The zero Gradient means "no color"; editing a color then creates two stops of that color. The single-color ColorPicker is unchanged.

g := theme.Gradient{Angle: 90, Stops: []theme.GradientStop{{0, theme.Hex("#1677ff")}, {1, theme.Hex("#722ed1")}}}
ui.ColorPickerGradient(c, &g).ShowText()

func (*ColorPickerW) A11yLabel 实验性 ​

go
func (w *ColorPickerW) A11yLabel(s string) *ColorPickerW

A11yLabel sets the accessible name (default: the Locale's A11y.Color; inside a FormItem the item label).

func (*ColorPickerW) AllowClear 实验性 ​

go
func (w *ColorPickerW) AllowClear() *ColorPickerW

AllowClear adds a clear control (Element always has one).

func (*ColorPickerW) Changed 实验性 ​

go
func (w *ColorPickerW) Changed() bool

Changed reports a new color this frame (Element: on confirm or clear).

func (*ColorPickerW) Cleared 实验性 ​

go
func (w *ColorPickerW) Cleared() bool

Cleared reports that the value was cleared this frame.

func (*ColorPickerW) Disabled 实验性 ​

go
func (w *ColorPickerW) Disabled(on bool) *ColorPickerW

func (*ColorPickerW) DisabledFormat 实验性 ​

go
func (w *ColorPickerW) DisabledFormat(on bool) *ColorPickerW

DisabledFormat leaves the format select out of the panel (Ant disabledFormat): the value is edited in the current Format only.

func (*ColorPickerW) Format 实验性 ​

go
func (w *ColorPickerW) Format(f string) *ColorPickerW

Format sets the value text and input format: "hex", "rgb", or "hsb" / "hsv" (the same color space, written "hsb(220, 75%, 80%)" / "hsv(...)"; Ant's panel then edits hue, saturation and brightness). Typed text is accepted in any of these forms.

func (*ColorPickerW) IsOpen 实验性 ​

go
func (w *ColorPickerW) IsOpen() bool

IsOpen reports whether the panel is shown.

func (*ColorPickerW) NoAlpha 实验性 ​

go
func (w *ColorPickerW) NoAlpha() *ColorPickerW

NoAlpha hides the alpha slider and input.

func (*ColorPickerW) Open 实验性 ​

go
func (w *ColorPickerW) Open() *ColorPickerW

Open forces the panel open (screenshots, tests).

func (*ColorPickerW) Placement 实验性 ​

go
func (w *ColorPickerW) Placement(p Placement) *ColorPickerW

Placement sets where the panel opens: BottomStart (default), BottomEnd, TopStart or TopEnd (Ant placement "bottomLeft" …); it flips when there is no room.

func (*ColorPickerW) PresetGroups 实验性 ​

go
func (w *ColorPickerW) PresetGroups(groups ...ColorPresetGroup) *ColorPickerW

PresetGroups shows several titled preset groups instead of Presets. In Ant / shadcn the titles are buttons that collapse / expand their group (Closed starts collapsed); Element shows each title above its swatches.

func (*ColorPickerW) PresetLabel 实验性 ​

go
func (w *ColorPickerW) PresetLabel(s string) *ColorPickerW

PresetLabel names the preset group (Ant; default "推荐").

func (*ColorPickerW) Presets 实验性 ​

go
func (w *ColorPickerW) Presets(cols ...theme.Color) *ColorPickerW

Presets adds preset swatches (Ant presets, Element predefine).

func (*ColorPickerW) ShowText 实验性 ​

go
func (w *ColorPickerW) ShowText() *ColorPickerW

ShowText shows the color value next to the swatch.

func (*ColorPickerW) Size 实验性 ​

go
func (w *ColorPickerW) Size(s ControlSize) *ColorPickerW

func (*ColorPickerW) Status 实验性 ​

go
func (w *ColorPickerW) Status(s string) *ColorPickerW

func (*ColorPickerW) Trigger 实验性 ​

go
func (w *ColorPickerW) Trigger(t Trigger) *ColorPickerW

Trigger chooses what opens the panel: TriggerClick (default) or TriggerHover (Ant trigger="hover"): the panel opens when the pointer rests on the swatch and closes shortly after it leaves both; a click (or Enter / Space) pins it open until an outside press or Escape. TriggerContextMenu is treated as TriggerClick.

ColorPresetGroup 实验性 ​

go
type ColorPresetGroup struct {
	Label  string
	Colors []theme.Color
	Closed bool // Ant / shadcn: the group starts collapsed
}

ColorPresetGroup is a titled group of preset swatches (PresetGroups).

ColumnsStateFuncs 实验性 ​

go
type ColumnsStateFuncs struct {
	Load func(key string) (TableColumnState, bool)
	Save func(key string, s TableColumnState)
}

ColumnsStateFuncs adapts two functions to ColumnsStateStore.

func (ColumnsStateFuncs) LoadColumnsState 实验性 ​

go
func (f ColumnsStateFuncs) LoadColumnsState(key string) (TableColumnState, bool)

LoadColumnsState calls Load (nil: nothing stored).

func (ColumnsStateFuncs) SaveColumnsState 实验性 ​

go
func (f ColumnsStateFuncs) SaveColumnsState(key string, s TableColumnState)

SaveColumnsState calls Save (nil: dropped).

ColumnsStateStore 实验性 ​

go
type ColumnsStateStore interface {
	LoadColumnsState(key string) (TableColumnState, bool)
	SaveColumnsState(key string, s TableColumnState)
}

ColumnsStateStore keeps ProTable column states where the application wants them (memory, a settings file, a database): ProTable loads the state once by key and saves it on every change. It never touches the disk itself.

CommandItem 实验性 ​

go
type CommandItem struct {
	Value    string
	Label    string
	Group    string     // heading the item is listed under ("" = none)
	Icon     *icon.Icon // optional leading icon
	Shortcut string     // right-aligned hint such as "⌘P"
	Keywords []string   // extra search terms
	Disabled bool
}

CommandItem is one entry of a Command palette.

CommandLocale 实验性 ​

go
type CommandLocale struct {
	Placeholder, Empty string
	// contains filtered or unexported fields
}

CommandLocale holds the Command palette texts.

CommandW 实验性 ​

go
type CommandW struct {
	// contains filtered or unexported fields
}

CommandW is a command palette under construction (shadcn/ui Command): a search field over a filtered, grouped list navigated with the arrow keys. It renders in every design system with the active theme's tokens.

func Command 实验性 ​

go
func Command(c *Context, items []CommandItem) *CommandW

Command adds a command palette over items. Typing filters and ranks the list like cmdk: an item matches when the search letters appear in order in its label, value or keywords (case-insensitive); whole-word and prefix matches rank first and groups follow their best item. Up/Down (and Ctrl+N/J, Ctrl+P/K) move the active row, Home/End jump to the first / last, Enter or a click picks it (Selected).

ConfigProvider.Defaults("Command", ...) keys: "placeholder", "emptyText" (string), "loop" (bool, default false), "shouldFilter" (bool, default true), "vimBindings" (bool, default true).

func (*CommandW) DataVersion 实验性 ​

go
func (w *CommandW) DataVersion(v int) *CommandW

DataVersion tells the palette that the items slice was modified in place (a virtual list caches its matches, layout and width by slice identity, length and this number): after editing items of the same slice without changing its length, change v (or pass a new slice) so they are recomputed on the next frame.

func (*CommandW) DisablePointerSelection 实验性 ​

go
func (w *CommandW) DisablePointerSelection(on bool) *CommandW

DisablePointerSelection stops hovering from moving the active item (cmdk disablePointerSelection); clicks still pick.

func (*CommandW) Empty 实验性 ​

go
func (w *CommandW) Empty(s string) *CommandW

Empty replaces the "no results" text.

func (*CommandW) Filter 实验性 ​

go
func (w *CommandW) Filter(fn func(value, search string, keywords []string) float64) *CommandW

Filter replaces the matching and ranking (cmdk filter): fn returns 0 to hide an item, else its rank (higher first) for the item's value (Label when Value is empty), the trimmed search and its keywords.

func (*CommandW) ID 实验性 ​

go
func (w *CommandW) ID() ID

ID returns the palette box ID.

func (*CommandW) Layout 实验性 ​

go
func (w *CommandW) Layout(opts ...layout.Option) *CommandW

Layout applies layout options to the palette box.

func (*CommandW) Loop 实验性 ​

go
func (w *CommandW) Loop(on bool) *CommandW

Loop lets the arrow keys wrap from the last item to the first and back (cmdk loop; default false).

func (*CommandW) MaxHeight 实验性 ​

go
func (w *CommandW) MaxHeight(h float32) *CommandW

MaxHeight limits the list height (default 300).

func (*CommandW) Placeholder 实验性 ​

go
func (w *CommandW) Placeholder(s string) *CommandW

Placeholder replaces the search placeholder.

func (*CommandW) Query 实验性 ​

go
func (w *CommandW) Query() string

Query returns the current search text.

func (*CommandW) Search 实验性 ​

go
func (w *CommandW) Search(q *string) *CommandW

Search binds the search text (cmdk CommandInput value / onValueChange).

func (*CommandW) Selected 实验性 ​

go
func (w *CommandW) Selected() (CommandItem, bool)

Selected returns the item picked this frame.

func (*CommandW) Shadow 实验性 ​

go
func (w *CommandW) Shadow() *CommandW

Shadow gives the palette a floating shadow (as in a dialog).

func (*CommandW) ShouldFilter 实验性 ​

go
func (w *CommandW) ShouldFilter(on bool) *CommandW

ShouldFilter(false) lists every item whatever the search (cmdk shouldFilter): the app filters items itself, for example from a server, reading Query.

func (*CommandW) Value 实验性 ​

go
func (w *CommandW) Value(v *string) *CommandW

Value binds the value of the active item (cmdk value / onValueChange): the palette highlights the item whose Value (Label when empty) equals *v and writes the active item's value back as it moves. A value that is not listed leaves the first item active.

func (*CommandW) ValueChanged 实验性 ​

go
func (w *CommandW) ValueChanged() bool

ValueChanged reports that the active item changed this frame.

func (*CommandW) VimBindings 实验性 ​

go
func (w *CommandW) VimBindings(on bool) *CommandW

VimBindings(false) turns off Ctrl+N/J (next) and Ctrl+P/K (previous) (cmdk vimBindings; default true).

func (*CommandW) Virtual 实验性 ​

go
func (w *CommandW) Virtual(on bool) *CommandW

Virtual forces the virtual list on or off; by default lists showing more than 100 items are virtual: only the rows in view and the active item are built (groups only for their visible part), the list keeps the width, height and scroll range of the full list and follows the active item when it moves with the keyboard, but items out of view are not in the accessibility tree. Without a Filter function the matches, their order and the width are reused while the items slice (identity and length), the search and the DataVersion stay the same: an item edited in place (same slice, same length) does not join or leave the matches, nor change the list's width, until one of them changes. Virtual(false) builds every row.

CompactW 实验性 ​

go
type CompactW struct {
	// contains filtered or unexported fields
}

CompactW joins its direct child controls (Input, Select, Button, InputNumber, DatePicker, Addon, ...) into one group: neighbours overlap by one pixel and only the outer corners stay rounded (Ant Space.Compact / Input.Group, Element input prepend/append and button groups).

The children are drawn by their own painters; Compact squares the joined corners by repainting the joined edge columns with a widened rectangle, so it works with any control without changing it.

func Compact 实验性 ​

go
func Compact(c *Context) *CompactW

Compact starts a compact group; chain options, then Body.

ui.Compact(c).Body(func() { ui.Input(c, &v); ui.Button(c, "提交").Primary() })

ConfigProvider.Defaults("Compact", ...) keys: "block" (bool).

func (*CompactW) Block 实验性 ​

go
func (w *CompactW) Block() *CompactW

Block stretches the group to the container width.

func (*CompactW) Body 实验性 ​

go
func (w *CompactW) Body(fn func()) *Box

Body adds the controls.

func (*CompactW) Layout 实验性 ​

go
func (w *CompactW) Layout(o ...layout.Option) *CompactW

Layout applies layout options to the group.

func (*CompactW) Orientation 实验性 ​

go
func (w *CompactW) Orientation(o string) *CompactW

Orientation sets the direction: "horizontal" (default) or "vertical" (antd 6 orientation; Vertical is the shorthand). Other values are ignored.

func (*CompactW) Size 实验性 ​

go
func (w *CompactW) Size(s ControlSize) *CompactW

Size sets the size of the controls in the group that do not set their own (antd Space.Compact size): it scopes the component size like ConfigProvider.Size.

func (*CompactW) Vertical 实验性 ​

go
func (w *CompactW) Vertical() *CompactW

Vertical stacks the controls (joined top/bottom edges).

ConfigProviderW ​

go
type ConfigProviderW struct {
	// contains filtered or unexported fields
}

ConfigProviderW configures every component built inside its Body: size, locale, component default properties, disabled state and theme.

只有部分成员是稳定的:未标「实验性」的方法和全部字段受兼容性承诺约束。

func ConfigProvider ​

go
func ConfigProvider(c *Context) *ConfigProviderW

ConfigProvider starts a configuration scope; chain options, then Body.

func (*ConfigProviderW) Body ​

go
func (p *ConfigProviderW) Body(fn func())

Body builds fn inside the configuration scope.

func (*ConfigProviderW) Compact ​

go
func (p *ConfigProviderW) Compact(on bool) *ConfigProviderW

Compact selects the compact size algorithm.

func (*ConfigProviderW) ComponentDisabled ​

go
func (p *ConfigProviderW) ComponentDisabled(on bool) *ConfigProviderW

ComponentDisabled disables every widget inside.

func (*ConfigProviderW) Components 实验性 ​

go
func (p *ConfigProviderW) Components(cs theme.Components) *ConfigProviderW

Components layers component token overrides (theme.Components; zero fields inherit) over the scope's theme. Repeated calls merge. Like Theme, it themes the window from the root provider and only the scope from a nested one.

func (*ConfigProviderW) Dark ​

go
func (p *ConfigProviderW) Dark(on bool) *ConfigProviderW

Dark switches between the light and dark algorithm.

func (*ConfigProviderW) Defaults 实验性 ​

go
func (p *ConfigProviderW) Defaults(component string, props Props) *ConfigProviderW

Defaults sets default properties of a component; keys merge with outer providers.

func (*ConfigProviderW) Direction ​

go
func (p *ConfigProviderW) Direction(d Direction) *ConfigProviderW

Direction sets the inline direction of the scope: LTR, RTL, or DirAuto to derive it from the scope's Locale again (overriding an explicit direction of an outer provider). Without a provider that sets one, the direction follows the Locale, then SetDefaultDirection.

func (*ConfigProviderW) Flavor ​

go
func (p *ConfigProviderW) Flavor(f theme.Flavor) *ConfigProviderW

Flavor switches the design language (theme.Ant / theme.Element / theme.StyleShadcn) keeping dark mode and primary color settings of this provider.

func (*ConfigProviderW) HighContrast ​

go
func (p *ConfigProviderW) HighContrast(on bool) *ConfigProviderW

HighContrast fixes the contrast of the scope: true draws theme.HighContrast of the scope's theme (WCAG AA for every required pair, docs/accessibility.md), false the standard variant. Without it the scope inherits: a theme rebuilt by Flavor, Dark, PrimaryColor or Compact stays high-contrast when the outer theme is (for example while uihost follows the system preference). Like Theme, the root provider applies it to the window; uihost then stops following the system theme for that window.

HighContrast(false) inside a high-contrast scope regenerates the theme from its flavor, dark mode and component overrides, as Dark does: token customizations of the outer theme that the generator cannot reproduce are lost.

func (*ConfigProviderW) Locale ​

go
func (p *ConfigProviderW) Locale(l *Locale) *ConfigProviderW

Locale sets the language.

func (*ConfigProviderW) LocaleCode ​

go
func (p *ConfigProviderW) LocaleCode(code string) *ConfigProviderW

LocaleCode sets the language by registered code ("en-US").

func (*ConfigProviderW) PrimaryColor ​

go
func (p *ConfigProviderW) PrimaryColor(col theme.Color) *ConfigProviderW

PrimaryColor overrides the brand color (derived shades follow).

func (*ConfigProviderW) Size ​

go
func (p *ConfigProviderW) Size(s ControlSize) *ConfigProviderW

Size sets the default control size (small / middle / large).

func (*ConfigProviderW) Theme ​

go
func (p *ConfigProviderW) Theme(th *theme.Theme) *ConfigProviderW

Theme sets the theme of the scope. A provider called directly by the page function outside any other provider (the root provider) switches the window theme: background, global layers (Message, Notification) and everything built before it. A nested provider only themes the widgets built inside its Body, including their paint. The same applies to Flavor, Dark, PrimaryColor and Compact.

ConfirmAction ​

go
type ConfirmAction string

ConfirmAction is how a Confirm / MessageBox / Prompt dialog was closed.

go
const (
	// ConfirmActionConfirm: the OK button (or Enter in a Prompt).
	ConfirmActionConfirm ConfirmAction = "confirm"
	// ConfirmActionCancel: the Cancel button, or with
	// DistinguishCancelAndClose unset also the close button, Escape and
	// a mask click.
	ConfirmActionCancel ConfirmAction = "cancel"
	// ConfirmActionClose: the close button, Escape or a mask click when
	// DistinguishCancelAndClose is set.
	ConfirmActionClose ConfirmAction = "close"
)

ConfirmOptions ​

go
type ConfirmOptions struct {
	Title   string
	Content string
	// Status picks the leading icon: "info", "success", "warning", "error"
	// or "none". Confirm/Prompt default to "warning"/"none", MessageBox to
	// "info".
	Status     string
	OkText     string // default "确定" ("知道了" for Ant MessageBox)
	CancelText string // default "取消"
	Danger     bool   // red OK button (destructive actions)
	Width      float32
	// MaskClosable closes the dialog (as a cancel) on a mask click.
	MaskClosable bool
	// OnOk runs on the UI thread when OK is activated. The dialog closes
	// after it returns unless it called d.Loading(true); then it stays open
	// with a spinning OK button until d.Close().
	OnOk func(d *ConfirmRef)
	// OnCancel runs on Cancel, the close button, Escape or a mask click.
	OnCancel func()
	// DistinguishCancelAndClose tells the close button, Escape and a
	// mask click apart from Cancel: they run OnClose (not OnCancel) and
	// ConfirmRef.Action reports ConfirmActionClose.
	DistinguishCancelAndClose bool
	// OnClose runs when the dialog is closed without Cancel or OK
	// (close button, Escape, mask) and DistinguishCancelAndClose is set.
	OnClose func()
	// Center centers the icon, title, content and buttons.
	Center bool
	// Draggable lets the user move the dialog by dragging its title.
	Draggable bool
	// Icon replaces the status icon; it is drawn in the status color
	// (the primary color for Status "none").
	Icon *icon.Icon
	// AutoFocusButton picks the button focused when the dialog opens:
	// "" or "ok" (default), "cancel", or "none" (antd autoFocusButton,
	// null for none). A Prompt focuses its input.
	AutoFocusButton string
	// NoKeyboard keeps Escape from closing the dialog (antd keyboard
	// false, Element close-on-press-escape false).
	NoKeyboard bool

	// Prompt only.
	InputValue       string
	InputPlaceholder string
	// Validate returns an error message ("" = valid); OK is refused while
	// it fails.
	Validate func(v string) string
}

ConfirmOptions configure Confirm, MessageBox and Prompt.

ConfirmRef ​

go
type ConfirmRef struct {
	// contains filtered or unexported fields
}

ConfirmRef is a handle to an open dialog.

func Confirm ​

go
func Confirm(c *Context, o ConfirmOptions) *ConfirmRef

Confirm opens a confirmation dialog with Cancel and OK buttons.

func MessageBox 实验性 ​

go
func MessageBox(c *Context, o ConfirmOptions) *ConfirmRef

MessageBox opens an information dialog with a single OK button (Ant Modal.info/success/warning/error, Element ElMessageBox.alert). Set o.Status to pick the icon.

func Prompt 实验性 ​

go
func Prompt(c *Context, o ConfirmOptions) *ConfirmRef

Prompt opens a dialog with a text input; read the value in OnOk with d.Value().

func (*ConfirmRef) Action ​

go
func (d *ConfirmRef) Action() ConfirmAction

Action reports how the dialog was closed by the user ("" while open or after Close).

func (*ConfirmRef) Close ​

go
func (d *ConfirmRef) Close()

Close closes the dialog without calling any callback. It is safe to call from any goroutine (e.g. when async work started in OnOk finishes): the state is atomic and a frame is requested through Window.Invalidate, which the Window contract makes thread-safe.

func (*ConfirmRef) IsOpen ​

go
func (d *ConfirmRef) IsOpen() bool

IsOpen reports whether the dialog is still shown.

func (*ConfirmRef) Loading ​

go
func (d *ConfirmRef) Loading(on bool)

Loading shows (or clears) the spinner on the OK button. While loading, OK is inert and the dialog stays open after OnOk returns. Safe to call from another goroutine.

func (*ConfirmRef) Value ​

go
func (d *ConfirmRef) Value() string

Value returns the Prompt input.

ContentKind 实验性 ​

go
type ContentKind int

ContentKind says what a window mostly shows (RunnerOptions.Content). The window host uses it to decide when a window leaves its default renderer: on Apple Silicon macOS, uihost starts every window, of any size and any ContentKind, on native Core Animation layers, whose memory footprint is well below Metal's, and switches a window to Metal at most once. TANGO_RENDERER and RunnerOptions.Renderer still take precedence, and hosts without such a choice ignore it.

go
const (
	// ContentGeneral is the default. On Apple Silicon macOS the window
	// switches itself to Metal on the frame after its first keyboard input
	// (a non-modifier key press, committed text or an IME composition),
	// because Metal shows input about two frames sooner, or after six
	// consecutive frames over 8 ms or six consecutive frames of full-window
	// software fallback. Scrolling and pointer input alone keep it on native
	// layers. Intel Macs default to Metal.
	ContentGeneral ContentKind = iota
	// ContentData is for windows that mostly display data changing on its
	// own: tables, grids, quote boards, lists and dashboards. On Apple
	// Silicon macOS they ignore keyboard input, so browsing with arrow or
	// page keys keeps their memory footprint low (list and quote windows:
	// 39-54 vs 135-147 MB on Metal; an 800x600 grid redrawing 600 cells
	// every frame: about 69 MB), and switch to Metal only under the same
	// frame-cost rules as ContentGeneral. Their input
	// reaches the screen about two frames later than on Metal, so editors,
	// terminals and drawing canvases should stay ContentGeneral.
	ContentData
)

实验性

Context ​

go
type Context struct {
	Theme *theme.Theme
	// contains filtered or unexported fields
}

Context is passed to page functions; it builds the frame's widget tree and answers interaction queries. It is only valid on the UI goroutine during a frame.

只有部分成员是稳定的:未标「实验性」的方法和全部字段受兼容性承诺约束。

func (*Context) A11yAction 实验性 ​

go
func (c *Context) A11yAction(id ID) (a11y.Action, string, bool)

A11yAction returns an accessibility action requested for id this frame (Runner.PerformAction): widgets whose activation does not go through Interact (gesture areas, custom hit testing) read it to react to Press, Expand, SetValue … Press is also delivered as a click to Interact.

func (*Context) A11yEnabled ​

go
func (c *Context) A11yEnabled() bool

A11yEnabled reports whether the semantics tree is built this frame (a host or the Driver asked for it). Widgets may skip work that only feeds the tree (formatting descriptions, closures) when it is false.

func (*Context) A11yScrollRequest 实验性 ​

go
func (c *Context) A11yScrollRequest(container ID) (ID, bool)

A11yScrollRequest returns the widget a screen reader asked to scroll into view this frame (the ScrollIntoView action) when container is the nearest scroll container around it that is not a ui scroll container (Box.A11yScroller); the container scrolls the minimum amount that shows the widget's rectangle of the last frame (Context.RectOf) inside its visible part. ui scroll containers further out are scrolled by the runner itself.

func (*Context) Anim ​

go
func (c *Context) Anim(id ID, slot string, target float32, dur time.Duration) float32

Anim returns a value that eases towards target over dur, retained per (id, slot). The first call returns target immediately. While moving it keeps frames coming; when settled no frames are requested.

func (*Context) AnimDone ​

go
func (c *Context) AnimDone(id ID, slot string) bool

AnimDone reports whether the (id, slot) animation has settled at target.

func (*Context) AnimFrom ​

go
func (c *Context) AnimFrom(id ID, slot string, initial, target float32, dur time.Duration) float32

AnimFrom is Anim with an explicit initial value (enter transitions).

func (*Context) Announce ​

go
func (c *Context) Announce(text string, live a11y.Live)

Announce asks the screen reader to speak text once (a polite or assertive announcement not tied to a node, e.g. "3 results"). It is ignored when accessibility is off.

func (*Context) CaptureTab ​

go
func (c *Context) CaptureTab(id ID)

CaptureTab makes Tab and Shift+Tab reach widget id (in KeysFor) instead of moving focus, while id has keyboard focus. Call it during the build of every frame in which id wants Tab. Ctrl+Tab, or Esc then Tab, still moves focus out of it.

func (*Context) ClaimBack ​

go
func (c *Context) ClaimBack()

ClaimBack asks for the system Back action in this frame: while some frame calls it, Back arrives as an Escape key press, read with Context.Escape (on the page it is not consumed by overlays, which are above it and take Escape first). Call it every frame the page has something Back should undo, typically an in-page navigation stack that is not at its root.

func (*Context) ClaimEscape 实验性 ​

go
func (c *Context) ClaimEscape(id ID)

ClaimEscape makes keyboard Esc reach widget id (in KeysFor and EventsFor) instead of closing overlays, while id has keyboard focus. Call it during the build of every frame in which id wants Esc. Android's system Back (Esc with Code input.KeyBack) is not claimed and still closes overlays.

func (*Context) ClaimKeyboardReveal 实验性 ​

go
func (c *Context) ClaimKeyboardReveal()

ClaimKeyboardReveal marks the pending keyboard avoidance request as handled (see PendingKeyboardReveal). The frame is redrawn completely.

func (*Context) ComponentSize ​

go
func (c *Context) ComponentSize() (ControlSize, bool)

ComponentSize returns the size set by the innermost ConfigProvider and whether one was set; components use it when the caller gave no size.

func (*Context) CompositionFor 实验性 ​

go
func (c *Context) CompositionFor(id ID) (string, int)

CompositionFor returns the current IME pre-edit string for focused id.

func (*Context) ConfigProp ​

go
func (c *Context) ConfigProp(component, key string) (any, bool)

ConfigProp returns a default property for component (nil, false when unset). Nested providers inherit and override per key.

func (*Context) ContextMenu 实验性 ​

go
func (c *Context) ContextMenu() (geom.Point, bool)

ContextMenu reports a secondary-button (right) press this frame and its position.

func (*Context) ContextMenuFor 实验性 ​

go
func (c *Context) ContextMenuFor(id ID) (geom.Point, bool)

ContextMenuFor reports a secondary-button press this frame inside id's last-frame rectangle that did not land on a layer above id.

func (*Context) Damage 实验性 ​

go
func (c *Context) Damage(r geom.Rect)

Damage tells the renderer that the pixels inside r (window logical pixels, the space of RectOf and Box.Rect) change this frame. Once any widget declares damage (or a ScrollShift) in a frame, the renderer may redraw only the declared regions plus what the Runner detects itself: running Anim/AnimFrom transitions (old and new rect of the animation's widget ID), overlays opening, closing or moving, the focus ring and the hovered/pressed widget. Everything else that looks different must be covered by a declaration. Frames without declarations are redrawn completely, and so are frames in which time-driven drawing may have changed (the clock passed a WakeAt timer of the last frame, such as a text caret's blink, or the last frame was animating; WakeAtDamaged timers excepted).

UI thread only, during the page build or a paint function (before the Runner collects the hints at the end of the frame).

func (*Context) Direction ​

go
func (c *Context) Direction() Direction

Direction reports the resolved direction of the current scope: LTR or RTL, never DirAuto.

func (*Context) Dismissed 实验性 ​

go
func (c *Context) Dismissed(panel ID, also ...ID) bool

Dismissed reports whether an open overlay panel should close this frame: Escape routed to it (EscapeAt) or a press outside it and the extra widgets, typically its anchor (PressedOutside). Call it every frame the panel is open.

func (*Context) Dragging ​

go
func (c *Context) Dragging(id ID) bool

Dragging reports whether id holds the pointer capture.

func (*Context) Escape ​

go
func (c *Context) Escape() bool

Escape reports (and consumes) an Escape press not handled by a focused widget, routed like EscapeAt using the layer the caller is being built in. Overlays that check Escape outside their own content (after building the panel) must use EscapeAt with the panel ID instead.

func (*Context) EscapeAt 实验性 ​

go
func (c *Context) EscapeAt(panel ID) bool

EscapeAt reports (and consumes) an Escape press meant for the overlay panel: it is true only when panel is the top-most layer that listened for Escape in the last frame, so Escape closes stacked popups one at a time. Call it every frame the panel is open (calling it is what registers the panel as a listener). panel is the overlay's box ID (Overlay(...).ID()); before the panel was first painted the caller's own layer is used.

func (*Context) EventsFor ​

go
func (c *Context) EventsFor(id ID) []input.Event

EventsFor returns, in arrival order, the keyboard input of this frame for widget id while it has focus: input.KeyEvent (Key folded with Key.Base, Code the physical key), input.TextInput and input.Composition, interleaved as they happened. Use it when order matters (a text editor: Backspace then "a" is not "a" then Backspace); KeysFor and TextFor give the same events split by kind.

It also carries Esc (which overlays consume through Escape) and Tab when id declared CaptureTab. Like KeysFor it hands the events over once: later calls in the same frame return nil.

func (*Context) FileDrag 实验性 ​

go
func (c *Context) FileDrag() (geom.Point, bool)

FileDrag reports a file drag over the window and its position in UI logical pixels. It is read-only: use DropZone for hit testing and highlighting.

func (*Context) Focused ​

go
func (c *Context) Focused() ID

Focused returns the focused widget.

func (*Context) Inline 实验性 ​

go
func (c *Context) Inline(r geom.Rect) InlineSpan

Inline returns the inline span of r in the current scope's direction. Call it during build, or during paint (the node's own scope is current).

func (*Context) InlineKey 实验性 ​

go
func (c *Context) InlineKey(k input.Key) (prev, next bool)

InlineKey reports whether k means "previous" or "next" along the inline axis: Left/Right swap in RTL scopes.

func (*Context) Invalidate ​

go
func (c *Context) Invalidate()

Invalidate requests another build pass of the current frame (e.g. after changing state that widgets built earlier in this frame read). It must be called on the UI goroutine during a frame; from other goroutines use the function returned by Invalidator.

func (*Context) InvalidateImage 实验性 ​

go
func (c *Context) InvalidateImage(img image.Image)

InvalidateImage drops the renderer's cached copies of img. Call it on the UI goroutine during building or painting, before rendering, after changing image pixels or discarding a private derived image. A later draw of the same image value prepares it again. Renderers without image caches may ignore this hint.

This does not declare redraw damage. In-place pixel changes also need Damage (or a full redraw); replacing a drawn image value changes its paint fingerprint normally. Recorded image pixels remain caller-owned.

func (*Context) Invalidator ​

go
func (c *Context) Invalidator() func()

Invalidator returns a function that requests a new frame. Unlike Invalidate it is safe to call from any goroutine (background loaders, network callbacks) and after the frame that obtained it has ended.

func (*Context) IsRTL ​

go
func (c *Context) IsRTL() bool

IsRTL reports whether the current scope lays out right to left. During paint and measure callbacks it reports the direction of the node being painted or measured.

func (*Context) KeepPointer 实验性 ​

go
func (c *Context) KeepPointer(id ID)

KeepPointer stops enclosing containers from taking the pointer over from id while it holds it (CSS touch-action: none). Call it during the build of each frame in which id drags by itself.

func (*Context) KeyboardCover ​

go
func (c *Context) KeyboardCover(r geom.Rect) float32

KeyboardCover returns how much of the bottom of r (window logical pixels) the soft keyboard hides; 0 while it is hidden.

func (*Context) KeyboardInset ​

go
func (c *Context) KeyboardInset() geom.Insets

KeyboardInset returns the part of the window covered by the soft keyboard, in logical pixels: usually only Bottom, zero while the keyboard is hidden and on desktops. Views that must stay visible pad or lift themselves by it (with SafeArea, take the larger bottom of the two). A change redraws the whole frame.

func (*Context) KeysFor ​

go
func (c *Context) KeysFor(id ID) []input.KeyEvent

KeysFor returns the key events delivered to id this frame when it has focus, and marks them consumed.

func (*Context) Locale ​

go
func (c *Context) Locale() *Locale

Locale returns the active locale (innermost ConfigProvider, else the default set by SetDefaultLocale, zh-CN out of the box). In paint and measure callbacks it is the locale of the scope the node was built in.

func (*Context) MiddlePressed 实验性 ​

go
func (c *Context) MiddlePressed(id ID) bool

MiddlePressed reports a middle-button press on the visible hit region of id. The topmost overlay wins and clipped content does not receive presses.

func (*Context) Now ​

go
func (c *Context) Now() time.Time

Now returns the frame time (use it for timers, not time.Now).

func (*Context) PaintIcon ​

go
func (c *Context) PaintIcon(l *paint.List, ic *icon.Icon, r geom.Rect, col theme.Color, angle float64)

PaintIcon draws ic in r, mirroring directional icons in RTL scopes (rotation first, then the mirror).

func (*Context) PendingKeyboardReveal 实验性 ​

go
func (c *Context) PendingKeyboardReveal() (KeyboardReveal, bool)

PendingKeyboardReveal returns the keyboard avoidance request of this frame, if any. A scroll container that moves its content itself (not a ui scroll container) checks that Field lies in its content, scrolls so that Target ends above Limit and calls ClaimKeyboardReveal. Unclaimed requests go to the innermost ui scroll container around the field after the build.

func (*Context) PixelScale 实验性 ​

go
func (c *Context) PixelScale() float32

PixelScale returns device pixels per UI logical pixel in the current frame, including both UI scale and the host window's device-pixel ratio.

func (*Context) Pointer ​

go
func (c *Context) Pointer() (geom.Point, bool)

Pointer returns the pointer position and whether it is inside the window.

func (*Context) PointerCancelled 实验性 ​

go
func (c *Context) PointerCancelled(id ID) bool

PointerCancelled reports whether id lost the pointer this frame without a release: an enclosing container took the drag over, or the system cancelled the gesture (input.Cancel, a cancelled touch, the window lost focus). The widget should drop any drag in progress without committing it.

func (*Context) PointerDownOutside 实验性 ​

go
func (c *Context) PointerDownOutside(rs ...geom.Rect) bool

PointerDownOutside reports whether a press happened this frame outside all of the given rectangles. It ignores layering; popups should use PressedOutside or Dismissed with widget IDs instead.

func (*Context) PointerEvents 实验性 ​

go
func (c *Context) PointerEvents() []input.Pointer

PointerEvents returns every pointer event of the frame (Move, Press, Release, Leave), in arrival order, in the same coordinates as Pointer. Pointer reports only where the frame ended; apps that forward the pointer elsewhere, such as a remote desktop, read the whole path here. Like keys, the events reach the first build of the frame only; a rebuild of the same frame sees none. The slice is valid until the next build.

func (*Context) PointerMods ​

go
func (c *Context) PointerMods() input.Modifiers

PointerMods returns the modifiers held at the latest pointer event (move, press, release, wheel) or key event, whichever came last. Unlike PressMods it follows modifier changes during a drag, so a drag source can switch between move and copy (Alt/Option) while the pointer moves or when only the modifier key changes.

func (*Context) PointerTaken 实验性 ​

go
func (c *Context) PointerTaken(id ID) (from geom.Point, ok bool)

PointerTaken reports whether id took the pointer over from a widget inside it this frame, and where that press started (id is now the holder: Dragging(id) is true).

func (*Context) PressCount ​

go
func (c *Context) PressCount() int

PressCount returns the click count of the current (or last) primary press: 1 single, 2 double, 3 triple... It follows the host's count when the platform reports one (system double-click settings), otherwise the UI's own 400 ms rule. Read it while handling a press or a drag that started with one (word / line selection by double / triple click).

func (*Context) PressMods ​

go
func (c *Context) PressMods() input.Modifiers

PressMods returns the modifier keys held at the last primary press (Shift+click to extend a selection, Alt+click for a column cursor).

func (*Context) PressPos 实验性 ​

go
func (c *Context) PressPos() geom.Point

PressPos returns the position of the latest primary press, even if more pointer events followed it in the same frame.

func (*Context) PressedOutside 实验性 ​

go
func (c *Context) PressedOutside(ids ...ID) bool

PressedOutside reports whether the primary button went down this frame outside the last-frame rectangles of all ids and not on a layer above them: a press inside a popup stacked over the panel (a Select list opened from a Modal) is not "outside" the panel. The highest layer among ids (usually the panel; anchors on the page do not raise it) is the panel's.

func (*Context) RectOf ​

go
func (c *Context) RectOf(id ID) (geom.Rect, bool)

RectOf returns the absolute rectangle id had in the last painted frame, in UI logical pixels.

func (*Context) ReduceMotion ​

go
func (c *Context) ReduceMotion() bool

ReduceMotion reports whether the user asked for reduced motion (RunnerOptions.ReduceMotion). Anim and AnimFrom already jump to their targets; widgets check it for motion they drive themselves (shimmer, pulsing dots, marquees, autoplay).

func (*Context) ReleasePos ​

go
func (c *Context) ReleasePos(id ID) (geom.Point, bool)

ReleasePos returns where the primary button was released over the press that id held, this frame. Unlike Pointer (the last pointer event of the frame) it is the release event's own position, so a move that arrives in the same frame after the release does not shift it. ok is false when id was not released this frame.

func (*Context) SafeArea ​

go
func (c *Context) SafeArea() geom.Insets

SafeArea returns the safe-area insets of the window in logical pixels (zero on desktops). Edge-to-edge widgets (navigation and tab bars, bottom sheets, full-screen pages) pad themselves by it. A change redraws the whole frame.

func (*Context) ScrollIntoView ​

go
func (c *Context) ScrollIntoView(scrollID, id ID) bool

ScrollIntoView scrolls container scrollID (a ScrollBox or another scroll container's ID) the minimum amount that makes widget id fully visible, using both widgets' rectangles from the last painted frame. It returns false when either was not painted yet (call it again next frame).

func (*Context) ScrollIntoViewInset 实验性 ​

go
func (c *Context) ScrollIntoViewInset(scrollID, id ID, inset geom.Insets) bool

ScrollIntoViewInset is ScrollIntoView for a window partly covered by system UI: inset (window logical pixels, such as KeyboardInset or SafeArea) is removed from the window before it clips the container's viewport, so the widget ends up in the part of the container that is still visible. A widget taller than that part is aligned to its top. While the soft keyboard covers the container it may scroll past its content's end by the covered height. Like ScrollIntoView it returns false when either widget was not painted yet.

func (*Context) ScrollShift 实验性 ​

go
func (c *Context) ScrollShift(r geom.Rect, d geom.Point)

ScrollShift declares that the content being built moved by d inside r (window logical pixels; a pixel at p is now at p+d) since the last frame, so the renderer may copy those pixels instead of redrawing them. Call it inside the Body of the scrolled content: the current parent node is recorded as the scrolled content (for a Scroll container, its children). The Runner damages, inside r, the strip the copy uncovers and every node that does not move with the content (sticky headers, summary rows, Affix, overlays, fixed-column shadows), at its new place and where the copy carried its old pixels. The backgrounds of the content's ancestors must look the same everywhere in r. When the nodes in r cannot be classified (the content was not laid out, a node straddles r's edge, an ancestor paints over r or is transformed) the shift is withdrawn and r is redrawn as a whole.

UI thread only, during the page build.

func (*Context) Semantics ​

go
func (c *Context) Semantics(id ID, role a11y.Role, name string, states ...a11y.State)

Semantics annotates the widget id (built this frame) with a role, an accessible name and states, overriding what the widget declared; use it for custom widgets built from Div/Custom or to rename a control:

b := ui.Custom(c, measure, paint)
c.Semantics(b.ID(), a11y.RoleImage, loc.Logo)

An empty name keeps the widget's own name. It costs nothing when accessibility is off.

func (*Context) SetFocus ​

go
func (c *Context) SetFocus(id ID)

SetFocus moves keyboard focus to id (0 clears it).

func (*Context) Size ​

go
func (c *Context) Size() geom.Size

Size returns the viewport size in UI logical pixels, after UI scaling.

func (*Context) TerminalEvents 实验性 ​

go
func (c *Context) TerminalEvents(id ID, fn func(input.Event) bool)

TerminalEvents declares an experimental fast input path for a focused terminal-like control. The handler runs when Runner.HandleEvent receives an event, before the event is queued for the next frame. Returning true claims the event; returning false leaves it for ordinary frame processing.

The handler must not mutate retained UI state from another goroutine. It may enqueue work into a thread-safe application queue such as a terminal's input writer.

func (*Context) TextEditsFor 实验性 ​

go
func (c *Context) TextEditsFor(id ID) []input.Event

TextEditsFor returns, in arrival order, the input.TextEdit and input.SelectionChange events of this frame for widget id while it has focus, and records that id applies them itself: from the next frame on they reach it unconverted. Like KeysFor it hands them over once.

func (*Context) TextFor ​

go
func (c *Context) TextFor(id ID) []string

TextFor returns committed text input for focused id.

func (*Context) TextOpts ​

go
func (c *Context) TextOpts(o text.Options) text.Options

TextOpts sets the paragraph base direction of interface text (labels, titles) from the scope: RTL scopes get text.DirRTL, LTR scopes keep the options unchanged. User content should keep text.DirAuto instead.

func (*Context) TextStyle 实验性 ​

go
func (c *Context) TextStyle(size float32, weight text.Weight) text.Style

TextStyle returns a style using the current theme's family and line height. Custom widgets can use it for both measuring and painting text.

func (*Context) ThemeFor 实验性 ​

go
func (c *Context) ThemeFor(k theme.Comp) *theme.Theme

ThemeFor returns the theme component k reads: the current theme with k's Alias overrides applied (theme.Components.X.Alias), or c.Theme itself when k has none. Components capture it when they are built and paint from it.

func (*Context) Token 实验性 ​

go
func (c *Context) Token() *theme.Components

Token returns the resolved component tokens of the current theme.

func (*Context) TouchCount ​

go
func (c *Context) TouchCount() int

TouchCount returns how many fingers are on the screen.

func (*Context) TrapFocus ​

go
func (c *Context) TrapFocus(panel ID)

TrapFocus makes the overlay panel (Overlay(...).ID()) a modal focus scope for this frame: Tab and Shift+Tab cycle inside it and the layers above it, keyboard focus moves into it when it opens and returns to the previously focused widget when it closes, and the semantics tree hides the layers below. Call it every frame the panel is open; Modal, Drawer and the confirm boxes do so already.

func (*Context) WakeAt ​

go
func (c *Context) WakeAt(t time.Time)

WakeAt asks for a frame at t (timers, auto-dismiss, caret blink).

func (*Context) WakeAtDamaged 实验性 ​

go
func (c *Context) WakeAtDamaged(t time.Time)

WakeAtDamaged asks for a frame at t like WakeAt, for a time-driven change the widget declares itself, with Damage, in the frame it wakes (a text caret's blink): reaching t does not make that frame a full redraw, as reaching a WakeAt timer does (see Damage). The widget must declare everything the clock changed in its drawing.

UI thread only, during the page build or paint.

func (*Context) WantBack ​

go
func (c *Context) WantBack() bool

WantBack reports whether the system Back action has something to close in the last frame: a dismissible overlay above the page (anything that listened for Escape on a layer above the page) or a ClaimBack call.

func (*Context) WantImagePaste 实验性 ​

go
func (c *Context) WantImagePaste()

WantImagePaste tells the host that the focused text field can handle image-only Paste. Call alongside WantTextInput on each active frame. The host still delivers the regular Paste shortcut.

func (*Context) WantTextInput 实验性 ​

go
func (c *Context) WantTextInput(caret geom.Rect)

WantTextInput tells the host that a text field has focus and where its caret is (for IME candidate windows). Called while painting, caret is in the space being painted; it is mapped to window coordinates.

func (*Context) WantTextInputState 实验性 ​

go
func (c *Context) WantTextInputState(caret geom.Rect, st input.TextInputState)

WantTextInputState is WantTextInput for a field that describes its text to the input method: st carries the text around the selection (rune offsets, see input.TextInputState) and the field's hints. Call it every frame the field has focus, like WantTextInput.

func (*Context) WheelFor ​

go
func (c *Context) WheelFor(id ID) (dx, dy float32, ok bool)

WheelFor returns the wheel delta that landed on widget id this frame and was not consumed by a scroll container inside it (or by a nested WheelFor listener). Use it for wheel-driven widgets that do not scroll: zoom in an image preview, a carousel, stepping a number. id must be registered for hit testing (any interact/Hovered call); delivery starts the frame after the first call. Wheel over a widget that never asks keeps scrolling the containers around it.

func (*Context) Window ​

go
func (c *Context) Window() Window

Window returns the host window.

func (*Context) WindowFocused ​

go
func (c *Context) WindowFocused() bool

WindowFocused reports whether the window has key focus (false after the host reported input.WindowFocus{Focused: false}). Stop caret blinking and other focus-only animations while it is false.

ContextMenuOptions 实验性 ​

go
type ContextMenuOptions struct {

	// NoAutoSelect opens the menu with no item highlighted, like the
	// context menus of code editors: keyboard focus moves to the menu
	// panel itself (role menu, not a Tab stop), Down/Home highlight the
	// first enabled item, Up/End the last, a letter or digit the first
	// item starting with it, and Enter/Space do nothing until an item is
	// highlighted. Pointer hover, Escape and closing work as usual.
	NoAutoSelect bool
	// Width specifies the root panel width in logical pixels. It is
	// capped to the window width minus the edge margins. A non-positive
	// value uses the content width. Submenus still size to their content.
	Width float32
	// contains filtered or unexported fields
}

ContextMenuOptions configure ContextMenuAtWith.

ControlSize ​

go
type ControlSize uint8

ControlSize is the size variant of form controls.

Append-only: never reorder or insert; the zero value stays Middle.

go
const (
	Middle ControlSize = iota
	Small
	Large
)

Conversation 实验性 ​

go
type Conversation struct {
	Key      string
	Title    string     // "" shows Locale.Chat.Untitled
	Time     time.Time  // last activity: groups the list by day unless Group is set
	Group    string     // explicit group label
	Icon     *icon.Icon // leading icon (nil: none)
	Running  bool       // a reply is being generated (spinner)
	Disabled bool
	// contains filtered or unexported fields
}

Conversation is one entry of a Conversations list.

ConversationsW 实验性 ​

go
type ConversationsW struct {
	// contains filtered or unexported fields
}

ConversationsW is a list of conversations grouped by time (today, yesterday, previous 7 / 30 days, earlier) with selection and hover actions to rename (F2) and delete (Delete).

func Conversations 实验性 ​

go
func Conversations(c *Context, items []Conversation, active *string) *ConversationsW

Conversations adds a conversation list; *active holds the selected key. Put it in a Scroll for long lists, or give it Height (and Virtual for thousands of conversations).

cv := ui.Conversations(c, convs, &cur)
if k, t, ok := cv.Renamed(); ok { rename(k, t) }
if k, ok := cv.Deleted(); ok { remove(k) }

func (*ConversationsW) A11yLabel 实验性 ​

go
func (w *ConversationsW) A11yLabel(s string) *ConversationsW

A11yLabel sets the accessible name (default Locale.Chat.Conversations).

func (*ConversationsW) Deleted 实验性 ​

go
func (w *ConversationsW) Deleted() (string, bool)

Deleted returns the key whose delete action was used this frame.

func (*ConversationsW) Height 实验性 ​

go
func (w *ConversationsW) Height(px float32) *ConversationsW

Height fixes the list's height; longer lists scroll inside it. Default 0: the list grows with its rows (put it in a Scroll), as before. Call it, Virtual and ScrollToKey before Selected, Renamed and Deleted.

func (*ConversationsW) Layout 实验性 ​

go
func (w *ConversationsW) Layout(opts ...layout.Option) *ConversationsW

Layout applies layout options to the list.

func (*ConversationsW) NoDelete 实验性 ​

go
func (w *ConversationsW) NoDelete() *ConversationsW

NoDelete hides the delete action.

func (*ConversationsW) NoGroups 实验性 ​

go
func (w *ConversationsW) NoGroups() *ConversationsW

NoGroups lists the conversations without group headers.

func (*ConversationsW) NoRename 实验性 ​

go
func (w *ConversationsW) NoRename() *ConversationsW

NoRename hides the rename action.

func (*ConversationsW) Renamed 实验性 ​

go
func (w *ConversationsW) Renamed() (key, title string, ok bool)

Renamed returns the key and new title of a rename committed this frame.

func (*ConversationsW) ScrollToKey 实验性 ​

go
func (w *ConversationsW) ScrollToKey(key string, align string, offset float64) *ConversationsW

ScrollToKey scrolls the list (needs Height) to the conversation with key using align (AlignTop, AlignBottom or AlignAuto) plus offset pixels.

func (*ConversationsW) Selected 实验性 ​

go
func (w *ConversationsW) Selected() (string, bool)

Selected returns the key selected this frame.

func (*ConversationsW) Virtual 实验性 ​

go
func (w *ConversationsW) Virtual() *ConversationsW

Virtual builds only the rows in view (and a few past each edge) instead of every conversation; it needs Height and is ignored without it. The selected row and the row being renamed are always built, and the focused row is built on the frame it leaves the view, but focus inside a row clipped out of view is lost, as in the non-virtual Height form; Up / Down / Home / End move over every conversation and scroll the target into view. Rows out of view are missing from the accessibility tree (each option reports its position in the whole list) and FindText. The group layout is cached by the list's length, its first element and the day, and checked against the conversations in view every frame, so Time or Group edited in place (a conversation moved to today, the slice sorted in place) shows right as it comes into view. When the selected key is not in the list (a filtered list without the current conversation), every frame scans the list once for it.

CountdownW 实验性 ​

go
type CountdownW struct {
	// contains filtered or unexported fields
}

CountdownW counts down to a deadline (Statistic.Countdown / el-countdown) or, made by StatisticTimer with TimerCountup, counts up from a start time (Ant Statistic.Timer).

func Countdown 实验性 ​

go
func Countdown(c *Context, title string, deadline time.Time) *CountdownW

Countdown adds a countdown to deadline. Format tokens: D, HH, mm, ss, SSS (default "HH:mm:ss"); text in [brackets] is literal.

func StatisticTimer 实验性 ​

go
func StatisticTimer(c *Context, title string, typ TimerType, at time.Time) *CountdownW

StatisticTimer adds a timer statistic (Ant Statistic.Timer): with TimerCountdown it counts down to at like Countdown; with TimerCountup it shows the time elapsed since at (zero before at) and never finishes. Format, Prefix, Suffix, Color and OnChange apply to both.

func (*CountdownW) Color 实验性 ​

go
func (w *CountdownW) Color(col theme.Color) *CountdownW

Color sets the value color.

func (*CountdownW) Finished 实验性 ​

go
func (w *CountdownW) Finished() bool

Finished reports (once) that the deadline passed this frame.

func (*CountdownW) Format 实验性 ​

go
func (w *CountdownW) Format(f string) *CountdownW

Format sets the display format (see Countdown).

func (*CountdownW) OnChange 实验性 ​

go
func (w *CountdownW) OnChange(fn func(d time.Duration)) *CountdownW

OnChange runs fn with the time left (counting up: the time elapsed) whenever the displayed value changes, e.g. every second with the default format. It does not run on the first frame.

func (*CountdownW) Prefix 实验性 ​

go
func (w *CountdownW) Prefix(s string) *CountdownW

Prefix / Suffix add text around the value.

func (*CountdownW) Suffix 实验性 ​

go
func (w *CountdownW) Suffix(s string) *CountdownW

DamagePresenter 实验性 ​

go
type DamagePresenter interface {
	PresentDamage(img *image.RGBA, dirty []image.Rectangle) error
}

DamagePresenter is implemented by windows that can present only the changed parts of a CPU frame. Runner calls it instead of Present when the frame carries damage and the renderer is the CPU renderer.

img is the complete frame (the CPU renderer still rasterizes every pixel); dirty lists the device-pixel rectangles, within img.Bounds(), that differ from the previous frame presented through this window, so a host that keeps its own copy of the last frame may copy only those. Ownership of img is the same as for Present. Frames without damage hints (the first frame, resizes, scale/theme/reduced-motion changes, frames whose widgets declared nothing) still go through Present.

DatePickerLocale ​

go
type DatePickerLocale struct {
	SelectWeek, SelectMonth, SelectQuarter, SelectYear string // placeholders by granularity
	// RangePicker placeholders by granularity (date ranges use the
	// top-level StartDate / EndDate).
	StartWeek, EndWeek       string
	StartMonth, EndMonth     string
	StartQuarter, EndQuarter string
	StartYear, EndYear       string
	PrevDecade, NextDecade   string // year panel arrows
	WeekFmt                  string // week value, args: week-based year, week number, English ordinal suffix ("%[1]d-第%[2]d周")
	QuarterFmt               string // quarter value, args: year, quarter ("%[1]d-Q%[2]d")
	QuarterCellFmt           string // quarter cell of the panel, arg: quarter ("Q%d")
	// contains filtered or unexported fields
}

DatePickerLocale holds the texts of the week / month / quarter / year pickers and DatePickerPanel.

DatePickerPanelW 实验性 ​

go
type DatePickerPanelW struct {
	// contains filtered or unexported fields
}

DatePickerPanelW is an inline date panel.

func DatePickerPanel 实验性 ​

go
func DatePickerPanel(c *Context, val *time.Time) *DatePickerPanelW

DatePickerPanel adds an inline date panel bound to *val. Picked values are UTC midnights normalized to the start of their period (week start per Locale.WeekStart, first day of the month, quarter or year).

ui.DatePickerPanel(c, &day)
ui.DatePickerPanel(c, &from).Range(&to).Picker(ui.PickerMonth)

func (*DatePickerPanelW) Border 实验性 ​

go
func (w *DatePickerPanelW) Border(on bool) *DatePickerPanelW

Border toggles the panel border (default on).

func (*DatePickerPanelW) Changed 实验性 ​

go
func (w *DatePickerPanelW) Changed() bool

Changed reports a new value (both ends in range mode) this frame.

func (*DatePickerPanelW) Disabled 实验性 ​

go
func (w *DatePickerPanelW) Disabled(on bool) *DatePickerPanelW

Disabled turns the whole panel off.

func (*DatePickerPanelW) DisabledDate 实验性 ​

go
func (w *DatePickerPanelW) DisabledDate(fn func(time.Time) bool) *DatePickerPanelW

DisabledDate marks periods that cannot be picked (called with the first day of the period).

func (*DatePickerPanelW) MaxDate 实验性 ​

go
func (w *DatePickerPanelW) MaxDate(t time.Time) *DatePickerPanelW

MaxDate limits the pickable dates (Ant maxDate): periods wholly after t are disabled and the header arrows stop at t's page. Zero = no limit.

func (*DatePickerPanelW) MinDate 实验性 ​

go
func (w *DatePickerPanelW) MinDate(t time.Time) *DatePickerPanelW

MinDate limits the pickable dates (Ant minDate): periods wholly before t are disabled and the header arrows stop at t's page. Zero = no limit.

func (*DatePickerPanelW) Picker 实验性 ​

go
func (w *DatePickerPanelW) Picker(t PickerType) *DatePickerPanelW

Picker sets the granularity: PickerDate (default), PickerWeek, PickerMonth, PickerQuarter or PickerYear.

func (*DatePickerPanelW) Range 实验性 ​

go
func (w *DatePickerPanelW) Range(end *time.Time) *DatePickerPanelW

Range turns on range selection: *val holds the start and *end the end (both set by the second click; two panels side by side).

func (*DatePickerPanelW) ShowWeek 实验性 ​

go
func (w *DatePickerPanelW) ShowWeek(on bool) *DatePickerPanelW

ShowWeek adds the ISO week-number column to the day grid (Ant showWeek; the week picker always shows it).

func (*DatePickerPanelW) View 实验性 ​

go
func (w *DatePickerPanelW) View() PickerType

View returns the view level shown (PickerDate means the day grid).

DatePickerW ​

go
type DatePickerW struct {
	// contains filtered or unexported fields
}

DatePickerW is an input that opens a date panel (days, or weeks, months, quarters or years with Picker).

func DatePicker ​

go
func DatePicker(c *Context, val *time.Time) *DatePickerW

DatePicker adds a date input bound to *val. Picked values are UTC midnights (with Picker: the first day of the week, month, quarter or year).

The value can also be typed: printable keys edit the text in place and open the panel, which follows a valid date; Enter (or leaving the field) commits it, invalid or disabled text is dropped.

ConfigProvider.Defaults("DatePicker", ...) keys: "format", "placeholder", "picker" (PickerType), "allowClear", "width", "size", "variant", "placement", "showNow", "showWeek", "needConfirm".

func (*DatePickerW) A11yLabel ​

go
func (w *DatePickerW) A11yLabel(s string) *DatePickerW

A11yLabel sets the accessible name (inside a FormItem the item label is used; the placeholder is the last resort).

func (*DatePickerW) AllowClear ​

go
func (w *DatePickerW) AllowClear(on bool) *DatePickerW

AllowClear toggles the clear button shown on hover (on by default).

func (*DatePickerW) Changed ​

go
func (w *DatePickerW) Changed() bool

func (*DatePickerW) Disabled ​

go
func (w *DatePickerW) Disabled(on bool) *DatePickerW

func (*DatePickerW) DisabledDate ​

go
func (w *DatePickerW) DisabledDate(fn func(time.Time) bool) *DatePickerW

DisabledDate marks dates that cannot be picked (with Picker: called with the first day of the period).

func (*DatePickerW) Format ​

go
func (w *DatePickerW) Format(f string) *DatePickerW

Format sets the Go layout of the value (date, month and year pickers; week and quarter values use the Locale labels "2026-46th" / "2026-Q4").

func (*DatePickerW) IsOpen ​

go
func (w *DatePickerW) IsOpen() bool

IsOpen reports whether the panel is shown.

func (*DatePickerW) Layout ​

go
func (w *DatePickerW) Layout(o ...layout.Option) *DatePickerW

Layout applies layout options to the input.

func (*DatePickerW) MaxDate ​

go
func (w *DatePickerW) MaxDate(t time.Time) *DatePickerW

MaxDate limits the pickable dates (Ant maxDate), like MinDate.

func (*DatePickerW) MinDate ​

go
func (w *DatePickerW) MinDate(t time.Time) *DatePickerW

MinDate limits the pickable dates (Ant minDate): periods wholly before t cannot be picked or typed, and the panel arrows stop at t's page. Zero = no limit.

func (*DatePickerW) NeedConfirm ​

go
func (w *DatePickerW) NeedConfirm(on bool) *DatePickerW

NeedConfirm keeps a picked date as a draft until the footer's OK button (or Enter on the picked cell, or Enter after typing) commits it (Ant needConfirm); closing the panel otherwise drops the draft. Presets still commit immediately.

func (*DatePickerW) Open ​

go
func (w *DatePickerW) Open() *DatePickerW

Open forces the panel open (screenshots, tests).

func (*DatePickerW) Picker ​

go
func (w *DatePickerW) Picker(p PickerType) *DatePickerW

Picker sets the granularity: PickerDate (default), PickerWeek, PickerMonth, PickerQuarter or PickerYear (Ant picker, Element type). Clicking the panel titles switches between the year, month and day views.

func (*DatePickerW) Placeholder ​

go
func (w *DatePickerW) Placeholder(s string) *DatePickerW

func (*DatePickerW) Placement ​

go
func (w *DatePickerW) Placement(p Placement) *DatePickerW

Placement sets where the panel opens: BottomStart (default), BottomEnd, TopStart or TopEnd (Ant placement "bottomLeft" / "bottomRight" / "topLeft" / "topRight"); it flips when there is no room.

func (*DatePickerW) Presets ​

go
func (w *DatePickerW) Presets(p ...DatePreset) *DatePickerW

Presets adds a side list of named dates (DatePreset.Value) that pick immediately.

func (*DatePickerW) ShowNow ​

go
func (w *DatePickerW) ShowNow(on bool) *DatePickerW

ShowNow toggles the Today link in the panel footer (Ant showNow, on by default for the date picker).

func (*DatePickerW) ShowWeek ​

go
func (w *DatePickerW) ShowWeek(on bool) *DatePickerW

ShowWeek adds the ISO week-number column to the day grid (Ant showWeek; the week picker always shows it).

func (*DatePickerW) Size ​

go
func (w *DatePickerW) Size(s ControlSize) *DatePickerW

func (*DatePickerW) Status ​

go
func (w *DatePickerW) Status(s string) *DatePickerW

Status sets the validation look: "error" or "warning".

func (*DatePickerW) Variant ​

go
func (w *DatePickerW) Variant(v string) *DatePickerW

Variant sets the frame look: "outlined" (default), "filled", "borderless" or "underlined" (Ant variant).

func (*DatePickerW) Width ​

go
func (w *DatePickerW) Width(px float32) *DatePickerW

Width sets the input width in pixels (default 180).

DatePreset ​

go
type DatePreset struct {
	Label string
	Range [2]time.Time
	Value time.Time
	// contains filtered or unexported fields
}

DatePreset is a named value shown beside the picker panels: Range for RangePicker, Value for DatePicker (Range[0] when Value is zero).

DateTimePickerW 实验性 ​

go
type DateTimePickerW struct {
	// contains filtered or unexported fields
}

DateTimePickerW is an input whose dropdown combines a month calendar with time columns; the value is committed with "确定" or Enter.

func DateTimePicker 实验性 ​

go
func DateTimePicker(c *Context, val *time.Time) *DateTimePickerW

DateTimePicker adds a date-time input bound to *val (zero = empty).

func (*DateTimePickerW) A11yLabel 实验性 ​

go
func (w *DateTimePickerW) A11yLabel(s string) *DateTimePickerW

A11yLabel sets the accessible name (inside a FormItem the item label is used; the placeholder is the last resort).

func (*DateTimePickerW) AllowClear 实验性 ​

go
func (w *DateTimePickerW) AllowClear(on bool) *DateTimePickerW

func (*DateTimePickerW) Changed 实验性 ​

go
func (w *DateTimePickerW) Changed() bool

Changed reports a committed value this frame.

func (*DateTimePickerW) DefaultTime 实验性 ​

go
func (w *DateTimePickerW) DefaultTime(t time.Time) *DateTimePickerW

DefaultTime is the clock given to a day picked while no time is set (Element default-time, Ant showTime.defaultValue; default 00:00:00). Only its hour, minute and second are used.

func (*DateTimePickerW) Disabled 实验性 ​

go
func (w *DateTimePickerW) Disabled(on bool) *DateTimePickerW

Disabled disables the picker.

func (*DateTimePickerW) DisabledDate 实验性 ​

go
func (w *DateTimePickerW) DisabledDate(fn func(time.Time) bool) *DateTimePickerW

DisabledDate marks days that cannot be picked (called with UTC midnights); typed or preset values on such a day are not committed.

func (*DateTimePickerW) DisabledTime 实验性 ​

go
func (w *DateTimePickerW) DisabledTime(fn func(day time.Time) DisabledTimes) *DateTimePickerW

DisabledTime disables hours, minutes and seconds per day (Ant disabledTime): fn receives the drafted day (UTC midnight) and returns the options to grey out in the time columns. A value whose clock is disabled cannot be confirmed.

func (*DateTimePickerW) Format 实验性 ​

go
func (w *DateTimePickerW) Format(f string) *DateTimePickerW

Format sets the Go layout (default "2006-01-02 15:04:05"); omitting the seconds hides the second column.

func (*DateTimePickerW) IsOpen 实验性 ​

go
func (w *DateTimePickerW) IsOpen() bool

IsOpen reports whether the dropdown is shown.

func (*DateTimePickerW) Layout 实验性 ​

go
func (w *DateTimePickerW) Layout(o ...layout.Option) *DateTimePickerW

func (*DateTimePickerW) MaxDate 实验性 ​

go
func (w *DateTimePickerW) MaxDate(t time.Time) *DateTimePickerW

MaxDate limits the pickable days (Ant maxDate), like MinDate.

func (*DateTimePickerW) MinDate 实验性 ​

go
func (w *DateTimePickerW) MinDate(t time.Time) *DateTimePickerW

MinDate limits the pickable days (Ant minDate): earlier days cannot be picked, typed or confirmed and the month arrows stop at t's month.

func (*DateTimePickerW) Open 实验性 ​

go
func (w *DateTimePickerW) Open() *DateTimePickerW

Open forces the dropdown open (screenshots, tests).

func (*DateTimePickerW) Placeholder 实验性 ​

go
func (w *DateTimePickerW) Placeholder(s string) *DateTimePickerW

func (*DateTimePickerW) Placement 实验性 ​

go
func (w *DateTimePickerW) Placement(p Placement) *DateTimePickerW

Placement sets where the dropdown opens: BottomStart (default), BottomEnd, TopStart or TopEnd (Ant placement); it flips when there is no room.

func (*DateTimePickerW) Presets 实验性 ​

go
func (w *DateTimePickerW) Presets(p ...DatePreset) *DateTimePickerW

Presets adds a side list of named date-times (DatePreset.Value, else Range[0]) that commit immediately.

func (*DateTimePickerW) ShowNow 实验性 ​

go
func (w *DateTimePickerW) ShowNow(on bool) *DateTimePickerW

ShowNow toggles the Now action in the footer (Ant showNow, on by default).

func (*DateTimePickerW) Size 实验性 ​

go
func (w *DateTimePickerW) Size(s ControlSize) *DateTimePickerW

func (*DateTimePickerW) Status 实验性 ​

go
func (w *DateTimePickerW) Status(s string) *DateTimePickerW

func (*DateTimePickerW) Steps 实验性 ​

go
func (w *DateTimePickerW) Steps(h, m, s int) *DateTimePickerW

func (*DateTimePickerW) Variant 实验性 ​

go
func (w *DateTimePickerW) Variant(v string) *DateTimePickerW

Variant sets the frame look: "outlined" (default), "filled", "borderless" or "underlined".

func (*DateTimePickerW) Width 实验性 ​

go
func (w *DateTimePickerW) Width(px float32) *DateTimePickerW

DefaultFooterW 实验性 ​

go
type DefaultFooterW struct {
	// contains filtered or unexported fields
}

DefaultFooterW is the Pro page footer: a row of links above a copyright line, centred (Ant Design Pro DefaultFooter).

ui.DefaultFooter(c).Links(links).Copyright("© 2026 Tango").Show()

func DefaultFooter 实验性 ​

go
func DefaultFooter(c *Context) *DefaultFooterW

DefaultFooter starts a footer; chain options, then Show.

func (*DefaultFooterW) Clicked 实验性 ​

go
func (f *DefaultFooterW) Clicked() string

Clicked returns the Key of the link clicked in the last Show ("" if none).

func (*DefaultFooterW) Copyright 实验性 ​

go
func (f *DefaultFooterW) Copyright(s string) *DefaultFooterW

Copyright sets the line under the links (shown as given, so include the © sign yourself).

go
func (f *DefaultFooterW) Links(links []FooterLink) *DefaultFooterW

Links sets the link row.

func (*DefaultFooterW) Show 实验性 ​

go
func (f *DefaultFooterW) Show() *DefaultFooterW

Show builds the footer.

DescItem 实验性 ​

go
type DescItem struct {
	Label, Value string
	Span         int
	Render       func()
	// Spans sets the span from a breakpoint upwards (antd span={{ xs: 1,
	// md: 2 }}); the largest set breakpoint not above the window width
	// wins, Span is the fallback.
	Spans map[Breakpoint]int
	// Filled makes the item take the rest of its row and ends the row
	// (antd span: 'filled').
	Filled bool
}

DescItem is one label/value pair; Render replaces Value with custom content, Span takes several columns.

DescriptionsW 实验性 ​

go
type DescriptionsW struct {
	// contains filtered or unexported fields
}

DescriptionsW is a description list: title, extra, columns, bordered, sizes, vertical layout, label width, per-item span and custom render.

func Descriptions 实验性 ​

go
func Descriptions(c *Context, items []DescItem) *DescriptionsW

Descriptions adds a description list (no border). Without Column or a "column" default the column count follows antd's DEFAULT_COLUMN_MAP: 1 on xs, 2 on sm, 3 from md up. Modifiers apply until the end of the build; the content is built then.

ConfigProvider.Defaults("Descriptions", ...) keys: "column" (int or map[Breakpoint]int), "bordered", "size", "layout" ("vertical"), "colon" (bool).

func (*DescriptionsW) Bordered 实验性 ​

go
func (d *DescriptionsW) Bordered() *DescriptionsW

func (*DescriptionsW) Column 实验性 ​

go
func (d *DescriptionsW) Column(n int) *DescriptionsW

func (*DescriptionsW) ColumnAt 实验性 ​

go
func (d *DescriptionsW) ColumnAt(bp Breakpoint, n int) *DescriptionsW

ColumnAt sets the column count from breakpoint bp upwards (Ant column={{ xs: 1, sm: 2, md: 3 }}); the largest set breakpoint not above the window width wins, Column (default DEFAULT_COLUMN_MAP) is the fallback.

func (*DescriptionsW) Columns 实验性 ​

go
func (d *DescriptionsW) Columns(m map[Breakpoint]int) *DescriptionsW

Columns sets several breakpoint column counts at once.

func (*DescriptionsW) Extra 实验性 ​

go
func (d *DescriptionsW) Extra(fn func()) *DescriptionsW

func (*DescriptionsW) LabelBg 实验性 ​

go
func (d *DescriptionsW) LabelBg(col theme.Color) *DescriptionsW

LabelBg overrides the bordered label background.

func (*DescriptionsW) LabelWidth 实验性 ​

go
func (d *DescriptionsW) LabelWidth(px float32) *DescriptionsW

func (*DescriptionsW) Layout 实验性 ​

go
func (d *DescriptionsW) Layout(o ...layout.Option) *DescriptionsW

Layout applies layout options to the list.

func (*DescriptionsW) NoColon 实验性 ​

go
func (d *DescriptionsW) NoColon() *DescriptionsW

func (*DescriptionsW) Size 实验性 ​

go
func (d *DescriptionsW) Size(s ControlSize) *DescriptionsW

func (*DescriptionsW) Title 实验性 ​

go
func (d *DescriptionsW) Title(s string) *DescriptionsW

func (*DescriptionsW) Vertical 实验性 ​

go
func (d *DescriptionsW) Vertical() *DescriptionsW

Direction ​

go
type Direction uint8

Direction is the inline (horizontal) layout direction of a scope: left-to-right or right-to-left. It is unrelated to layout.Direction (Row / Column) and text.Direction (paragraph base direction).

Append-only: never reorder or insert; the zero value stays DirAuto.

go
const (
	// DirAuto derives the direction from the scope's Locale.
	DirAuto Direction = iota
	// LTR lays out from left to right.
	LTR
	// RTL lays out from right to left: rows start at the right edge,
	// Padding/Margin Left act as the start side, directional icons mirror.
	RTL
)

func DefaultDirection ​

go
func DefaultDirection() Direction

DefaultDirection returns the value set by SetDefaultDirection.

DisabledTimes 实验性 ​

go
type DisabledTimes struct {
	Hours   func(h int) bool
	Minutes func(h, m int) bool
	Seconds func(h, m, s int) bool
	// contains filtered or unexported fields
}

DisabledTimes lists the clock options that cannot be picked on one day (the result of a DisabledTime callback: Ant disabledTime). Nil fields disable nothing; values are 24-hour.

DividerW ​

go
type DividerW struct {
	*Box
	// contains filtered or unexported fields
}

DividerW is the Box of a Divider with its line options; it embeds the *Box, so code using the returned box keeps working.

ConfigProvider.Defaults("Divider", ...) keys: "dashed" (bool), "variant" ("solid" | "dashed" | "dotted"), "orientation" ("horizontal" | "vertical"; a title placement is still accepted), "vertical" (bool), "titlePlacement" ("start" | "end" | "left" | "right" | "center"), "plain" (bool), "size" (ControlSize).

func Divider ​

go
func Divider(c *Context, title ...string) *DividerW

Divider draws a horizontal rule, optionally with a title.

func (*DividerW) Dashed ​

go
func (d *DividerW) Dashed() *DividerW

Dashed draws a dashed line (Variant("dashed")).

func (*DividerW) Orientation ​

go
func (d *DividerW) Orientation(s string) *DividerW

Orientation sets the direction: "horizontal" (default) or "vertical" (Ant v6 orientation). A title placement ("left", "right", "center", "start", "end") is still accepted here and sets TitlePlacement, as Ant does for the pre-v6 meaning; new code sets the title placement with TitlePlacement.

func (*DividerW) Plain ​

go
func (d *DividerW) Plain() *DividerW

Plain shows the title in the normal text style (Ant plain).

func (*DividerW) Size ​

go
func (d *DividerW) Size(s ControlSize) *DividerW

Size sets the block margin of a horizontal divider (Ant size): Small 8px, Middle 16px; Large keeps the default.

func (*DividerW) TitlePlacement ​

go
func (d *DividerW) TitlePlacement(s string) *DividerW

TitlePlacement places the title: "start", "end" (logical), "left", "right" (physical) or "center" (default; Ant titlePlacement, Element content-position). Other values are ignored.

func (*DividerW) Variant ​

go
func (d *DividerW) Variant(v string) *DividerW

Variant sets the line style: "solid" (default), "dashed" or "dotted" (Ant variant, Element border-style). Other values are ignored.

func (*DividerW) Vertical ​

go
func (d *DividerW) Vertical() *DividerW

Vertical turns the divider into an inline vertical separator like VDivider (Ant vertical / orientation="vertical", Element direction="vertical"); a title is not shown.

DockAxis 实验性 ​

go
type DockAxis string

DockAxis is the direction of a DockNode split: DockRow lays its children side by side (in the reading direction), DockColumn stacks them.

go
const (
	DockRow    DockAxis = "row"
	DockColumn DockAxis = "column"
)

实验性

DockLayout 实验性 ​

go
type DockLayout struct {
	Root      *DockNode `json:"root"`
	Focus     string    `json:"focus,omitempty"`     // ID of the focused group (new tabs go there)
	Maximized string    `json:"maximized,omitempty"` // ID of the group filling the dock ("" when none)
	// contains filtered or unexported fields
}

DockLayout is the state of a Dock: a tree of splits whose leaves are tab groups, the focused group and the maximized one. The application owns it; Dock edits it in place as the user drags, closes, splits or resizes. It marshals to JSON with encoding/json (save it when DockW.Changed reports) and loads back with ParseDockLayout.

Methods keep the invariants (call Normalize after editing the tree by hand): every tab key appears once, splits have at least two children and never a child split of the same axis, sizes are positive fractions, group IDs are unique and only the root may be an empty group.

func NewDockLayout 实验性 ​

go
func NewDockLayout(tabs ...string) *DockLayout

NewDockLayout returns a layout with one group holding tabs (the first one active).

func ParseDockLayout 实验性 ​

go
func ParseDockLayout(data []byte) (*DockLayout, error)

ParseDockLayout decodes a layout saved with json.Marshal and repairs whatever breaks the invariants (unknown axes, missing IDs, repeated keys, wrong sizes), so a hand-edited or older file still loads.

func (*DockLayout) Activate 实验性 ​

go
func (l *DockLayout) Activate(key string) bool

Activate makes key the active tab of its group and focuses the group. It reports whether the layout holds key.

func (*DockLayout) AddTab 实验性 ​

go
func (l *DockLayout) AddTab(key, group string)

AddTab adds key to the group with ID group ("" for the focused group), after its active tab, and activates it. A key already in the layout is only activated.

func (*DockLayout) FocusGroup 实验性 ​

go
func (l *DockLayout) FocusGroup() *DockNode

FocusGroup returns the focused group (the first one when Focus names none).

func (*DockLayout) Group 实验性 ​

go
func (l *DockLayout) Group(id string) *DockNode

Group returns the group with the given ID (nil when none).

func (*DockLayout) GroupOf 实验性 ​

go
func (l *DockLayout) GroupOf(key string) *DockNode

GroupOf returns the group holding the tab key (nil when none).

func (*DockLayout) Groups 实验性 ​

go
func (l *DockLayout) Groups() []*DockNode

Groups returns the tab groups in reading order (depth first).

func (*DockLayout) MoveTab 实验性 ​

go
func (l *DockLayout) MoveTab(key, group string, index int) bool

MoveTab moves key into the group with ID group at index (clamped; < 0 appends) and activates it there. Moving within a group reorders it. It reports whether anything moved.

func (*DockLayout) Normalize 实验性 ​

go
func (l *DockLayout) Normalize()

Normalize restores the invariants after the tree was edited by hand: it drops nil children, repeated tab keys and empty groups (keeping one group), collapses splits with a single child, merges a split into a parent of the same axis, fixes sizes, unknown axes, missing or repeated group IDs and active tabs, and clears Focus / Maximized when they name no group.

func (*DockLayout) RemoveTab 实验性 ​

go
func (l *DockLayout) RemoveTab(key string) bool

RemoveTab removes key. A group left empty is removed (unless it is the last one) and its neighbours take its space; the group's next tab (or previous) becomes active. It reports whether the layout held key.

func (*DockLayout) SplitTab 实验性 ​

go
func (l *DockLayout) SplitTab(key, group string, side DockSide) (string, bool)

SplitTab moves key into a new group on side of the group with ID group (DockCenter appends it to that group instead) and returns the new group's ID. Splitting a group's only tab off itself does nothing.

DockLocale 实验性 ​

go
type DockLocale struct {
	Maximize, Restore, Split string // header buttons (accessible names, tooltips)
	Empty                    string // hint shown in a group without tabs
	Group                    string // accessible name of a tab group
	// contains filtered or unexported fields
}

DockLocale holds the Dock texts: the group header buttons, the hint of an empty group and the accessible name of a group.

DockNode 实验性 ​

go
type DockNode struct {

	// Group (leaf).
	ID     string   `json:"id,omitempty"`
	Tabs   []string `json:"tabs,omitempty"`
	Active string   `json:"active,omitempty"`

	// Split.
	Axis     DockAxis    `json:"axis,omitempty"`
	Children []*DockNode `json:"children,omitempty"`
	Sizes    []float64   `json:"sizes,omitempty"` // fractions of the split, one per child, summing to 1
	// contains filtered or unexported fields
}

DockNode is a node of a dock layout: a split (Axis set, Children with their Sizes) or a tab group (a leaf: ID, Tabs and the Active tab). Tabs holds application keys; Dock asks the application for each key's title and content.

func (*DockNode) IsGroup 实验性 ​

go
func (n *DockNode) IsGroup() bool

IsGroup reports whether n is a tab group (not a split).

DockSide 实验性 ​

go
type DockSide uint8

DockSide is where a tab lands relative to a group: in it (DockCenter) or in a new group beside it. DockLeft and DockRight are logical: in a right-to-left scope DockLeft is the right (start) side.

Append-only: never reorder or insert; existing values never change.

go
const (
	DockCenter DockSide = iota
	DockLeft
	DockRight
	DockTop
	DockBottom
)

实验性

DockW 实验性 ​

go
type DockW struct {
	// contains filtered or unexported fields
}

DockW is a docking layout (IDE workbench): nested horizontal / vertical splits whose leaves are tab groups, edited by the user and kept in a DockLayout the application owns.

func Dock 实验性 ​

go
func Dock(c *Context, l *DockLayout) *DockW

Dock adds a docking layout editing l: tab groups in nested splits. Drag a tab onto another group's tab bar to move it there, onto the left, right, top or bottom part of a group's content to split that group, or onto its middle to merge; a preview shows where it lands. Drag the bars between groups to resize them; the header buttons split the active tab to the right and maximize / restore the group. Tabs close with their x (or Delete), and a group left empty disappears.

Tab supplies each key's label and icon (TabItem.NoClose keeps a tab open), Content builds the active tab of each group. Call Show after the options, then read Changed (save l) and Closed. The layout is edited in place; the content of a tab keeps its widget state when the tab moves to another group.

Experimental: the API may change in any 0.x release.

func (*DockW) BeforeClose 实验性 ​

go
func (d *DockW) BeforeClose(fn func(key string) bool) *DockW

BeforeClose is asked before a tab closes; returning false keeps it (an unsaved document).

func (*DockW) Changed 实验性 ​

go
func (d *DockW) Changed() bool

Changed reports an edit of the layout this frame (a move, split, close, resize, maximize, focus or active tab change): the moment to save it.

func (*DockW) Closed 实验性 ​

go
func (d *DockW) Closed() string

Closed returns the key of the tab closed this frame ("" when none).

func (*DockW) Content 实验性 ​

go
func (d *DockW) Content(fn func(key string)) *DockW

Content sets the function that builds the content of a group's active tab. It runs once per visible group.

func (*DockW) OnTearOff 实验性 ​

go
func (d *DockW) OnTearOff(fn func(key string, pos geom.Point)) *DockW

OnTearOff lets a tab be dragged out of the window: released outside, the tab leaves the layout and fn runs with its key and the release point (window coordinates; see TabsW.OnTearOff). The application opens it in a new window.

func (*DockW) Show 实验性 ​

go
func (d *DockW) Show() *DockW

Show builds the dock.

func (*DockW) Style 实验性 ​

go
func (d *DockW) Style(opts ...layout.Option) *DockW

Style applies layout options to the dock (give it a size: layout.Grow(1), layout.H(480) ...).

func (*DockW) Tab 实验性 ​

go
func (d *DockW) Tab(fn func(key string) TabItem) *DockW

Tab sets how a tab key is shown (label, icon, NoClose, Disabled; Key is ignored). Without it the key is the label.

func (*DockW) TornOff 实验性 ​

go
func (d *DockW) TornOff() (key string, pos geom.Point, ok bool)

TornOff reports the tab torn off this frame (see OnTearOff).

DrawerPlacement ​

go
type DrawerPlacement uint8

DrawerPlacement selects the edge a Drawer slides from. DrawerEnd (the zero value and default) and DrawerStart are logical: in RTL the end is the left edge. DrawerRight and DrawerLeft always mean that physical edge.

Append-only: never reorder or insert; the zero value stays DrawerEnd.

go
const (
	DrawerEnd DrawerPlacement = iota
	DrawerRight
	DrawerLeft
	DrawerTop
	DrawerBottom
	DrawerStart
)

DrawerW ​

go
type DrawerW struct {
	// contains filtered or unexported fields
}

DrawerW is a panel sliding from a window edge: four placements, nested drawers push their parent aside, header extra, footer, sizes.

func Drawer ​

go
func Drawer(c *Context, open *bool, title string) *DrawerW

Drawer starts a drawer shown while *open; chain options, then Body. A Drawer opened inside another one's Body pushes the parent aside.

Besides the keys read in shad2c_defaults.go, ConfigProvider.Defaults( "Drawer", ...) reads "keyboard" (bool) and "closablePlacement" ("start" / "end").

func (*DrawerW) AfterOpenChanged ​

go
func (d *DrawerW) AfterOpenChanged() bool

AfterOpenChanged reports, after Body, that the open or close slide finished this frame (antd afterOpenChange; read *open for the state).

func (*DrawerW) BindSize ​

go
func (d *DrawerW) BindSize(px *float32) *DrawerW

BindSize binds the size to *px: a positive value overrides Size, and a resize writes the new size back.

func (*DrawerW) Body ​

go
func (d *DrawerW) Body(fn func()) *DrawerW

Body builds the drawer content.

func (*DrawerW) Closable ​

go
func (d *DrawerW) Closable(on bool) *DrawerW

func (*DrawerW) ClosablePlacement ​

go
func (d *DrawerW) ClosablePlacement(p string) *DrawerW

ClosablePlacement puts the close button "start" (before the title) or "end" (after the title and extra); default from the theme (Ant start, Element and shadcn end; antd closable.placement).

func (*DrawerW) Closed ​

go
func (d *DrawerW) Closed() bool

Closed reports close / mask / Escape this frame.

func (*DrawerW) CurrentSize ​

go
func (d *DrawerW) CurrentSize() float32

CurrentSize returns the width / height used this frame (after Body).

func (*DrawerW) Extra ​

go
func (d *DrawerW) Extra(fn func()) *DrawerW

func (*DrawerW) Footer ​

go
func (d *DrawerW) Footer(fn func()) *DrawerW

func (*DrawerW) Keyboard ​

go
func (d *DrawerW) Keyboard(on bool) *DrawerW

Keyboard sets whether Escape closes the drawer (default true; antd keyboard, Element close-on-press-escape).

func (*DrawerW) Large ​

go
func (d *DrawerW) Large() *DrawerW

Large uses the large preset (736).

func (*DrawerW) Loading ​

go
func (d *DrawerW) Loading(on bool) *DrawerW

Loading shows an active Skeleton instead of the content (antd loading).

func (*DrawerW) Mask ​

go
func (d *DrawerW) Mask(on bool) *DrawerW

func (*DrawerW) MaskBlur ​

go
func (d *DrawerW) MaskBlur(radius float32) *DrawerW

MaskBlur sets the Gaussian blur radius of the canvas behind the mask, in logical pixels. A zero radius draws the mask without blur.

func (*DrawerW) MaskClosable ​

go
func (d *DrawerW) MaskClosable(on bool) *DrawerW

func (*DrawerW) NoHeader ​

go
func (d *DrawerW) NoHeader() *DrawerW

func (*DrawerW) Placement ​

go
func (d *DrawerW) Placement(p DrawerPlacement) *DrawerW

Placement selects the edge (DrawerEnd default: right, left in RTL).

func (*DrawerW) Push ​

go
func (d *DrawerW) Push(px float32) *DrawerW

Push sets how far a nested drawer pushes this one aside (default 180; 0 turns it off; antd push.distance).

func (*DrawerW) Resizable ​

go
func (d *DrawerW) Resizable(on bool) *DrawerW

Resizable lets the user drag the edge facing the page to change the width (left / right) or height (top / bottom). The edge is also a focusable separator: arrow keys step 10px (Shift: 50px), Home / End go to the limits. The chosen size is kept while the drawer exists; use BindSize to own it.

func (*DrawerW) Resized ​

go
func (d *DrawerW) Resized() bool

Resized reports a size change by the user this frame.

func (*DrawerW) Size ​

go
func (d *DrawerW) Size(px float32) *DrawerW

Size sets the width (left/right) or height (top/bottom); default from theme.DrawerToken: 378 (Ant), 30% of the window (Element), 384 but at most 75% (shadcn Sheet).

func (*DrawerW) SizeLimits ​

go
func (d *DrawerW) SizeLimits(min, max float32) *DrawerW

SizeLimits bounds a resizable drawer (px). Zero min means 100; zero max means the window width / height.

Driver ​

go
type Driver struct {
	// contains filtered or unexported fields
}

Driver runs a page without a native window: inject events, run frames and read back the rendered *image.RGBA. It is used by tests, screenshot tools and the ui-gallery example. Time is simulated: it only advances through Advance / Settle, so output is deterministic.

只有部分成员是稳定的:未标「实验性」的方法和全部字段受兼容性承诺约束。

func NewDriver ​

go
func NewDriver(page func(*Context), o DriverOptions) *Driver

NewDriver creates a headless driver for page.

func (*Driver) A11yFind ​

go
func (d *Driver) A11yFind(role a11y.Role, name string) (*a11y.Node, bool)

A11yFind returns the first node with role and name in the last tree (a11y.RoleNone matches any role, "" any name).

func (*Driver) A11yFindAll ​

go
func (d *Driver) A11yFindAll(role a11y.Role, name string) []*a11y.Node

A11yFindAll returns every node with role and name in the last tree.

func (*Driver) A11yFocused ​

go
func (d *Driver) A11yFocused() *a11y.Node

A11yFocused returns the node with keyboard focus (nil if none).

func (*Driver) A11yPerform ​

go
func (d *Driver) A11yPerform(role a11y.Role, name string, act a11y.Action, arg string) error

A11yPerform finds the node with role and name and performs act on it.

func (*Driver) A11yUpdates 实验性 ​

go
func (d *Driver) A11yUpdates() (int, []a11y.NodeID)

A11yUpdates returns how many times the host was notified and the changed IDs of the last notification.

func (*Driver) AccessibilityTree 实验性 ​

go
func (d *Driver) AccessibilityTree() *a11y.Tree

AccessibilityTree returns the semantics tree of the last frame (nil until EnableAccessibility).

func (*Driver) Advance ​

go
func (d *Driver) Advance(dt time.Duration)

Advance moves simulated time forward.

func (*Driver) Audit 实验性 ​

go
func (d *Driver) Audit() AuditReport

Audit enables accessibility, settles and checks the current frame: interactive nodes without an accessible name, pointer targets without a role, controls the keyboard cannot reach, and contrast problems of the current theme (see theme.CheckContrast), and in right-to-left scopes directional icons drawn without mirroring. Drive the page into the state to check (open popups with Click / Key) before calling it.

func (*Driver) AuditNoContrast 实验性 ​

go
func (d *Driver) AuditNoContrast() AuditReport

AuditNoContrast is Audit without the theme contrast checks (when several pages share one theme and contrast is reported once).

func (*Driver) BackHandling 实验性 ​

go
func (d *Driver) BackHandling() bool

BackHandling reports what the runner last told the window through BackWindow: whether the system Back action has something to close.

func (*Driver) Click ​

go
func (d *Driver) Click(p geom.Point)

Click moves, presses and releases at p, then settles.

func (*Driver) ClickLabel ​

go
func (d *Driver) ClickLabel(text string) error

ClickLabel clicks the center of the first widget whose label is text.

func (*Driver) Clipboard ​

go
func (d *Driver) Clipboard() string

Clipboard returns the fake clipboard.

func (*Driver) Compose 实验性 ​

go
func (d *Driver) Compose(s string, cursor int)

Compose sets the IME composition string.

func (*Driver) ContentSize 实验性 ​

go
func (d *Driver) ContentSize() geom.Size

ContentSize returns the extent of the page's top-level widgets in the last frame (useful to size screenshots to their content).

func (*Driver) Cursor 实验性 ​

go
func (d *Driver) Cursor() input.Cursor

Cursor returns the cursor last requested by the UI.

func (*Driver) Drag ​

go
func (d *Driver) Drag(from, to geom.Point)

Drag presses at from, moves to to in a few steps (one frame each) and releases there, then settles.

func (*Driver) DropFiles 实验性 ​

go
func (d *Driver) DropFiles(p geom.Point, paths ...string)

DropFiles simulates dropping files at p (after FileDragLeave, as hosts do) and runs a frame.

func (*Driver) EnableAccessibility 实验性 ​

go
func (d *Driver) EnableAccessibility() *a11y.Tree

EnableAccessibility turns the semantics tree on (the fake window acts as an AccessibilityHost that asked for it), settles and returns the tree.

func (*Driver) FileDragLeave 实验性 ​

go
func (d *Driver) FileDragLeave()

FileDragLeave simulates the file drag leaving the window.

func (*Driver) FileDragOver 实验性 ​

go
func (d *Driver) FileDragOver(p geom.Point)

FileDragOver simulates files dragged over the window at p and runs a frame (tests).

func (*Driver) Find ​

go
func (d *Driver) Find(label string) (geom.Rect, bool)

Find returns the rect of the top-most interactive widget with label.

func (*Driver) FindText ​

go
func (d *Driver) FindText(text string) (geom.Rect, bool)

FindText returns the rect of a node labelled text in the last frame, including non-interactive ones (Text, Title, Paragraph, labels inside widgets) that Find does not see. Layers are searched top-most first. An exact label match wins; otherwise the first label containing text is used.

func (*Driver) Frame ​

go
func (d *Driver) Frame() *image.RGBA

Frame runs one frame and returns the image.

func (*Driver) Image ​

go
func (d *Driver) Image() *image.RGBA

Image returns the last frame.

func (*Driver) Inject 实验性 ​

go
func (d *Driver) Inject(e input.Event)

Inject queues an event (processed on the next Frame).

func (*Driver) Key ​

go
func (d *Driver) Key(k input.Key, mods input.Modifiers)

Key presses and releases a key.

func (*Driver) MirrorCheck 实验性 ​

go
func (d *Driver) MirrorCheck(page func(*Context), setup ...func(*Driver)) MirrorReport

MirrorCheck renders page left to right and right to left (wrapped in ConfigProvider(c).Direction(...)) at d's size, scale and theme, settles each frame (after the optional setup, e.g. opening a popup) and compares every node drawn in both frames.

Each node is checked relative to its parent: with p the parent's rectangle, the RTL node must sit at x' = p'.X + p.W - (x - p.X) - w, with the same y offset and size (±1px). Checking against the parent instead of the window (|X_rtl − (W − X_ltr − W_n)|) reports only the node at fault, not its whole subtree; for a chain of correctly mirrored parents the two are the same. Nodes without a parent drawn in both frames (overlay roots) are checked against the window.

Skipped: nodes with layout.Physical() (NoMirror) and children of boxes that lay out left to right in the RTL frame (an LTR scope such as a code editor or chart, or the window root outside the page's provider).

Icon check: every icon drawn in the RTL frame is recorded (see paint.List.IconNote); a directional icon drawn unmirrored while its node was painted in a right-to-left scope is reported in Icons, located at the deepest node containing it. Icons in LTR scopes are not reported; icons inside a NoMirror node or subtree are counted in IconsSkipped.

func (*Driver) Move ​

go
func (d *Driver) Move(p geom.Point)

Move moves the pointer and runs a frame.

func (*Driver) NeedsFrame ​

go
func (d *Driver) NeedsFrame() bool

NeedsFrame reports whether the UI asked for another frame.

func (*Driver) Now ​

go
func (d *Driver) Now() time.Time

Now returns simulated time.

func (*Driver) PerformAction 实验性 ​

go
func (d *Driver) PerformAction(id a11y.NodeID, act a11y.Action, arg string) error

PerformAction runs an accessibility action like a screen reader would (Runner.PerformAction) and settles.

func (*Driver) Pinch 实验性 ​

go
func (d *Driver) Pinch(center geom.Point, from, to float32)

Pinch puts two fingers down on a horizontal line through center, from apart, moves them symmetrically until they are to apart (to > from zooms in) and lifts them, then settles.

func (*Driver) Presented 实验性 ​

go
func (d *Driver) Presented() int

Presented returns how many frames were presented.

func (*Driver) Resize ​

go
func (d *Driver) Resize(w, h float32)

Resize changes the logical window size.

func (*Driver) RightClick ​

go
func (d *Driver) RightClick(p geom.Point)

RightClick presses and releases the secondary button at p (context menus), then settles.

func (*Driver) Runner ​

go
func (d *Driver) Runner() *Runner

Runner returns the underlying runner.

func (*Driver) SavePNG ​

go
func (d *Driver) SavePNG(path string) error

SavePNG writes the last frame to path, creating directories.

func (*Driver) Scroll ​

go
func (d *Driver) Scroll(p geom.Point, dy float32)

Scroll scrolls at p by dy.

func (*Driver) SetClipboard ​

go
func (d *Driver) SetClipboard(s string)

SetClipboard sets the fake clipboard.

func (*Driver) SetKeyboardInset ​

go
func (d *Driver) SetKeyboardInset(in geom.Insets)

SetKeyboardInset sets the keyboard inset the page sees (Runner.SetKeyboardInset); the next frame picks it up.

func (*Driver) SetSafeArea ​

go
func (d *Driver) SetSafeArea(in geom.Insets)

SetSafeArea sets the safe-area insets the page sees (Runner.SetSafeArea); the next frame picks them up.

func (*Driver) SetTheme ​

go
func (d *Driver) SetTheme(t *theme.Theme)

SetTheme switches theme.

func (*Driver) Settle ​

go
func (d *Driver) Settle() *image.RGBA

Settle runs frames, advancing simulated time 16ms per frame, until nothing animates (at most 2 simulated seconds).

func (*Driver) Tap ​

go
func (d *Driver) Tap(p geom.Point)

Tap touches p with one finger and lifts it in the same frame, then settles.

func (*Driver) TextInputActive 实验性 ​

go
func (d *Driver) TextInputActive() (bool, geom.Rect)

TextInputActive reports whether the UI requested IME input and the caret.

func (*Driver) TextInputState 实验性 ​

go
func (d *Driver) TextInputState() (input.TextInputState, bool)

TextInputState returns the text-input state the Runner last reported and whether one is in effect (tests).

func (*Driver) Touch 实验性 ​

go
func (d *Driver) Touch(id int64, phase input.TouchPhase, p geom.Point)

Touch injects one finger change and runs a frame.

func (*Driver) TouchDrag 实验性 ​

go
func (d *Driver) TouchDrag(from, to geom.Point)

TouchDrag puts one finger down at from, moves it to to in a few steps (one frame and touchStep of simulated time each) and lifts it, then settles.

func (*Driver) Touches 实验性 ​

go
func (d *Driver) Touches(evs ...input.TouchEvent)

Touches injects several finger changes delivered in the same frame and runs it.

func (*Driver) TwoFingerPan 实验性 ​

go
func (d *Driver) TwoFingerPan(from, to geom.Point, spread float32)

TwoFingerPan puts two fingers down around from (spread px apart), moves both to to without changing their distance and lifts them, then settles.

func (*Driver) Type ​

go
func (d *Driver) Type(s string)

Type delivers committed text to the focused widget.

DriverOptions ​

go
type DriverOptions struct {
	Width, Height float32 // logical size, default 1024×768
	Scale         float32 // default 1
	Theme         *theme.Theme
	Animations    bool // run transitions (default: jump to end state)
	ReduceMotion  bool // RunnerOptions.ReduceMotion (use with Animations)
	Accessibility bool // build the semantics tree from the first frame
	// contains filtered or unexported fields
}

DriverOptions configure a Driver.

DropZoneLocale 实验性 ​

go
type DropZoneLocale struct {
	Name, Release string
	// contains filtered or unexported fields
}

DropZoneLocale holds the DropZone accessible name and drag-over announcement.

DropZoneW 实验性 ​

go
type DropZoneW struct {
	// contains filtered or unexported fields
}

DropZoneW is an area that reacts to files dragged over the window (Ant Design Upload.Dragger's hover state, as a standalone wrapper):

z := ui.DropZone(c, func(over bool) {
	ui.Upload(c, &files).Dragger().DragOver(over)
}).Highlight(false)
if paths := z.Dropped(); paths != nil { ... }

Nested zones: the innermost (last built) zone under the drag wins.

func DropZone 实验性 ​

go
func DropZone(c *Context, body func(over bool)) *DropZoneW

DropZone builds body in a zone; body receives whether files are dragged over the zone (from the previous build pass, so it is stable within a frame).

func (*DropZoneW) A11yLabel 实验性 ​

go
func (z *DropZoneW) A11yLabel(s string) *DropZoneW

A11yLabel names the zone for screen readers ("" keeps the default).

func (*DropZoneW) Dropped 实验性 ​

go
func (z *DropZoneW) Dropped() []string

Dropped returns the paths of files dropped on the zone (Runner.DropFiles) once, or nil.

func (*DropZoneW) Highlight 实验性 ​

go
func (z *DropZoneW) Highlight(on bool) *DropZoneW

Highlight toggles the built-in highlight (a tinted, dashed overlay; default on). Turn it off when the content shows its own (Upload's Dragger with DragOver).

func (*DropZoneW) ID 实验性 ​

go
func (z *DropZoneW) ID() ID

ID returns the zone's widget ID.

func (*DropZoneW) Layout 实验性 ​

go
func (z *DropZoneW) Layout(o ...layout.Option) *DropZoneW

Layout applies layout options to the zone.

func (*DropZoneW) Over 实验性 ​

go
func (z *DropZoneW) Over() bool

Over reports files dragged over the zone.

func (*DropZoneW) TakeDrop 实验性 ​

go
func (z *DropZoneW) TakeDrop() (FileDrop, bool)

TakeDrop returns and consumes the pending drop on this zone. It shares consumption with Dropped, so use either query for a given drop.

go
type DropdownW struct {
	// contains filtered or unexported fields
}

DropdownW is a menu attached to a trigger: hover / click / context-menu triggers, nested submenus, placements, arrow, selected key, keyboard navigation, and the split-button form (Button).

go
func Dropdown(c *Context, items []MenuItem) *DropdownW

Dropdown starts a dropdown menu; chain options, then Body with the trigger content, or Button for a split button (Ant Dropdown.Button, Element split-button):

if k := ui.Dropdown(c, items).Trigger(ui.TriggerClick).Body(func() { ui.Button(c, "更多") }).Clicked(); k != "" { ... }
dd := ui.Dropdown(c, items).Primary().Button("提交")

ConfigProvider.Defaults("Dropdown", ...) keys: "trigger", "placement", "arrow", "disabled", "mouseEnterDelay" / "mouseLeaveDelay" (time.Duration; default the Dropdown token: Ant 150 / 100 ms, Element 150 / 150 ms), "autoFocus", "hideOnClick" (bool, default true).

go
func (d *DropdownW) Arrow() *DropdownW

Arrow draws a pointer towards the trigger.

go
func (d *DropdownW) ArrowPointAtCenter(on bool) *DropdownW

ArrowPointAtCenter draws the arrow (Arrow) at the centre of the trigger instead of near its aligned edge (antd arrow.pointAtCenter).

go
func (d *DropdownW) AutoFocus(on bool) *DropdownW

AutoFocus moves keyboard focus to the first enabled item whenever the menu opens, also by pointer (antd autoFocus; the keyboard always does).

go
func (d *DropdownW) Body(trigger func()) *DropdownW

Body builds the trigger and, when open, the menu.

go
func (d *DropdownW) Button(label string) *DropdownW

Button builds the split-button form: a main button labelled label joined with a menu button (Ant Dropdown.Button, Element split-button). Check ButtonClicked for the main part and Clicked for the chosen item.

Deprecated: use Compact + Button + Dropdown (antd 6 deprecates Dropdown.Button):

ui.Compact(c).Body(func() {
	ui.Button(c, "提交")
	ui.Dropdown(c, items).Placement(ui.BottomEnd).Body(func() { ui.Button(c, "").Icon(icon.More) })
})
go
func (d *DropdownW) ButtonClicked() bool

ButtonClicked reports a click on the main part of the Button form.

go
func (d *DropdownW) Check(key string, on *bool) *DropdownW

Check makes the item keyed key a checkbox item bound to on (shadcn DropdownMenuCheckboxItem): a check mark shows its state and choosing it toggles *on (Clicked still reports the key). The panel reserves an indicator column for it.

go
func (d *DropdownW) Clicked() string

Clicked returns the key chosen this frame ("" if none).

go
func (d *DropdownW) Danger() *DropdownW

Danger styles the Button form as dangerous.

go
func (d *DropdownW) Disabled(on bool) *DropdownW

Disabled prevents opening (and disables the Button form).

go
func (d *DropdownW) HideOnClick(on bool) *DropdownW

HideOnClick(false) keeps the menu open after an item is chosen (Element hide-on-click; default true).

go
func (d *DropdownW) ID() ID

ID returns the trigger box ID.

go
func (d *DropdownW) IsOpen() bool

IsOpen reports whether the menu is shown.

go
func (d *DropdownW) MaxHeight(px float32) *DropdownW

MaxHeight limits the menu panels' height (default: the window height); longer menus scroll and keyboard moves keep the active item visible.

go
func (d *DropdownW) MenuIcon(ic *icon.Icon) *DropdownW

MenuIcon replaces the menu button icon of the Button form.

go
func (d *DropdownW) MinWidth(px float32) *DropdownW

MinWidth sets the menu's minimum width.

go
func (d *DropdownW) MouseEnterDelay(dur time.Duration) *DropdownW

MouseEnterDelay waits d before a hover dropdown opens (antd mouseEnterDelay 0.15 s, Element show-timeout).

go
func (d *DropdownW) MouseLeaveDelay(dur time.Duration) *DropdownW

MouseLeaveDelay waits d before a hover dropdown closes once the pointer left the trigger and the menu (antd mouseLeaveDelay 0.1 s, Element hide-timeout).

go
func (d *DropdownW) Open(open *bool) *DropdownW

Open binds the open state.

go
func (d *DropdownW) OpenAt(p geom.Point) *DropdownW

OpenAt opens the menu at a window point (context menus).

go
func (d *DropdownW) OpenChanged() bool

OpenChanged reports that the menu opened or closed this frame.

go
func (d *DropdownW) OpenSource() string

OpenSource reports what opened or closed the menu this frame (when OpenChanged): "menu" when choosing an item closed it, else "trigger" (antd onOpenChange info.source).

go
func (d *DropdownW) Placement(p Placement) *DropdownW

Placement positions the menu (BottomStart, Bottom, BottomEnd, TopStart, Top, TopEnd).

go
func (d *DropdownW) PopupRender(fn func(menu func())) *DropdownW

PopupRender builds the panel content around the menu (antd popupRender, v6 name of dropdownRender): call menu() where the items go, add other content before or after it.

go
func (d *DropdownW) Primary() *DropdownW

Primary styles the Button form as primary.

go
func (d *DropdownW) Radio(value *string, keys ...string) *DropdownW

Radio makes the items keyed keys a radio group bound to value (shadcn DropdownMenuRadioGroup): the item whose key equals *value shows a dot and choosing an item stores its key.

go
func (d *DropdownW) Selected(key string) *DropdownW

Selected highlights an item.

go
func (d *DropdownW) Size(s ControlSize) *DropdownW

Size sets the control size of the Button form.

go
func (d *DropdownW) Trigger(t Trigger) *DropdownW

Trigger selects hover (default), click or context-menu activation.

EditableProTableW 实验性 ​

go
type EditableProTableW[T any] struct {
	// contains filtered or unexported fields
}

EditableProTableW is a table over app-owned rows edited in place (Ant Design Pro EditableProTable): columns with an Editor show the ProField control of their value type while a row is edited; an action column offers edit / save / cancel / delete; "add a row" creates a draft row that joins the data when saved. Rows are validated (Required, Rules, Validate, AsyncValidate of every editor) before they are written back.

ui.EditableProTable(c, cols, &rows).RowKey(func(r Row) string { return r.ID }).
	NewRow(func() Row { return Row{ID: newID()} }).
	OnSave(func(r Row, i int, done func(error)) { go save(r, done) }).
	Show()

func EditableProTable 实验性 ​

go
func EditableProTable[T any](c *Context, cols []ProColumn[T], rows *[]T) *EditableProTableW[T]

EditableProTable starts an editable table over *rows; chain options, then Show.

func (*EditableProTableW[T]) AddAtTop 实验性 ​

go
func (e *EditableProTableW[T]) AddAtTop() *EditableProTableW[T]

AddAtTop puts new rows (and the add button) above the data.

func (*EditableProTableW[T]) AddRow 实验性 ​

go
func (e *EditableProTableW[T]) AddRow() string

AddRow adds a new draft row in edit mode (as the add button does) and returns its key ("" when NewRow is not set or another row is being edited in single mode).

func (*EditableProTableW[T]) Bordered 实验性 ​

go
func (e *EditableProTableW[T]) Bordered() *EditableProTableW[T]

Bordered draws cell borders.

func (*EditableProTableW[T]) Cancel 实验性 ​

go
func (e *EditableProTableW[T]) Cancel(k string)

Cancel leaves edit mode of row k without saving (a new row is dropped).

func (*EditableProTableW[T]) Changed 实验性 ​

go
func (e *EditableProTableW[T]) Changed() bool

Changed reports any change of *rows in the last Show.

func (*EditableProTableW[T]) Deleted 实验性 ​

go
func (e *EditableProTableW[T]) Deleted() bool

Deleted reports a deleted row in the last Show.

func (*EditableProTableW[T]) DragSort 实验性 ​

go
func (e *EditableProTableW[T]) DragSort(fn func(from, to int)) *EditableProTableW[T]

DragSort adds a drag handle column that reorders *rows; fn (may be nil) is told the move (indices into *rows) after it happened.

func (*EditableProTableW[T]) Edit 实验性 ​

go
func (e *EditableProTableW[T]) Edit(k string)

Edit puts the row with key k into edit mode (valid after Show).

func (*EditableProTableW[T]) EditableKeys 实验性 ​

go
func (e *EditableProTableW[T]) EditableKeys(keys *[]string) *EditableProTableW[T]

EditableKeys binds the keys of the rows being edited (controlled).

func (*EditableProTableW[T]) Editing 实验性 ​

go
func (e *EditableProTableW[T]) Editing(k string) bool

Editing reports whether the row with key k is in edit mode.

func (*EditableProTableW[T]) Errors 实验性 ​

go
func (e *EditableProTableW[T]) Errors(k string) map[string]string

Errors returns the validation messages of the row with key k by column key (nil when valid).

func (*EditableProTableW[T]) ID 实验性 ​

go
func (e *EditableProTableW[T]) ID() ID

ID returns the widget ID (valid after Show).

func (*EditableProTableW[T]) MaxLength 实验性 ​

go
func (e *EditableProTableW[T]) MaxLength(n int) *EditableProTableW[T]

MaxLength hides the add button once there are n rows.

func (*EditableProTableW[T]) Moved 实验性 ​

go
func (e *EditableProTableW[T]) Moved() bool

Moved reports a drag-sort move in the last Show.

func (*EditableProTableW[T]) Multiple 实验性 ​

go
func (e *EditableProTableW[T]) Multiple() *EditableProTableW[T]

Multiple lets several rows be edited at once (default: one; the other rows' edit actions are disabled meanwhile).

func (*EditableProTableW[T]) NewRow 实验性 ​

go
func (e *EditableProTableW[T]) NewRow(fn func() T) *EditableProTableW[T]

NewRow shows the "add a row" button; fn creates the draft row (set its key there). The new row opens in edit mode and joins *rows when saved.

func (*EditableProTableW[T]) NoDelete 实验性 ​

go
func (e *EditableProTableW[T]) NoDelete() *EditableProTableW[T]

NoDelete hides the delete action.

func (*EditableProTableW[T]) OnDelete 实验性 ​

go
func (e *EditableProTableW[T]) OnDelete(fn func(row T, index int)) *EditableProTableW[T]

OnDelete is called after a confirmed delete instead of removing the row from *rows (the app removes it, e.g. after a server call).

func (*EditableProTableW[T]) OnSave 实验性 ​

go
func (e *EditableProTableW[T]) OnSave(fn func(row T, index int, done func(error))) *EditableProTableW[T]

OnSave receives a validated row (index -1 for a new row) before it is written back; call done from any goroutine. A nil error writes the row into *rows, an error keeps the row in edit mode and shows the message.

func (*EditableProTableW[T]) Pagination 实验性 ​

go
func (e *EditableProTableW[T]) Pagination(n int) *EditableProTableW[T]

Pagination pages the rows locally, n per page.

func (*EditableProTableW[T]) RowEditable 实验性 ​

go
func (e *EditableProTableW[T]) RowEditable(fn func(row T) bool) *EditableProTableW[T]

RowEditable limits which rows can be edited.

func (*EditableProTableW[T]) RowKey 实验性 ​

go
func (e *EditableProTableW[T]) RowKey(f func(T) string) *EditableProTableW[T]

RowKey gives rows stable keys (needed when rows are inserted, deleted or reordered while one is edited; default: the row index).

func (*EditableProTableW[T]) Save 实验性 ​

go
func (e *EditableProTableW[T]) Save(k string)

Save validates the edited row k and writes it back (as its save action does; valid after Show).

func (*EditableProTableW[T]) Saved 实验性 ​

go
func (e *EditableProTableW[T]) Saved() bool

Saved reports a row written back in the last Show.

func (*EditableProTableW[T]) ScrollX 实验性 ​

go
func (e *EditableProTableW[T]) ScrollX(w float32) *EditableProTableW[T]

ScrollX sets the table's scroll width.

func (*EditableProTableW[T]) ScrollY 实验性 ​

go
func (e *EditableProTableW[T]) ScrollY(maxH float32) *EditableProTableW[T]

ScrollY bounds the table body to maxH (TableW.ScrollY): the header stays in place and only the visible rows are built, so many thousand rows stay fast. Rows being edited are always built, even scrolled out of view, so their drafts and focus survive; starting to edit a row (Edit, AddRow), focus moving into an edited row (Tab), typing in one and a failed validation scroll it into view. An edited key not found among the rows is not looked up again every frame: a key that reappears in place (a row re-keyed at the same row count) is picked up once the row count changes or a new rows slice is passed. The toolbar and the add button stay outside the scrolling body. Default 0: unbounded, every row is built.

func (*EditableProTableW[T]) Show 实验性 ​

go
func (e *EditableProTableW[T]) Show() *EditableProTableW[T]

Show builds the table.

func (*EditableProTableW[T]) Size 实验性 ​

go
func (e *EditableProTableW[T]) Size(s ControlSize) *EditableProTableW[T]

Size sets the density.

func (*EditableProTableW[T]) Table 实验性 ​

go
func (e *EditableProTableW[T]) Table() *TableW

Table returns the inner table of the last Show.

func (*EditableProTableW[T]) Title 实验性 ​

go
func (e *EditableProTableW[T]) Title(s string) *EditableProTableW[T]

Title sets the toolbar title.

func (*EditableProTableW[T]) ToolBar 实验性 ​

go
func (e *EditableProTableW[T]) ToolBar(fn func()) *EditableProTableW[T]

ToolBar adds actions at the right of the toolbar.

func (*EditableProTableW[T]) Validating 实验性 ​

go
func (e *EditableProTableW[T]) Validating(k string) bool

Validating reports async validations or a save in flight for row k.

func (*EditableProTableW[T]) Virtual 实验性 ​

go
func (e *EditableProTableW[T]) Virtual() *EditableProTableW[T]

Virtual is TableW.Virtual for the inner table: with ScrollY the body is windowed either way, Virtual states the intent (and takes the theme's Table V2 row height where it has one, as TableW.Virtual). Otherwise rows keep the height of the density (Size).

EditableTableLocale 实验性 ​

go
type EditableTableLocale struct {
	Actions       string // title of the action column
	DeleteConfirm string // Popconfirm of the delete action
	// contains filtered or unexported fields
}

EditableTableLocale holds the EditableProTable texts.

EmptyW ​

go
type EmptyW struct {
	// contains filtered or unexported fields
}

EmptyW is an empty state: Ant's default/simple pictures or Element's illustration, custom image, size, description and actions.

func Empty ​

go
func Empty(c *Context) *EmptyW

Empty adds the "no data" placeholder. Modifiers apply until the end of the build (or Body); the content is built then.

ui.Empty(c)
ui.Empty(c).Simple().Description("暂无订单")
ui.Empty(c).Body(func() { ui.Button(c, "立即创建").Primary() })

func (*EmptyW) Body ​

go
func (e *EmptyW) Body(fn func()) *Box

Body adds actions (buttons) below the description and builds the empty state.

func (*EmptyW) Description ​

go
func (e *EmptyW) Description(s string) *EmptyW

Description sets the text ("" hides it).

func (*EmptyW) Image ​

go
func (e *EmptyW) Image(fn func()) *EmptyW

Image replaces the picture with custom content.

func (*EmptyW) ImageSize ​

go
func (e *EmptyW) ImageSize(px float32) *EmptyW

ImageSize sets the picture height (Ant default 100, simple 40, Element 160).

func (*EmptyW) Layout ​

go
func (e *EmptyW) Layout(o ...layout.Option) *EmptyW

Layout applies layout options to the empty state.

func (*EmptyW) Simple ​

go
func (e *EmptyW) Simple() *EmptyW

Simple uses the compact picture and spacing (Ant PRESENTED_IMAGE_SIMPLE; used inside selects, tables and lists in both design systems).

func (*EmptyW) Title ​

go
func (e *EmptyW) Title(s string) *EmptyW

Title adds a heading between the picture and the description (shadcn EmptyTitle: text-lg font-medium).

FieldVariant 实验性 ​

go
type FieldVariant string

FieldVariant is the frame look of an input-like selector (Ant variant): AutoComplete, Mentions, Select, MultiSelect, Cascader and TreeSelect take it. The values are the strings Input.Variant and the date pickers accept, so FieldVariant(s) converts a string default.

go
const (
	// FieldOutlined is the default bordered frame.
	FieldOutlined FieldVariant = "outlined"
	// FieldFilled is a tinted fill whose border shows on focus.
	FieldFilled FieldVariant = "filled"
	// FieldBorderless draws no frame (the padding stays).
	FieldBorderless FieldVariant = "borderless"
	// FieldUnderlined draws only the bottom line.
	FieldUnderlined FieldVariant = "underlined"
)

实验性

FileDrop 实验性 ​

go
type FileDrop struct {
	Position geom.Point
	Paths    []string
}

FileDrop describes a file drop. Position uses the same UI logical coordinates as Context.Pointer and Context.RectOf.

FlexW ​

go
type FlexW struct {
	// contains filtered or unexported fields
}

FlexW is a flex container with design-token gaps (Ant Flex).

func Flex ​

go
func Flex(c *Context) *FlexW

Flex starts a horizontal flex box; chain options, then Body.

func (*FlexW) Align ​

go
func (f *FlexW) Align(a layout.Align) *FlexW

Align positions children on the cross axis.

func (*FlexW) Body ​

go
func (f *FlexW) Body(fn func()) *Box

Body adds the children.

func (*FlexW) Gap ​

go
func (f *FlexW) Gap(s ControlSize) *FlexW

Gap sets the gap with a size token (Small 8, Middle 16, Large 24).

func (*FlexW) GapPx ​

go
func (f *FlexW) GapPx(px float32) *FlexW

GapPx sets the gap in pixels.

func (*FlexW) Justify ​

go
func (f *FlexW) Justify(j layout.Justify) *FlexW

Justify distributes free space on the main axis.

func (*FlexW) Orientation ​

go
func (f *FlexW) Orientation(o string) *FlexW

Orientation sets the direction: "horizontal" (default) or "vertical" (Ant v6 orientation). Other values are ignored.

func (*FlexW) Style ​

go
func (f *FlexW) Style(opts ...layout.Option) *FlexW

Style applies extra layout options.

func (*FlexW) Vertical ​

go
func (f *FlexW) Vertical() *FlexW

Vertical lays children top to bottom.

func (*FlexW) Wrap ​

go
func (f *FlexW) Wrap() *FlexW

Wrap wraps children onto new lines.

FloatButtonGroupW 实验性 ​

go
type FloatButtonGroupW struct {
	// contains filtered or unexported fields
}

FloatButtonGroupW stacks float buttons; with a trigger it collapses them behind a menu button.

func FloatButtonGroup 实验性 ​

go
func FloatButtonGroup(c *Context) *FloatButtonGroupW

FloatButtonGroup starts a group; chain options, then Body with FloatButton calls.

func (*FloatButtonGroupW) Body 实验性 ​

go
func (g *FloatButtonGroupW) Body(fn func()) *FloatButtonGroupW

Body builds the members.

func (*FloatButtonGroupW) Icon 实验性 ​

go
func (g *FloatButtonGroupW) Icon(ic *icon.Icon) *FloatButtonGroupW

Icon sets the menu button icon (default: a plus that turns into a cross).

func (*FloatButtonGroupW) IsOpen 实验性 ​

go
func (g *FloatButtonGroupW) IsOpen() bool

IsOpen reports whether the members are shown.

func (*FloatButtonGroupW) Open 实验性 ​

go
func (g *FloatButtonGroupW) Open(open *bool) *FloatButtonGroupW

Open binds the open state of a triggered group.

func (*FloatButtonGroupW) Position 实验性 ​

go
func (g *FloatButtonGroupW) Position(right, bottom float32) *FloatButtonGroupW

Position sets the distance from the right and bottom window edges.

func (*FloatButtonGroupW) Primary 实验性 ​

go
func (g *FloatButtonGroupW) Primary() *FloatButtonGroupW

Primary colors the menu button.

func (*FloatButtonGroupW) Square 实验性 ​

go
func (g *FloatButtonGroupW) Square() *FloatButtonGroupW

Square joins the buttons in one rounded card with separators.

func (*FloatButtonGroupW) Trigger 实验性 ​

go
func (g *FloatButtonGroupW) Trigger(t string) *FloatButtonGroupW

Trigger collapses the group behind a menu button opened by "click" or "hover".

FloatButtonW 实验性 ​

go
type FloatButtonW struct {
	// contains filtered or unexported fields
}

FloatButtonW is a button floating above the page at a window corner.

func FloatButton 实验性 ​

go
func FloatButton(c *Context) *FloatButtonW

FloatButton adds a floating action button (default bottom-right, 24px from the right and 48px from the bottom). Inside a FloatButtonGroup it becomes a member of the group.

func (*FloatButtonW) A11yLabel 实验性 ​

go
func (f *FloatButtonW) A11yLabel(s string) *FloatButtonW

A11yLabel sets the accessible name of an icon-only button without a tooltip.

func (*FloatButtonW) Badge 实验性 ​

go
func (f *FloatButtonW) Badge(n int) *FloatButtonW

Badge shows a count (dot when n < 0).

func (*FloatButtonW) Bottom 实验性 ​

go
func (f *FloatButtonW) Bottom(px float32) *FloatButtonW

Bottom sets the distance from the bottom window edge.

func (*FloatButtonW) Clicked 实验性 ​

go
func (f *FloatButtonW) Clicked() bool

Clicked reports activation.

func (*FloatButtonW) Description 实验性 ​

go
func (f *FloatButtonW) Description(s string) *FloatButtonW

Description shows a short caption below the icon (square shape).

func (*FloatButtonW) ID 实验性 ​

go
func (f *FloatButtonW) ID() ID

ID returns the widget ID.

func (*FloatButtonW) Icon 实验性 ​

go
func (f *FloatButtonW) Icon(ic *icon.Icon) *FloatButtonW

Icon sets the icon.

func (*FloatButtonW) Primary 实验性 ​

go
func (f *FloatButtonW) Primary() *FloatButtonW

Primary uses the brand color.

func (*FloatButtonW) Right 实验性 ​

go
func (f *FloatButtonW) Right(px float32) *FloatButtonW

Right sets the distance from the right window edge (the end edge: the left one in a right-to-left scope).

func (*FloatButtonW) Square 实验性 ​

go
func (f *FloatButtonW) Square() *FloatButtonW

Square uses a rounded square instead of a circle.

func (*FloatButtonW) Tooltip 实验性 ​

go
func (f *FloatButtonW) Tooltip(s string) *FloatButtonW

Tooltip shows a tip on hover, towards the page (left; right in RTL).

go
type FooterLink struct {
	Key     string
	Title   string
	Icon    *icon.Icon // shown alone when Title is ""
	OnClick func()
	// contains filtered or unexported fields
}

FooterLink is one link of DefaultFooter.

FooterToolbarW 实验性 ​

go
type FooterToolbarW struct {
	// contains filtered or unexported fields
}

FooterToolbarW builds a FooterToolbar.

func FooterToolbar 实验性 ​

go
func FooterToolbar(c *Context) *FooterToolbarW

FooterToolbar starts a bottom action bar; chain options, then Body with the right-hand buttons.

ConfigProvider.Defaults("FooterToolbar", ...) keys: "fixed" (bool, default true), "sticky" (legacy bool).

func (*FooterToolbarW) Body 实验性 ​

go
func (f *FooterToolbarW) Body(fn func()) *FooterToolbarW

Body builds the bar with fn as the right-hand actions.

func (*FooterToolbarW) Extra 实验性 ​

go
func (f *FooterToolbarW) Extra(fn func()) *FooterToolbarW

Extra builds content at the left of the bar.

func (*FooterToolbarW) Fixed 实验性 ​

go
func (f *FooterToolbarW) Fixed(on bool) *FooterToolbarW

Fixed controls whether the bar is pinned to the bottom (default true). Fixed(false) places it in normal flow. Sticky remains an alias for enabling it.

func (*FooterToolbarW) ID 实验性 ​

go
func (f *FooterToolbarW) ID() ID

ID returns the bar's widget ID (after Body).

func (*FooterToolbarW) Layout 实验性 ​

go
func (f *FooterToolbarW) Layout(o ...layout.Option) *FooterToolbarW

Layout applies layout options to the bar.

func (*FooterToolbarW) Sticky 实验性 ​

go
func (f *FooterToolbarW) Sticky() *FooterToolbarW

Sticky pins the bar to the bottom of the viewport while the content above scrolls (Affix with offset bottom 0).

func (*FooterToolbarW) Target 实验性 ​

go
func (f *FooterToolbarW) Target(id ID) *FooterToolbarW

Target makes Sticky pin to the bottom of a scroll box (ScrollBox.ID()) instead of the window.

FormItemW ​

go
type FormItemW struct {
	// contains filtered or unexported fields
}

FormItemW is one labelled form row.

func RulesOf 实验性 ​

go
func RulesOf[T any](it *FormItemW, val *T, rules ...RuleOf[T]) *FormItemW

RulesOf attaches typed rules to *val (numbers, booleans, slices …) and binds the value for ResetFields; it is Rules for any type. The item's Value (FormW.Value, Dependencies) is the value formatted with fmt.

ui.RulesOf(form.Item("年龄"), &age, ui.RangeValue(18.0, 60.0, "18–60"))

func (*FormItemW) Body ​

go
func (it *FormItemW) Body(fn func())

Body builds the control(s) of the item.

func (*FormItemW) Dependencies ​

go
func (it *FormItemW) Dependencies(names ...string) *FormItemW

Dependencies names fields this item depends on: when one of their values changes the item re-validates (if it has a value or was validated) and OnDepsChange runs (reset a dependent value, refresh options).

func (*FormItemW) Disabled ​

go
func (it *FormItemW) Disabled(on bool) *FormItemW

Disabled disables every control of the item.

func (*FormItemW) Error ​

go
func (it *FormItemW) Error(msg string) *FormItemW

func (*FormItemW) Extra ​

go
func (it *FormItemW) Extra(s string) *FormItemW

Extra shows a description line under the control and its message (Ant Form.Item extra).

func (*FormItemW) ExtraBody ​

go
func (it *FormItemW) ExtraBody(fn func()) *FormItemW

ExtraBody builds custom content under the control (Extra as content).

func (*FormItemW) Help ​

go
func (it *FormItemW) Help(msg string) *FormItemW

func (*FormItemW) Hidden ​

go
func (it *FormItemW) Hidden(on bool) *FormItemW

Hidden skips the item: nothing is built and it is not validated.

func (*FormItemW) Name ​

go
func (it *FormItemW) Name(name string) *FormItemW

Name sets the field name that keys the item's validation state (default: the label). Items with the same label (Form.List rows) need distinct names.

func (*FormItemW) NoLabel ​

go
func (it *FormItemW) NoLabel() *FormItemW

NoLabel aligns the control with labelled items but shows no label (submit row).

func (*FormItemW) OnDepsChange ​

go
func (it *FormItemW) OnDepsChange(fn func()) *FormItemW

OnDepsChange runs fn when a dependency's value changed.

func (*FormItemW) OnReset ​

go
func (it *FormItemW) OnReset(fn func()) *FormItemW

OnReset makes ResetFields call fn for this item: items bound with RulesFunc have no pointer the form could restore, so the application resets its own value (Rules and RulesOf restore automatically).

f.Item("生日").RulesFunc(func() string { return d.Format(ui.DateLayout) }, ...).OnReset(func() { d = time.Time{} })

func (*FormItemW) Required ​

go
func (it *FormItemW) Required() *FormItemW

func (*FormItemW) Rules ​

go
func (it *FormItemW) Rules(val *string, rules ...Rule) *FormItemW

Rules attaches validation rules to a string value. The item validates live once the value changed (see ValidateTrigger), and on FormW.Validate. The value is restored by FormW.ResetFields.

func (*FormItemW) RulesFunc ​

go
func (it *FormItemW) RulesFunc(val func() string, rules ...Rule) *FormItemW

RulesFunc is Rules for values that are not strings (format them).

func (*FormItemW) Tooltip ​

go
func (it *FormItemW) Tooltip(tip string) *FormItemW

Tooltip shows a question-mark icon after the label with a tooltip (Ant Form.Item tooltip).

func (*FormItemW) ValidateStatus ​

go
func (it *FormItemW) ValidateStatus(s string) *FormItemW

ValidateStatus sets the status by hand: "success" | "warning" | "error" | "validating" (Ant validateStatus). The Help text takes the status color; a failing rule still shows its error.

func (*FormItemW) ValidateTrigger ​

go
func (it *FormItemW) ValidateTrigger(t FormTrigger) *FormItemW

ValidateTrigger sets when this item validates (see FormTrigger).

FormLayout 实验性 ​

go
type FormLayout uint8

FormLayout arranges labels and controls.

Append-only: never reorder or insert; the zero value stays FormHorizontal.

go
const (
	FormHorizontal FormLayout = iota // label left of the control
	FormVertical                     // label above
	FormInline                       // items in a wrapping row
)

实验性

FormListRow 实验性 ​

go
type FormListRow[T any] struct {
	Index int
	Value *T     // the row's element (valid during the callback)
	Key   string // stable key of the row
	// contains filtered or unexported fields
}

FormListRow is one row passed to FormListW.Body.

func (*FormListRow[T]) MoveDown 实验性 ​

go
func (r *FormListRow[T]) MoveDown()

MoveDown swaps the row with the one below.

func (*FormListRow[T]) MoveUp 实验性 ​

go
func (r *FormListRow[T]) MoveUp()

MoveUp swaps the row with the one above.

func (*FormListRow[T]) Name 实验性 ​

go
func (r *FormListRow[T]) Name(field string) string

Name returns a field name unique to this row ("label.key.field").

func (*FormListRow[T]) Remove 实验性 ​

go
func (r *FormListRow[T]) Remove()

Remove deletes the row (after the rows are built).

FormListW 实验性 ​

go
type FormListW[T any] struct {
	// contains filtered or unexported fields
}

FormListW is a dynamic list of form rows bound to a slice (Ant Design Form.List / ProFormList): rows can be added, removed and moved; every row's items validate on their own (give them row.Name(field)).

ui.FormList(f, "联系人", &contacts).Min(1).Max(5).
	Creator(func() Contact { return Contact{} }).
	Body(func(row *ui.FormListRow[Contact]) {
		f.Item("姓名").Name(row.Name("name")).Rules(&row.Value.Name, ui.Required("请输入姓名")).
			Body(func() { ui.Input(c, &row.Value.Name) })
	})

func FormList 实验性 ​

go
func FormList[T any](f *FormW, label string, items *[]T) *FormListW[T]

FormList starts a dynamic list inside form f; finish with Body.

func (*FormListW[T]) AddText 实验性 ​

go
func (l *FormListW[T]) AddText(s string) *FormListW[T]

AddText sets the add button's text.

func (*FormListW[T]) Body 实验性 ​

go
func (l *FormListW[T]) Body(fn func(row *FormListRow[T])) *FormListW[T]

Body builds the rows with fn (items inside a row are laid out inline), the row actions and the add button.

func (*FormListW[T]) Changed 实验性 ​

go
func (l *FormListW[T]) Changed() bool

Changed reports a row added, removed or moved in the last Body.

func (*FormListW[T]) Creator 实验性 ​

go
func (l *FormListW[T]) Creator(fn func() T) *FormListW[T]

Creator returns the element added by the add button (default: zero value).

func (*FormListW[T]) Max 实验性 ​

go
func (l *FormListW[T]) Max(n int) *FormListW[T]

Max allows at most n rows (add is disabled at n).

func (*FormListW[T]) Min 实验性 ​

go
func (l *FormListW[T]) Min(n int) *FormListW[T]

Min keeps at least n rows (remove is disabled at n).

func (*FormListW[T]) NoActions 实验性 ​

go
func (l *FormListW[T]) NoActions() *FormListW[T]

NoActions hides the per-row move / remove buttons (use row.Remove etc.).

func (*FormListW[T]) Rule 实验性 ​

go
func (l *FormListW[T]) Rule(fn func(n int) string) *FormListW[T]

Rule validates the list itself (e.g. at least one row): fn gets the row count and returns an error message or "".

FormLocale ​

go
type FormLocale struct {
	Validating                          string // help text while an async rule runs
	RequiredInputFmt, RequiredSelectFmt string // default required message, arg: field label
	Submit, Query, PrevStep, NextStep   string
	MoveUp, MoveDown, AddRow            string // FormList actions
	Optional                            string // label suffix of optional items (Form.RequiredMarkOptional)
	// contains filtered or unexported fields
}

FormLocale holds the Form / ProForm texts.

FormTrigger ​

go
type FormTrigger uint8

FormTrigger says when a form item validates its value.

Append-only: never reorder or insert; the zero value stays ValidateInherit.

go
const (
	// ValidateInherit uses the form's trigger (items) or onChange (forms).
	ValidateInherit FormTrigger = iota
	// ValidateOnChange validates live once the value changed (default).
	ValidateOnChange
	// ValidateOnBlur validates when focus leaves the item's control.
	ValidateOnBlur
	// ValidateOnSubmit validates only in Validate / Submit.
	ValidateOnSubmit
)

FormW ​

go
type FormW struct {
	// contains filtered or unexported fields
}

FormW groups FormItems with shared label settings.

func Form ​

go
func Form(c *Context) *FormW

Form adds a form container; build items with Item(...).Body.

func (*FormW) Body ​

go
func (f *FormW) Body(fn func()) *FormW

Body builds the form's items.

func (*FormW) ClearValidate ​

go
func (f *FormW) ClearValidate(names ...string)

ClearValidate removes the validation result of the named items (all items without names) without touching their values (Ant setFields / Element clearValidate). They validate again live after the next edit, or on Validate.

func (*FormW) Colon ​

go
func (f *FormW) Colon(on bool) *FormW

func (*FormW) Disabled ​

go
func (f *FormW) Disabled(on bool) *FormW

Disabled disables every control in the form (Ant Form disabled, Element el-form disabled); it passes down like ui.Disabled.

func (*FormW) Errors ​

go
func (f *FormW) Errors() map[string]string

Errors returns the current error message per item label.

func (*FormW) Finished ​

go
func (f *FormW) Finished() bool

Finished reports (once) that a Submit passed validation.

func (*FormW) Inline ​

go
func (f *FormW) Inline() *FormW

func (*FormW) Item ​

go
func (f *FormW) Item(label string) *FormItemW

Item starts a form item; finish with Body.

func (*FormW) LabelAlign ​

go
func (f *FormW) LabelAlign(a TextAlign) *FormW

func (*FormW) LabelWidth ​

go
func (f *FormW) LabelWidth(px float32) *FormW

func (*FormW) Layout ​

go
func (f *FormW) Layout(o ...layout.Option) *FormW

func (*FormW) RequiredMark ​

go
func (f *FormW) RequiredMark(on bool) *FormW

RequiredMark shows (default) or hides the asterisk of required items (Ant requiredMark, Element hide-required-asterisk). Required rules still apply.

func (*FormW) RequiredMarkOptional ​

go
func (f *FormW) RequiredMarkOptional() *FormW

RequiredMarkOptional marks the optional items instead of the required ones (antd requiredMark="optional"): no asterisk, and the labels of items that are not Required end with Locale().Form.Optional in the secondary text color. ConfigProvider Defaults("Form", {"requiredMark": "optional"}) sets it too.

func (*FormW) ResetFields ​

go
func (f *FormW) ResetFields(names ...string)

ResetFields restores every item bound with Rules(*string) or RulesOf to the value it had when the item was first built, calls the OnReset callback of RulesFunc items, and clears validation (Ant resetFields, Element resetFields). With names only those items are reset.

func (*FormW) ResetValidation ​

go
func (f *FormW) ResetValidation()

ResetValidation clears errors and touched flags. Values changed from code in the same frame (a submit handler clearing the fields) are not edits: they are not validated on the next build, as antd does not validate setFieldsValue.

func (*FormW) ScrollToFirstError ​

go
func (f *FormW) ScrollToFirstError() *FormW

ScrollToFirstError scrolls the first failing item into view (in its nearest scroll container) when Validate or Submit fails.

func (*FormW) Size ​

go
func (f *FormW) Size(s ControlSize) *FormW

Size sets the size of every control in the form (Ant Form size, Element el-form size); a control's own Size still wins.

func (*FormW) Submit ​

go
func (f *FormW) Submit()

Submit validates every item (waiting for asynchronous rules) and makes Finished report true once all pass. It scrolls to the first error when validation fails (ScrollToFirstError).

func (*FormW) Submitting ​

go
func (f *FormW) Submitting() bool

Submitting reports a Submit waiting for asynchronous validation.

func (*FormW) Validate ​

go
func (f *FormW) Validate() bool

Validate checks every item with rules built so far in this frame, shows their errors and reports whether all passed. Items whose asynchronous rules are still running count as not passed (see Validating, Submit).

func (*FormW) ValidateFields ​

go
func (f *FormW) ValidateFields(names ...string) bool

ValidateFields validates only the named items (Name, or the label) and reports whether they all passed (Ant validateFields(names), Element validateField). Without names it is Validate.

func (*FormW) ValidateTrigger ​

go
func (f *FormW) ValidateTrigger(t FormTrigger) *FormW

ValidateTrigger sets when items validate (default ValidateOnChange); FormItemW.ValidateTrigger overrides it per item.

func (*FormW) Validating ​

go
func (f *FormW) Validating() bool

Validating reports an asynchronous rule still running.

func (*FormW) Value ​

go
func (f *FormW) Value(name string) string

Value returns the last value seen of the item named name (Name or label); use it for linkage: f.Item("城市").Hidden(f.Value("国家") == "").

func (*FormW) Vertical ​

go
func (f *FormW) Vertical() *FormW

GraphLocale 实验性 ​

go
type GraphLocale struct {
	Diagram, ER, GitGraph                         string // accessible names of the canvases / list
	ZoomIn, ZoomOut, FitView, AutoLayout, MiniMap string // toolbar buttons and the minimap
	PrimaryKey, ForeignKey                        string // ER column marks
	SummaryFmt                                    string // diagram description, args: node count, edge count ("%[1]d 个节点,%[2]d 条连线")
	CommitsFmt                                    string // commit list description, arg: commit count ("%d 个提交")
	// contains filtered or unexported fields
}

GraphLocale holds the texts of ui/graph widgets (Diagram, ER, GitGraph).

GridColW ​

go
type GridColW struct {
	// contains filtered or unexported fields
}

GridColW is a column of a GridRow.

func Col ​

go
func Col(c *Context, span int) *GridColW

Col adds a column spanning span/24 of the row; call it inside GridRow.Body.

func (*GridColW) Body ​

go
func (col *GridColW) Body(fn func()) *GridColW

Body sets the column content (built when the row lays out its lines).

func (*GridColW) Flex ​

go
func (col *GridColW) Flex(n float32) *GridColW

Flex makes the column take free space (flex: n) instead of a span.

func (*GridColW) LG ​

go
func (col *GridColW) LG(span int, offset ...int) *GridColW

func (*GridColW) MD ​

go
func (col *GridColW) MD(span int, offset ...int) *GridColW

func (*GridColW) Offset ​

go
func (col *GridColW) Offset(n int) *GridColW

Offset shifts the column towards the end (right; left in RTL) by n columns.

func (*GridColW) Order ​

go
func (col *GridColW) Order(n int) *GridColW

Order sets the flex order of the column within the row (lower first; equal orders keep the call order).

func (*GridColW) Pull ​

go
func (col *GridColW) Pull(n int) *GridColW

Pull moves the column towards the start by n columns (Ant pull).

func (*GridColW) Push ​

go
func (col *GridColW) Push(n int) *GridColW

Push moves the column towards the end by n columns without moving its neighbours (Ant push; for reordering columns visually).

func (*GridColW) SM ​

go
func (col *GridColW) SM(span int, offset ...int) *GridColW

func (*GridColW) Style ​

go
func (col *GridColW) Style(opts ...layout.Option) *GridColW

Style applies layout options to the column content box.

func (*GridColW) XL ​

go
func (col *GridColW) XL(span int, offset ...int) *GridColW

func (*GridColW) XS ​

go
func (col *GridColW) XS(span int, offset ...int) *GridColW

XS..XXL set the span (and optional offset) from that breakpoint up.

func (*GridColW) XXL ​

go
func (col *GridColW) XXL(span int, offset ...int) *GridColW

GridContentW 实验性 ​

go
type GridContentW struct {
	// contains filtered or unexported fields
}

GridContentW builds a GridContent.

func GridContent 实验性 ​

go
func GridContent(c *Context) *GridContentW

GridContent starts a content container; chain options, then Body.

ConfigProvider.Defaults("GridContent", ...) keys: "contentWidth" ("Fluid" | "Fixed"). Without either, the enclosing ProLayout's content width is used.

func (*GridContentW) Body 实验性 ​

go
func (g *GridContentW) Body(fn func()) *Box

Body builds fn inside the container and returns the inner column.

func (*GridContentW) ContentWidth 实验性 ​

go
func (g *GridContentW) ContentWidth(w string) *GridContentW

ContentWidth sets "Fluid" (fill) or "Fixed" (centred, MaxWidth).

func (*GridContentW) Fixed 实验性 ​

go
func (g *GridContentW) Fixed() bool

Fixed reports whether the container centres its content.

func (*GridContentW) Layout 实验性 ​

go
func (g *GridContentW) Layout(o ...layout.Option) *GridContentW

Layout applies layout options to the inner column.

func (*GridContentW) MaxWidth 实验性 ​

go
func (g *GridContentW) MaxWidth(px float32) *GridContentW

MaxWidth sets the width of a Fixed container (default 1152).

GridRowW ​

go
type GridRowW struct {
	// contains filtered or unexported fields
}

GridRowW is a 24-column grid row (Ant Row / Element el-row).

func GridRow ​

go
func GridRow(c *Context) *GridRowW

GridRow starts a grid row; chain options, then Body with Col calls.

func (*GridRowW) Align ​

go
func (g *GridRowW) Align(a layout.Align) *GridRowW

Align sets vertical alignment of columns (AlignStart, AlignCenter, AlignEnd).

func (*GridRowW) Body ​

go
func (g *GridRowW) Body(fn func()) *Box

Body builds the row.

func (*GridRowW) Gutter ​

go
func (g *GridRowW) Gutter(h, v float32) *GridRowW

Gutter sets the horizontal and vertical spacing between columns.

func (*GridRowW) GutterAt ​

go
func (g *GridRowW) GutterAt(bp Breakpoint, px float32) *GridRowW

GutterAt sets a responsive horizontal gutter per breakpoint.

func (*GridRowW) Justify ​

go
func (g *GridRowW) Justify(j layout.Justify) *GridRowW

Justify distributes free columns: JustifyStart, JustifyEnd, JustifyCenter, JustifySpaceBetween, JustifySpaceAround, JustifySpaceEvenly.

func (*GridRowW) NoWrap ​

go
func (g *GridRowW) NoWrap() *GridRowW

NoWrap keeps all columns on one line.

func (*GridRowW) VGutterAt ​

go
func (g *GridRowW) VGutterAt(bp Breakpoint, px float32) *GridRowW

VGutterAt sets a responsive vertical gutter (the gap between wrapped lines) per breakpoint (Ant gutter={[h, {xs: 8, md: 16}]}).

Host 实验性 ​

go
type Host interface {
	OpenWindow(opts WindowOptions, r *Runner) (Window, error)
}

Host is implemented by a platform backend that can open windows whose content is drawn by the Tango UI. The host owns the event loop and must:

  • forward input as input.Event values to Runner.HandleEvent (logical coordinates relative to the content area; positive Scroll.DY reveals content below; Pointer.Clicks if the OS tracks double clicks);
  • call Runner.Frame on the UI thread after Window.Invalidate / InvalidateAt, after a resize or scale change, and when the window is first shown;
  • map input.Cursor to native cursors in Window.SetCursor;
  • route IME through Window.SetTextInput (NSTextInputClient, IMM32/TSF, GTK IM context) and deliver input.Composition + input.TextInput;
  • display the image passed to Window.Present (e.g. CGImage into a CALayer, StretchDIBits / D2D bitmap, cairo surface);
  • call Runner.Close when the window is destroyed.

HotkeyInputLocale 实验性 ​

go
type HotkeyInputLocale struct {
	Placeholder string // empty, not recording ("点击录制快捷键")
	Recording   string // waiting for a key ("请按下组合键,Esc 取消")
	ClearLabel  string // clear button ("清除快捷键")
	// contains filtered or unexported fields
}

HotkeyInputLocale holds the HotkeyInput texts.

HotkeyInputW 实验性 ​

go
type HotkeyInputW struct {
	// contains filtered or unexported fields
}

HotkeyInputW is the shortcut recorder HotkeyInput returns.

func HotkeyInput 实验性 ​

go
func HotkeyInput(c *Context, accel *string) *HotkeyInputW

HotkeyInput adds a shortcut recorder bound to *accel, an accelerator in the syntax of package sys/hotkey and uihost shortcuts ("CmdOrCtrl+Shift+K", "Alt+F4", "F5"):

ui.HotkeyInput(c, &keys.Palette).Conflict(func(a string) string {
	if owner := bindings.Owner(a); owner != "" { return "已被“" + owner + "”使用" }
	return ""
})

Focusing it (a click, or Tab and then Enter / Space) starts recording: the held modifiers show as key caps until a main key completes the combination, which becomes the value. The platform shortcut modifier is stored as CmdOrCtrl (Literal stores Cmd / Ctrl as pressed). A main key needs a modifier other than Shift, except F1–F12 (AllowBare lifts that). Bare Backspace / Delete clear the value, as the clear button does.

Esc while recording cancels it and keeps the old value; the Esc is not passed on, so an enclosing Modal or Drawer stays open, and a second Esc (not recording) reaches it. (Popovers and dropdowns check Esc before building their content, so inside one Esc closes the panel.) Tab is not recorded: it moves focus as everywhere else.

Hosts implementing ShortcutCaptureWindow (including uihost) yield window shortcuts and menu accelerators while recording, without enabling IME. Capture ends on completion, cancel, blur, disable or removal. System shortcuts and global OS hotkeys cannot be overridden by this widget.

func (*HotkeyInputW) A11yLabel 实验性 ​

go
func (w *HotkeyInputW) A11yLabel(s string) *HotkeyInputW

A11yLabel sets the accessible name (a FormItem label names it too).

func (*HotkeyInputW) AllowBare 实验性 ​

go
func (w *HotkeyInputW) AllowBare(on bool) *HotkeyInputW

AllowBare accepts main keys without a modifier (letters, digits, Enter).

func (*HotkeyInputW) Changed 实验性 ​

go
func (w *HotkeyInputW) Changed() bool

Changed reports that the value was recorded or cleared this frame.

func (*HotkeyInputW) Conflict 实验性 ​

go
func (w *HotkeyInputW) Conflict(fn func(accel string) string) *HotkeyInputW

Conflict checks the value: fn returns a message when the shortcut is taken or reserved ("" when it is free). The message shows under the field, which turns to the warning status; the value is kept, the app decides whether to save it.

func (*HotkeyInputW) ConflictText 实验性 ​

go
func (w *HotkeyInputW) ConflictText() string

ConflictText returns the message of the Conflict check ("" for none).

func (*HotkeyInputW) Disabled 实验性 ​

go
func (w *HotkeyInputW) Disabled(on bool) *HotkeyInputW

Disabled stops recording and clearing.

func (*HotkeyInputW) ID 实验性 ​

go
func (w *HotkeyInputW) ID() ID

ID returns the field's ID (the focusable frame).

func (*HotkeyInputW) Literal 实验性 ​

go
func (w *HotkeyInputW) Literal() *HotkeyInputW

Literal stores Cmd (macOS) and Ctrl as pressed instead of CmdOrCtrl.

func (*HotkeyInputW) Placeholder 实验性 ​

go
func (w *HotkeyInputW) Placeholder(s string) *HotkeyInputW

Placeholder replaces the empty-field text (Locale.HotkeyInput.Placeholder).

func (*HotkeyInputW) Recording 实验性 ​

go
func (w *HotkeyInputW) Recording() bool

Recording reports whether the field is waiting for a key.

func (*HotkeyInputW) Size 实验性 ​

go
func (w *HotkeyInputW) Size(s ControlSize) *HotkeyInputW

Size sets the control size.

func (*HotkeyInputW) Status 实验性 ​

go
func (w *HotkeyInputW) Status(s string) *HotkeyInputW

Status sets the validation status: "error" or "warning" (a conflict shows as "warning" unless a status is set).

func (*HotkeyInputW) Width 实验性 ​

go
func (w *HotkeyInputW) Width(px float32) *HotkeyInputW

Width sets the field width (the token's MinWidth by default).

ID ​

go
type ID uint64

ID identifies a widget across frames. IDs derive from the parent scope, the widget kind, its label and its occurrence count; wrap dynamic lists in Key to make identity independent of position.

IconButtonW ​

go
type IconButtonW struct {
	// contains filtered or unexported fields
}

IconButtonW is a borderless square icon button (close buttons, toolbar toggles, calendar navigation).

func IconButton ​

go
func IconButton(c *Context, ic *icon.Icon, label string) *IconButtonW

IconButton adds an icon button; label is used for tests and accessibility.

func (*IconButtonW) A11yLabel ​

go
func (b *IconButtonW) A11yLabel(s string) *IconButtonW

A11yLabel replaces the accessible name (by default the label argument).

func (*IconButtonW) Clicked ​

go
func (b *IconButtonW) Clicked() bool

Clicked reports activation.

func (*IconButtonW) Color ​

go
func (b *IconButtonW) Color(col theme.Color) *IconButtonW

Color fixes the icon color.

func (*IconButtonW) Hovered ​

go
func (b *IconButtonW) Hovered() bool

Hovered reports hover.

func (*IconButtonW) NoHoverBg ​

go
func (b *IconButtonW) NoHoverBg() *IconButtonW

NoHoverBg disables the hover background.

func (*IconButtonW) Size ​

go
func (b *IconButtonW) Size(box, iconSize float32) *IconButtonW

Size sets the square box size and the icon size.

IconViolation 实验性 ​

go
type IconViolation struct {
	Icon  string    // icon name
	Label string    // label of the deepest labelled node containing the icon
	Under string    // label of the nearest labelled ancestor of that node
	Rect  geom.Rect // where the icon was drawn
}

IconViolation is a directional icon (icon.Icon.IsDirectional) drawn without mirroring while its node was painted in a right-to-left scope: the widget used icon.Draw instead of the direction-aware paint helper.

func (IconViolation) String 实验性 ​

go
func (v IconViolation) String() string

IconW ​

go
type IconW struct {
	// contains filtered or unexported fields
}

IconW is an icon leaf.

func Icon ​

go
func Icon(c *Context, ic *icon.Icon) *IconW

Icon adds a vector icon (default 14px, current text color).

func (*IconW) A11yLabel ​

go
func (w *IconW) A11yLabel(s string) *IconW

A11yLabel exposes a meaningful icon (a status, not decoration) as an image with this accessible name. Icons are decorative by default.

func (*IconW) Color ​

go
func (w *IconW) Color(col theme.Color) *IconW

Color sets the icon color.

func (*IconW) Rotate ​

go
func (w *IconW) Rotate(deg float64) *IconW

Rotate rotates the icon by degrees.

func (*IconW) Size ​

go
func (w *IconW) Size(px float32) *IconW

Size sets the icon size in px.

func (*IconW) Spin ​

go
func (w *IconW) Spin() *IconW

Spin rotates the icon continuously (loading).

ImageLocale 实验性 ​

go
type ImageLocale struct {
	Preview, PreviewLabel, ClosePreview, Prev, Next                        string
	ZoomIn, ZoomOut, RotateLeft, RotateRight, FlipHorizontal, FlipVertical string
	// contains filtered or unexported fields
}

ImageLocale holds the Image placeholder and preview toolbar texts.

ImageW 实验性 ​

go
type ImageW struct {
	// contains filtered or unexported fields
}

ImageW displays a bitmap with loading placeholder, error fallback and an optional full-screen preview (Ant Design Image / Element Plus el-image).

func Image 实验性 ​

go
func Image(c *Context, img image.Image) *ImageW

Image adds an image; img may be nil (shows the placeholder). The default size is the image's pixel size (200×200 when unknown); use Width/Height.

func (*ImageW) A11yLabel 实验性 ​

go
func (w *ImageW) A11yLabel(s string) *ImageW

A11yLabel sets the accessible name (like Alt, without changing the Driver.Find label).

func (*ImageW) Alt 实验性 ​

go
func (w *ImageW) Alt(s string) *ImageW

Alt sets the accessible label (also used by Driver.Find).

func (*ImageW) CloseOnEscape 实验性 ​

go
func (w *ImageW) CloseOnEscape(on bool) *ImageW

CloseOnEscape(false) keeps the preview open on Escape (Element close-on-press-escape, default true).

func (*ImageW) Failed 实验性 ​

go
func (w *ImageW) Failed(on bool) *ImageW

Failed shows the error fallback (broken picture / "加载失败").

func (*ImageW) Fallback 实验性 ​

go
func (w *ImageW) Fallback(img image.Image) *ImageW

Fallback sets the image shown when loading failed (Ant `fallback`).

func (*ImageW) Fit 实验性 ​

go
func (w *ImageW) Fit(f string) *ImageW

Fit sets object-fit: "fill" (default), "contain", "cover", "scale-down".

func (*ImageW) Height 实验性 ​

go
func (w *ImageW) Height(px float32) *ImageW

func (*ImageW) ID 实验性 ​

go
func (w *ImageW) ID() ID

ID returns the widget ID.

func (*ImageW) Infinite 实验性 ​

go
func (w *ImageW) Infinite(on bool) *ImageW

Infinite sets whether the group preview wraps from the last image to the first (Element infinite, default true; Ant stops at the ends).

func (*ImageW) Layout 实验性 ​

go
func (w *ImageW) Layout(o ...layout.Option) *ImageW

Layout applies layout options.

func (*ImageW) Loading 实验性 ​

go
func (w *ImageW) Loading(on bool) *ImageW

Loading shows the placeholder instead of the image.

func (*ImageW) MaskClosable 实验性 ​

go
func (w *ImageW) MaskClosable(on bool) *ImageW

MaskClosable sets whether a click on the preview backdrop closes it (Ant mask.closable, default true; Element hide-on-click-modal, default false; the theme picks the default).

func (*ImageW) MaxScale 实验性 ​

go
func (w *ImageW) MaxScale(k float32) *ImageW

func (*ImageW) MinScale 实验性 ​

go
func (w *ImageW) MinScale(k float32) *ImageW

MinScale and MaxScale bound the preview zoom (Ant minScale 1 / maxScale 50; Element min-scale 0.2 / max-scale 7; the theme picks the default).

func (*ImageW) Movable 实验性 ​

go
func (w *ImageW) Movable(on bool) *ImageW

Movable(false) stops dragging the preview image around (Ant preview.movable, default true).

func (*ImageW) OpenPreview 实验性 ​

go
func (w *ImageW) OpenPreview() *ImageW

OpenPreview opens the preview now (Ant preview.open); call it once per action, like Rotate. PreviewOpen reports the state.

func (*ImageW) Preview 实验性 ​

go
func (w *ImageW) Preview(on bool) *ImageW

Preview enables click-to-preview.

func (*ImageW) PreviewAngle 实验性 ​

go
func (w *ImageW) PreviewAngle() float64

PreviewAngle returns the preview rotation in degrees (clockwise).

func (*ImageW) PreviewGroup 实验性 ​

go
func (w *ImageW) PreviewGroup(imgs []image.Image, index int) *ImageW

PreviewGroup previews imgs (this image is imgs[index]) with prev/next navigation and a counter. An index out of range is clamped.

func (*ImageW) PreviewOpen 实验性 ​

go
func (w *ImageW) PreviewOpen() bool

PreviewOpen reports whether the preview overlay is open.

func (*ImageW) PreviewScale 实验性 ​

go
func (w *ImageW) PreviewScale() float32

PreviewScale returns the preview zoom factor (1 = fitted size).

func (*ImageW) PreviewSrc 实验性 ​

go
func (w *ImageW) PreviewSrc(img image.Image) *ImageW

PreviewSrc shows img in the preview instead of the image itself (Ant preview.src: a larger original behind a thumbnail).

func (*ImageW) Radius 实验性 ​

go
func (w *ImageW) Radius(px float32) *ImageW

Radius rounds the corners.

func (*ImageW) Rotate 实验性 ​

go
func (w *ImageW) Rotate(deg float64) *ImageW

Rotate turns the open preview by deg degrees (clockwise, any angle; relative to its current rotation). Call it once per action, e.g. from a button's Clicked branch. The toolbar's rotate buttons step by 90°, and Shift-dragging the preview image rotates it freely.

func (*ImageW) ScaleStep 实验性 ​

go
func (w *ImageW) ScaleStep(step float32) *ImageW

ScaleStep sets the zoom step of the preview buttons: each step scales by 1+step (Ant scaleStep 0.5; Element zoom-rate 1.2 = step 0.2).

func (*ImageW) ShowProgress 实验性 ​

go
func (w *ImageW) ShowProgress(on bool) *ImageW

ShowProgress shows the "2 / 5" counter of a group preview (Ant always, Element show-progress, default false; the theme picks the default).

func (*ImageW) Size 实验性 ​

go
func (w *ImageW) Size(wpx, hpx float32) *ImageW

Size fixes both sides.

func (*ImageW) Width 实验性 ​

go
func (w *ImageW) Width(px float32) *ImageW

Width / Height fix the box size in px (the other side follows the image aspect ratio when only one is set).

InfiniteScrollW 实验性 ​

go
type InfiniteScrollW struct {
	// contains filtered or unexported fields
}

InfiniteScrollW is a scrolling column that asks for more content when the user nears its bottom.

func InfiniteScroll 实验性 ​

go
func InfiniteScroll(c *Context, fn func(), opts ...layout.Option) *InfiniteScrollW

InfiniteScroll builds fn (the items) inside a vertical scroll area. Give it a bounded height with Height or opts (layout.H / MaxH / Grow), then poll NeedMore:

inf := ui.InfiniteScroll(c, func() { for _, it := range items { ... } }).
	Height(400).Loading(loading).Done(len(items) >= total)
if inf.NeedMore() { loading = true; go fetch() }

func (*InfiniteScrollW) Disabled 实验性 ​

go
func (w *InfiniteScrollW) Disabled(on bool) *InfiniteScrollW

Disabled stops NeedMore without showing a footer.

func (*InfiniteScrollW) Distance 实验性 ​

go
func (w *InfiniteScrollW) Distance(px float32) *InfiniteScrollW

Distance is how close (px) to the bottom NeedMore starts firing (Element infinite-scroll-distance; default 0).

func (*InfiniteScrollW) Done 实验性 ​

go
func (w *InfiniteScrollW) Done(on bool) *InfiniteScrollW

Done shows the "no more" footer and stops NeedMore.

func (*InfiniteScrollW) DoneText 实验性 ​

go
func (w *InfiniteScrollW) DoneText(s string) *InfiniteScrollW

func (*InfiniteScrollW) Height 实验性 ​

go
func (w *InfiniteScrollW) Height(px float32) *InfiniteScrollW

Height fixes the viewport height.

func (*InfiniteScrollW) ID 实验性 ​

go
func (w *InfiniteScrollW) ID() ID

ID returns the scroll container's ID.

func (*InfiniteScrollW) Layout 实验性 ​

go
func (w *InfiniteScrollW) Layout(opts ...layout.Option) *InfiniteScrollW

Layout applies layout options to the viewport.

func (*InfiniteScrollW) Loading 实验性 ​

go
func (w *InfiniteScrollW) Loading(on bool) *InfiniteScrollW

Loading shows the loading footer and suppresses NeedMore.

func (*InfiniteScrollW) LoadingText 实验性 ​

go
func (w *InfiniteScrollW) LoadingText(s string) *InfiniteScrollW

LoadingText / DoneText replace the footer texts ("" hides the text).

func (*InfiniteScrollW) NeedMore 实验性 ​

go
func (w *InfiniteScrollW) NeedMore() bool

NeedMore reports, once per content height, that the viewport is within Distance of the bottom (or not yet filled) and more items should load.

func (*InfiniteScrollW) Offset 实验性 ​

go
func (w *InfiniteScrollW) Offset() float64

Offset returns the vertical scroll offset.

func (*InfiniteScrollW) ScrollTo 实验性 ​

go
func (w *InfiniteScrollW) ScrollTo(y float64) *InfiniteScrollW

ScrollTo sets the vertical scroll offset.

InlineSpan 实验性 ​

go
type InlineSpan = inlineSpan

InlineSpan places things along a rectangle's inline axis by start/end offsets: in RTL scopes offsets run from the right edge.

InputNumberW ​

go
type InputNumberW struct {
	// contains filtered or unexported fields
}

InputNumberW is a numeric input with step controls.

func InputNumber ​

go
func InputNumber(c *Context, val *float64) *InputNumberW

InputNumber adds a numeric input bound to *val (val may be nil with StringMode).

func (*InputNumberW) A11yLabel ​

go
func (w *InputNumberW) A11yLabel(s string) *InputNumberW

A11yLabel sets the accessible name of the numeric input.

func (*InputNumberW) Changed ​

go
func (w *InputNumberW) Changed() bool

func (*InputNumberW) Controls ​

go
func (w *InputNumberW) Controls(on bool) *InputNumberW

Controls shows (true, the default) or hides the step buttons (antd controls, Element controls). Without them the arrow keys and the wheel still step the value.

func (*InputNumberW) ControlsPosition ​

go
func (w *InputNumberW) ControlsPosition(pos string) *InputNumberW

ControlsPosition places the step buttons: "right" (stacked at the right, Ant's look and Element's controls-position="right") or "sides" (− before and + after the value). The default follows the design system: "sides" under Element (el-input-number's default), "right" otherwise.

func (*InputNumberW) Disabled ​

go
func (w *InputNumberW) Disabled(on bool) *InputNumberW

func (*InputNumberW) DownDisabled ​

go
func (w *InputNumberW) DownDisabled() bool

DownDisabled reports whether the − / down button is disabled.

func (*InputNumberW) Empty ​

go
func (w *InputNumberW) Empty(empty *bool) *InputNumberW

Empty lets the field hold no value, like a nullable number: *empty reports whether it is empty. An empty field shows the placeholder and ignores *val; typing a number clears *empty, clearing the text sets it. The step buttons start an empty field from 0 (clamped to Min/Max). Without Empty, clearing the text and leaving keeps the previous value.

func (*InputNumberW) Formatter ​

go
func (w *InputNumberW) Formatter(fn func(value string) string) *InputNumberW

Formatter formats the value for display ("$ 1,000"); the text being edited keeps the formatted form. Pair it with Parser.

func (*InputNumberW) Keyboard ​

go
func (w *InputNumberW) Keyboard(on bool) *InputNumberW

Keyboard turns the Up / Down arrow keys stepping on (the default) or off (antd keyboard).

func (*InputNumberW) Max ​

go
func (w *InputNumberW) Max(v float64) *InputNumberW

func (*InputNumberW) Min ​

go
func (w *InputNumberW) Min(v float64) *InputNumberW

func (*InputNumberW) Mode ​

go
func (w *InputNumberW) Mode(m string) *InputNumberW

Mode chooses where the step buttons go (antd 6 mode): "input" (stacked at the inline end, the default) or "spinner" (− before and + after the value, which is centred). It is the antd name of ControlsPosition: "spinner" equals ControlsPosition("sides") and "input" equals ControlsPosition("right").

func (*InputNumberW) Parser ​

go
func (w *InputNumberW) Parser(fn func(display string) string) *InputNumberW

Parser turns the displayed text back into a plain number ("1000"). Without one, a formatted field keeps only digits, '.', '-' and 'e'.

func (*InputNumberW) Placeholder ​

go
func (w *InputNumberW) Placeholder(s string) *InputNumberW

Placeholder is shown while the field is empty (see Empty).

func (*InputNumberW) Precision ​

go
func (w *InputNumberW) Precision(n int) *InputNumberW

func (*InputNumberW) Prefix ​

go
func (w *InputNumberW) Prefix(ic *icon.Icon) *InputNumberW

Prefix shows an icon before the value.

func (*InputNumberW) PrefixText ​

go
func (w *InputNumberW) PrefixText(s string) *InputNumberW

PrefixText shows short static text before the value ("¥").

func (*InputNumberW) ReadOnly ​

go
func (w *InputNumberW) ReadOnly() *InputNumberW

ReadOnly shows the value without letting it change: the text can be selected and copied, the step buttons are hidden and the arrow keys and the wheel do nothing (antd readOnly, Element readonly).

func (*InputNumberW) Size ​

go
func (w *InputNumberW) Size(s ControlSize) *InputNumberW

func (*InputNumberW) Status ​

go
func (w *InputNumberW) Status(s string) *InputNumberW

Status overrides the validation status ("error" | "warning"); inside a form item it defaults to the item's status.

func (*InputNumberW) Step ​

go
func (w *InputNumberW) Step(v float64) *InputNumberW

func (*InputNumberW) StepStrictly ​

go
func (w *InputNumberW) StepStrictly() *InputNumberW

StepStrictly only accepts multiples of Step (Element step-strictly): a typed value is rounded to the nearest multiple when it is committed. It applies to float64 values (not to StringMode).

func (*InputNumberW) StringMode ​

go
func (w *InputNumberW) StringMode(s *string) *InputNumberW

StringMode binds the value as a decimal string instead of a float64, so it keeps every digit ("0.1" + "0.2" = "0.3", 20-digit amounts; Ant stringMode). "" is an empty field. *val (if any) receives the nearest float64.

func (*InputNumberW) Submitted ​

go
func (w *InputNumberW) Submitted() bool

Submitted reports Enter after committing the numeric value. It may be true when the committed value is unchanged.

func (*InputNumberW) UpDisabled ​

go
func (w *InputNumberW) UpDisabled() bool

UpDisabled reports whether the + / up button is disabled (a value at Max, a disabled or read-only field, or no step buttons).

func (*InputNumberW) Variant ​

go
func (w *InputNumberW) Variant(v string) *InputNumberW

Variant sets the frame look (see InputW.Variant).

func (*InputNumberW) Wheel ​

go
func (w *InputNumberW) Wheel() *InputNumberW

Wheel lets the mouse wheel step the value while the field has focus (Ant changeOnWheel).

func (*InputNumberW) Width ​

go
func (w *InputNumberW) Width(px float32) *InputNumberW

InputTagW 实验性 ​

go
type InputTagW struct {
	// contains filtered or unexported fields
}

InputTagW is a text field that turns entries into tags (Enter or a separator, by default a comma).

func InputTag 实验性 ​

go
func InputTag(c *Context, val *[]string) *InputTagW

InputTag adds a tag input bound to *val.

func (*InputTagW) A11yLabel 实验性 ​

go
func (w *InputTagW) A11yLabel(s string) *InputTagW

A11yLabel sets the accessible name of the text field (inside a FormItem the item label is used; the placeholder is the last resort).

func (*InputTagW) Added 实验性 ​

go
func (w *InputTagW) Added() string

Added returns the tag added this frame ("" if none).

func (*InputTagW) AllowClear 实验性 ​

go
func (w *InputTagW) AllowClear() *InputTagW

func (*InputTagW) Changed 实验性 ​

go
func (w *InputTagW) Changed() bool

Changed reports an added or removed tag this frame.

func (*InputTagW) Disabled 实验性 ​

go
func (w *InputTagW) Disabled(on bool) *InputTagW

func (*InputTagW) Draggable 实验性 ​

go
func (w *InputTagW) Draggable() *InputTagW

Draggable lets the user reorder the tags by dragging them; a drop reports Changed.

func (*InputTagW) Layout 实验性 ​

go
func (w *InputTagW) Layout(o ...layout.Option) *InputTagW

func (*InputTagW) MaxTagCount 实验性 ​

go
func (w *InputTagW) MaxTagCount(n int) *InputTagW

func (*InputTagW) MaxTags 实验性 ​

go
func (w *InputTagW) MaxTags(n int) *InputTagW

MaxTags limits how many tags can be entered (0 = unlimited).

func (*InputTagW) Placeholder 实验性 ​

go
func (w *InputTagW) Placeholder(s string) *InputTagW

func (*InputTagW) SaveOnBlur 实验性 ​

go
func (w *InputTagW) SaveOnBlur() *InputTagW

SaveOnBlur turns the typed text into a tag when the field loses focus (by default the text stays in the field).

func (*InputTagW) Separators 实验性 ​

go
func (w *InputTagW) Separators(seps ...string) *InputTagW

Separators sets the strings that end a tag while typing or pasting (Element delimiter), e.g. Separators(";", " "); the default is the ASCII and the full-width comma. Separators() with no argument leaves only Enter. Empty strings are ignored.

func (*InputTagW) Size 实验性 ​

go
func (w *InputTagW) Size(s ControlSize) *InputTagW

func (*InputTagW) Status 实验性 ​

go
func (w *InputTagW) Status(s string) *InputTagW

func (*InputTagW) Trigger 实验性 ​

go
func (w *InputTagW) Trigger(key string) *InputTagW

Trigger sets the key that turns the typed text into a tag (Element trigger): "Enter" (default) or "Space". With "Space" the space key adds the tag instead of typing a space and Enter does nothing. ConfigProvider.Defaults("InputTag", "trigger") sets it for a subtree.

func (*InputTagW) Width 实验性 ​

go
func (w *InputTagW) Width(px float32) *InputTagW

InputW ​

go
type InputW struct {
	// contains filtered or unexported fields
}

InputW is a single-line text input.

func Input ​

go
func Input(c *Context, val *string) *InputW

Input adds a text input bound to *val.

func (*InputW) A11yLabel ​

go
func (w *InputW) A11yLabel(s string) *InputW

A11yLabel sets the accessible name. Inside a FormItem the item label is used; otherwise the placeholder is the last resort.

func (*InputW) AllowClear ​

go
func (w *InputW) AllowClear() *InputW

AllowClear shows a clear button when the input has a value.

func (*InputW) Bg ​

go
func (w *InputW) Bg(col theme.Color) *InputW

Bg replaces the background color of the frame (a grey search field on a white bar). It keeps hover / focus borders unless NoBorder is set.

func (*InputW) Borderless ​

go
func (w *InputW) Borderless() *InputW

Borderless drops the frame (background, border and focus halo), for inputs embedded in another surface such as the Command search row.

func (*InputW) Changed ​

go
func (w *InputW) Changed() bool

Changed reports whether the value was edited this frame.

func (*InputW) Disabled ​

go
func (w *InputW) Disabled(on bool) *InputW

Disabled disables editing.

func (*InputW) EnterKey ​

go
func (w *InputW) EnterKey(k input.EnterKey) *InputW

EnterKey labels the soft keyboard's return key (input.EnterSearch, input.EnterNext, …). Pressing it still submits (Submitted).

func (*InputW) Focus ​

go
func (w *InputW) Focus() *InputW

Focus requests keyboard focus.

func (*InputW) Focused ​

go
func (w *InputW) Focused() bool

Focused reports keyboard focus.

func (*InputW) ID ​

go
func (w *InputW) ID() ID

ID returns the editor's widget ID.

func (*InputW) Kind ​

go
func (w *InputW) Kind(k input.TextKind) *InputW

Kind tells soft keyboards what the field holds (input.TextEmail, input.TextNumber, …): the keyboard layout and whether it suggests words. It does not filter what can be typed. Password sets input.TextPassword.

func (*InputW) Layout ​

go
func (w *InputW) Layout(opts ...layout.Option) *InputW

Layout applies layout options to the outer frame.

func (*InputW) MaxLength ​

go
func (w *InputW) MaxLength(n int) *InputW

MaxLength limits the number of runes.

func (*InputW) NoBorder ​

go
func (w *InputW) NoBorder() *InputW

NoBorder drops the border and the focus halo but keeps the background (Bg or the variant's), e.g. a filled search bar.

func (*InputW) Password ​

go
func (w *InputW) Password() *InputW

Password masks the value and adds a visibility toggle.

func (*InputW) Placeholder ​

go
func (w *InputW) Placeholder(s string) *InputW

func (*InputW) Prefix ​

go
func (w *InputW) Prefix(ic *icon.Icon) *InputW

func (*InputW) PrefixText ​

go
func (w *InputW) PrefixText(s string) *InputW

PrefixText / SuffixText show short static text (units, currency).

func (*InputW) ReadOnly ​

go
func (w *InputW) ReadOnly() *InputW

ReadOnly prevents edits but allows selection.

func (*InputW) SelectAll ​

go
func (w *InputW) SelectAll() *InputW

SelectAll selects the full text of the input. It can be used after Focus when presenting a prefilled field and does not move focus itself.

func (*InputW) ShowCount ​

go
func (w *InputW) ShowCount() *InputW

ShowCount shows the character count ("3 / 20" with MaxLength) at the end of the field (Ant showCount, Element show-word-limit).

func (*InputW) Size ​

go
func (w *InputW) Size(s ControlSize) *InputW

Size sets the control size.

func (*InputW) Status ​

go
func (w *InputW) Status(s string) *InputW

Status sets the validation status: "error" or "warning".

func (*InputW) Submitted ​

go
func (w *InputW) Submitted() bool

Submitted reports an Enter key press.

func (*InputW) Suffix ​

go
func (w *InputW) Suffix(ic *icon.Icon) *InputW

func (*InputW) SuffixText ​

go
func (w *InputW) SuffixText(s string) *InputW

func (*InputW) Variant ​

go
func (w *InputW) Variant(v string) *InputW

Variant sets the look of the frame (Ant Input variant): "outlined" (default), "filled" (grey fill, border on focus), "borderless" (no frame) or "underlined" (bottom line only).

func (*InputW) VisibilityToggle ​

go
func (w *InputW) VisibilityToggle(on bool) *InputW

VisibilityToggle shows (true, the default) or hides the eye button of a Password field (antd Input.Password visibilityToggle; Element type="password" without show-password).

func (*InputW) Width ​

go
func (w *InputW) Width(px float32) *InputW

Width fixes the width.

Interaction ​

go
type Interaction struct {
	ID           ID
	Hovered      bool // pointer over it and not covered by a higher layer
	Pressed      bool // pointer went down on it and is still held
	Clicked      bool // activated this frame (pointer or Enter/Space)
	Clicks       int  // click count of the activation (2 = double click)
	PressedNow   bool // pointer went down on it this frame
	Focused      bool
	FocusVisible bool // focused via keyboard: draw the focus ring
}

Interaction is the per-frame pointer/keyboard state of a widget.

ItemGroupW 实验性 ​

go
type ItemGroupW struct {
	// contains filtered or unexported fields
}

ItemGroupW stacks Items as a list (shadcn/ui ItemGroup), optionally with rules between them (ItemSeparator) and an outline around them.

func ItemGroup 实验性 ​

go
func ItemGroup(c *Context) *ItemGroupW

ItemGroup starts a list of Items; chain options, then Body:

ui.ItemGroup(c).Separated().Bordered().Body(func() {
	ui.Item(c, "通知").Description("…")
	ui.Item(c, "隐私").Description("…")
})

func (*ItemGroupW) A11yLabel 实验性 ​

go
func (g *ItemGroupW) A11yLabel(s string) *ItemGroupW

A11yLabel names the list.

func (*ItemGroupW) Body 实验性 ​

go
func (g *ItemGroupW) Body(fn func()) *ItemGroupW

Body builds the items.

func (*ItemGroupW) Bordered 实验性 ​

go
func (g *ItemGroupW) Bordered() *ItemGroupW

Bordered outlines the group with rounded corners.

func (*ItemGroupW) Gap 实验性 ​

go
func (g *ItemGroupW) Gap(px float32) *ItemGroupW

Gap sets the space between items (with Separated, the rule sits in its middle).

func (*ItemGroupW) ID 实验性 ​

go
func (g *ItemGroupW) ID() ID

ID returns the group's ID.

func (*ItemGroupW) Separated 实验性 ​

go
func (g *ItemGroupW) Separated() *ItemGroupW

Separated draws a rule between consecutive items.

ItemSize 实验性 ​

go
type ItemSize string

ItemSize is the density of an Item. Open set.

go
const (
	ItemSizeDefault ItemSize = "default"
	ItemSizeSmall   ItemSize = "sm"
)

实验性

ItemVariant 实验性 ​

go
type ItemVariant string

ItemVariant is the surface of an Item. Open set: new variants are added as new constants.

go
const (
	ItemVariantDefault ItemVariant = "default" // no surface
	ItemVariantOutline ItemVariant = "outline" // bordered
	ItemVariantMuted   ItemVariant = "muted"   // muted fill
)

实验性

ItemW 实验性 ​

go
type ItemW struct {
	// contains filtered or unexported fields
}

ItemW is a general list row (shadcn/ui Item): media (an icon tile, an avatar, an image), a title with a description, and actions at the end.

func Item 实验性 ​

go
func Item(c *Context, title string) *ItemW

Item adds a list row titled title; chain the parts and options:

ui.Item(c, "安全设置").Description("双重验证已开启").Icon(icon.Lock).Outline().
	Actions(func() { ui.Button(c, "管理").Small() })
if ui.Item(c, "个人资料").Icon(icon.User).Link().Clicked() { ... }

The row is built at the end of the chain (Clicked, or the end of the build).

func (*ItemW) A11yLabel 实验性 ​

go
func (w *ItemW) A11yLabel(s string) *ItemW

A11yLabel overrides the accessible name (the title by default).

func (*ItemW) Actions 实验性 ​

go
func (w *ItemW) Actions(fn func()) *ItemW

Actions builds controls at the end of the row.

func (*ItemW) Clickable 实验性 ​

go
func (w *ItemW) Clickable() *ItemW

Clickable makes the whole row a button: focusable, hover highlight, Enter / Space or a click report Clicked.

func (*ItemW) Clicked 实验性 ​

go
func (w *ItemW) Clicked() bool

Clicked reports a click (or Enter / Space) on a clickable row.

func (*ItemW) Content 实验性 ​

go
func (w *ItemW) Content(fn func()) *ItemW

Content builds extra content under the description (tags, progress).

func (*ItemW) Description 实验性 ​

go
func (w *ItemW) Description(s string) *ItemW

Description adds the secondary text under the title (two lines at most).

func (*ItemW) Disabled 实验性 ​

go
func (w *ItemW) Disabled(on bool) *ItemW

Disabled dims the row and stops a clickable one from reacting.

func (*ItemW) ID 实验性 ​

go
func (w *ItemW) ID() ID

ID returns the row's ID.

func (*ItemW) Icon 实验性 ​

go
func (w *ItemW) Icon(ic *icon.Icon) *ItemW

Icon shows ic in a tile at the start (ItemMedia variant="icon").

go
func (w *ItemW) Link() *ItemW

Link makes the whole row a link (as Clickable, announced as a link; the app navigates on Clicked).

func (*ItemW) Media 实验性 ​

go
func (w *ItemW) Media(fn func()) *ItemW

Media builds custom media at the start (an Avatar, an Image) in place of the icon tile.

func (*ItemW) Muted 实验性 ​

go
func (w *ItemW) Muted() *ItemW

Muted is Variant(ItemVariantMuted).

func (*ItemW) Outline 实验性 ​

go
func (w *ItemW) Outline() *ItemW

Outline is Variant(ItemVariantOutline).

func (*ItemW) Size 实验性 ​

go
func (w *ItemW) Size(s ItemSize) *ItemW

Size selects the density (default, sm).

func (*ItemW) Small 实验性 ​

go
func (w *ItemW) Small() *ItemW

Small is Size(ItemSizeSmall).

func (*ItemW) Variant 实验性 ​

go
func (w *ItemW) Variant(v ItemVariant) *ItemW

Variant selects the surface (default, outline, muted).

JSONViewLocale 实验性 ​

go
type JSONViewLocale struct {
	Name                   string // accessible name of the tree
	CopyValue, CopyPath    string
	ExpandAll, CollapseAll string
	ItemsFmt               string // array size, arg: n ("%d 项")
	KeysFmt                string // object size, arg: n ("%d 个键")
	Search                 string // search box placeholder
	PrevMatch, NextMatch   string
	MatchFmt               string // current match and count, args: i, n
	NoMatch                string
	ParseErrorFmt          string // arg: the parser's message
	// contains filtered or unexported fields
}

JSONViewLocale holds the JSONView texts.

func (*JSONViewLocale) Items 实验性 ​

go
func (l *JSONViewLocale) Items(n int) string

Items formats an array size.

func (*JSONViewLocale) Keys 实验性 ​

go
func (l *JSONViewLocale) Keys(n int) string

Keys formats an object size.

func (*JSONViewLocale) Match 实验性 ​

go
func (l *JSONViewLocale) Match(i, n int) string

Match formats the match position.

func (*JSONViewLocale) ParseError 实验性 ​

go
func (l *JSONViewLocale) ParseError(msg string) string

ParseError formats a parse error.

JSONViewW 实验性 ​

go
type JSONViewW struct {
	// contains filtered or unexported fields
}

JSONViewW shows a value tree: a JSON document (JSONView), a Go value (JSONViewValue) or any ValueSource such as a debugger's variables (JSONViewSource). Nodes load when expanded, large arrays and objects open in groups of 100, and only the visible rows are built. Values are colored by type; containers show their size. A row's context menu (or Cmd/Ctrl+C, Cmd/Ctrl+Shift+C on the current row) copies its value or its path ($.a.b[0]); the toolbar searches keys and values and expands or collapses everything.

Keyboard (the tree is one Tab stop): Up/Down/Page Up/Page Down/Home/End move the current row, Right expands or enters, Left collapses or goes to the parent, Enter toggles.

func JSONView 实验性 ​

go
func JSONView(c *Context, data []byte, opts ...layout.Option) *JSONViewW

JSONView adds a viewer of the JSON document data (shown with an error message when it is not valid JSON). The same data slice (by address and length) keeps the tree's state; replace the slice to show new data.

ui.JSONView(c, body).Height(400)

func JSONViewSource 实验性 ​

go
func JSONViewSource(c *Context, src ValueSource, opts ...layout.Option) *JSONViewW

JSONViewSource adds a viewer of a value tree source (a debugger's variables, a remote document …). The same source value keeps the tree's state; bump DataVersion to reload it.

func JSONViewValue 实验性 ​

go
func JSONViewValue(c *Context, v any, opts ...layout.Option) *JSONViewW

JSONViewValue adds a viewer of a Go value (see GoValueSource). Pass a pointer, map or slice to keep the tree's state across frames, and bump DataVersion when its contents change.

func (*JSONViewW) A11yLabel 实验性 ​

go
func (w *JSONViewW) A11yLabel(s string) *JSONViewW

A11yLabel sets the accessible name of the tree.

func (*JSONViewW) Copied 实验性 ​

go
func (w *JSONViewW) Copied() string

Copied returns the text copied this frame ("" if none).

func (*JSONViewW) Current 实验性 ​

go
func (w *JSONViewW) Current() string

Current returns the path of the current row ("" if none).

func (*JSONViewW) DataVersion 实验性 ​

go
func (w *JSONViewW) DataVersion(v int) *JSONViewW

DataVersion reloads the tree when v changes (keeping what is expanded).

func (*JSONViewW) ExpandDepth 实验性 ​

go
func (w *JSONViewW) ExpandDepth(n int) *JSONViewW

ExpandDepth sets how many levels open when data is first shown (default 1: the roots).

func (*JSONViewW) Height 实验性 ​

go
func (w *JSONViewW) Height(px float32) *JSONViewW

Height fixes the viewer's height (toolbar included); without it the viewer grows in its parent.

func (*JSONViewW) ID 实验性 ​

go
func (w *JSONViewW) ID() ID

ID returns the viewer's ID.

func (*JSONViewW) Layout 实验性 ​

go
func (w *JSONViewW) Layout(opts ...layout.Option) *JSONViewW

Layout applies layout options to the viewer.

func (*JSONViewW) Matches 实验性 ​

go
func (w *JSONViewW) Matches() int

Matches returns the number of search matches found so far.

func (*JSONViewW) NoToolbar 实验性 ​

go
func (w *JSONViewW) NoToolbar() *JSONViewW

NoToolbar hides the search / expand toolbar.

func (*JSONViewW) Query 实验性 ​

go
func (w *JSONViewW) Query(q *string) *JSONViewW

Query binds the search text to *q.

func (*JSONViewW) Rows 实验性 ​

go
func (w *JSONViewW) Rows() int

Rows returns the number of visible rows (expanded nodes included).

func (*JSONViewW) ShowTypes 实验性 ​

go
func (w *JSONViewW) ShowTypes() *JSONViewW

ShowTypes shows the nodes' Type labels.

KbdW 实验性 ​

go
type KbdW struct {
	*Box
	// contains filtered or unexported fields
}

KbdW is the key cap Kbd returns; it embeds the widget's Box.

func Kbd 实验性 ​

go
func Kbd(c *Context, keys string) *KbdW

Kbd shows a keyboard key or shortcut (shadcn/ui Kbd): small muted rounded box in the text font.

KeyboardInsetWindow 实验性 ​

go
type KeyboardInsetWindow interface {
	KeyboardInset() geom.Insets
}

KeyboardInsetWindow is implemented by windows that know the part of their content area covered by the soft keyboard (usually only Bottom; zero while it is hidden). It is polled every frame like SafeAreaWindow, so it must return a cached value.

KeyboardReveal 实验性 ​

go
type KeyboardReveal struct {
	Field ID        // the focused widget
	Rect  geom.Rect // its rectangle
	Caret geom.Rect // its caret (Context.WantTextInput)
	// Limit is the window y the revealed part must end above: the top of
	// the keyboard minus a margin.
	Limit float32
}

KeyboardReveal is a request to scroll the focused text field above the soft keyboard. Rectangles are window logical pixels from the last painted frame.

func (KeyboardReveal) Target 实验性 ​

go
func (k KeyboardReveal) Target(top float32) geom.Rect

Target returns what to bring into view in a viewport whose visible part starts at window y top: the whole field (with its caret) when it fits between top and Limit, else only the caret line.

Label ​

go
type Label struct {
	// contains filtered or unexported fields
}

Label is a run of text (Typography.Text).

func Paragraph ​

go
func Paragraph(c *Context, s string) *Label

Paragraph is Text intended for long-form content.

func Text ​

go
func Text(c *Context, s string) *Label

Text adds a single paragraph of text that wraps to its width.

func Title ​

go
func Title(c *Context, s string, level int) *Label

Title adds a heading; level 1..5 like Typography.Title.

func (*Label) Align ​

go
func (t *Label) Align(a TextAlign) *Label

Align aligns the text in its box.

func (*Label) Code ​

go
func (t *Label) Code() *Label

func (*Label) Color ​

go
func (t *Label) Color(col theme.Color) *Label

Color sets the text color.

func (*Label) Copied ​

go
func (t *Label) Copied() bool

Copied reports whether the copy icon was clicked within the last 3s.

func (*Label) CopyText ​

go
func (t *Label) CopyText(payload string) *Label

CopyText is Copyable with a different clipboard payload.

func (*Label) Copyable ​

go
func (t *Label) Copyable() *Label

Copyable adds a copy icon after the text; clicking it writes the text to the clipboard and shows a check mark for three seconds.

func (*Label) Delete ​

go
func (t *Label) Delete() *Label

func (*Label) Disabled ​

go
func (t *Label) Disabled() *Label

Disabled greys the text out.

func (*Label) Editable ​

go
func (t *Label) Editable(val *string) *Label

Editable adds an edit icon; clicking it swaps the text for an input. Enter or losing focus commits into *val, Escape cancels.

func (*Label) Editing ​

go
func (t *Label) Editing() bool

Editing reports whether the label is being edited.

func (*Label) Ellipsis ​

go
func (t *Label) Ellipsis() *Label

Ellipsis keeps one line and truncates with "…".

func (*Label) Expandable ​

go
func (t *Label) Expandable(open *bool) *Label

Expandable adds an "展开" link when the text is cut by Lines(n); open is toggled by the link ("收起" collapses when open).

func (*Label) ID ​

go
func (t *Label) ID() ID

ID returns the node ID.

func (*Label) Italic ​

go
func (t *Label) Italic() *Label

Italic slants the text (synthetic oblique).

func (*Label) Layout ​

go
func (t *Label) Layout(opts ...layout.Option) *Label

Layout applies layout options to the text node.

func (*Label) LineHeight ​

go
func (t *Label) LineHeight(px float32) *Label

LineHeight overrides the line height in px.

func (*Label) Lines ​

go
func (t *Label) Lines(n int) *Label

Lines limits wrapping to n lines with an ellipsis.

func (*Label) Mark ​

go
func (t *Label) Mark() *Label

func (*Label) NoWrap ​

go
func (t *Label) NoWrap() *Label

NoWrap keeps the text on one line.

func (*Label) Secondary ​

go
func (t *Label) Secondary() *Label

Secondary uses the secondary text color.

func (*Label) Size ​

go
func (t *Label) Size(px float32) *Label

Size sets the font size (line height follows the theme).

func (*Label) Strong ​

go
func (t *Label) Strong() *Label

Strong uses the theme's strong weight.

func (*Label) Tertiary ​

go
func (t *Label) Tertiary() *Label

Tertiary uses the tertiary text color (descriptions, hints).

func (*Label) TextDir ​

go
func (t *Label) TextDir(d text.Direction) *Label

TextDir sets the paragraph base direction explicitly. By default label text follows the scope: RTL in an RTL scope, else taken from the first strong character (text.DirAuto).

func (*Label) Type ​

go
func (t *Label) Type(status string) *Label

Type colors the text by status: "success", "warning", "danger"/"error".

func (*Label) Underline ​

go
func (t *Label) Underline() *Label

Underline / Delete / Code / Mark decorations.

func (*Label) Weight ​

go
func (t *Label) Weight(w text.Weight) *Label

Weight sets the font weight.

LightFilterLocale 实验性 ​

go
type LightFilterLocale struct {
	Name     string // accessible name of the toolbar
	ClearFmt string // clear button of a field, arg: field label ("清除%s")
	PillFmt  string // accessible name of a field pill, args: label, value ("%s:%s")
	More     string // collapsed fields button
	MoreFmt  string // collapsed fields button with values set, arg: count ("更多筛选(%d)")
	// contains filtered or unexported fields
}

LightFilterLocale holds the LightFilter texts.

LightFilterW 实验性 ​

go
type LightFilterW struct {
	// contains filtered or unexported fields
}

LightFilterW is a compact filter bar (Ant Design Pro LightFilter): each field is a "label: value" pill; clicking it opens a popup with the field's editor and clear / confirm buttons. It takes the same field definitions as QueryFilter and ProForm.

lf := ui.LightFilter(c, fields).Values(&filter).Show()
if lf.Changed() { reload(lf.Params()) }

func LightFilter 实验性 ​

go
func LightFilter(c *Context, fields []ProField) *LightFilterW

LightFilter starts a filter bar over fields; chain options, then Show.

ConfigProvider.Defaults("LightFilter", ...) keys: "size", "bordered", "collapse" (number of pills before "more filters").

func (*LightFilterW) Bordered 实验性 ​

go
func (f *LightFilterW) Bordered() *LightFilterW

Bordered draws an outline around every pill.

func (*LightFilterW) Changed 实验性 ​

go
func (f *LightFilterW) Changed() bool

Changed reports a value confirmed or cleared in the last Show.

func (*LightFilterW) Collapse 实验性 ​

go
func (f *LightFilterW) Collapse(n int) *LightFilterW

Collapse shows at most n fields as pills; the others are edited together in a "more filters" popup (n <= 0: every field is a pill).

func (*LightFilterW) ID 实验性 ​

go
func (f *LightFilterW) ID() ID

ID returns the widget ID (valid after Show).

func (*LightFilterW) OpenKey 实验性 ​

go
func (f *LightFilterW) OpenKey() string

OpenKey returns the key of the field whose popup is open ("" if none).

func (*LightFilterW) Params 实验性 ​

go
func (f *LightFilterW) Params() map[string]string

Params returns the non-empty values as text (dates as 2006-01-02).

func (*LightFilterW) Show 实验性 ​

go
func (f *LightFilterW) Show() *LightFilterW

Show builds the bar.

func (*LightFilterW) Size 实验性 ​

go
func (f *LightFilterW) Size(s ControlSize) *LightFilterW

Size sets the pill size (default: the global size).

func (*LightFilterW) Values 实验性 ​

go
func (f *LightFilterW) Values(v *ProValues) *LightFilterW

Values binds the values (otherwise the filter keeps its own).

LinkW ​

go
type LinkW struct {
	*Label
	// contains filtered or unexported fields
}

LinkW is a clickable text link.

go
func Link(c *Context, s string) *LinkW

Link adds a hyperlink-styled text button.

ConfigProvider.Defaults("Link", ...) keys: "underline" ("always" | "hover" | "never"; Element underline).

func (*LinkW) Clicked ​

go
func (lw *LinkW) Clicked() bool

Clicked reports activation.

func (*LinkW) Color ​

go
func (lw *LinkW) Color(col theme.Color) *LinkW

Color draws the link in col in every state (disabled still greys out).

func (*LinkW) Hovered ​

go
func (lw *LinkW) Hovered() bool

Hovered reports hover.

func (*LinkW) Icon ​

go
func (lw *LinkW) Icon(ic *icon.Icon) *LinkW

Icon puts an icon before the text in the link color (Element el-link icon).

func (*LinkW) Secondary ​

go
func (lw *LinkW) Secondary() *LinkW

Secondary is Type("secondary").

func (*LinkW) Type ​

go
func (lw *LinkW) Type(status string) *LinkW

Type colors the link by status: "success", "warning", "danger" / "error", "info" use that palette (hover and pressed shades follow); "secondary" (or Element's "default") starts in the secondary text color and turns link-colored on hover; "primary" is the primary palette. "" restores the link colors.

func (*LinkW) UnderlineMode ​

go
func (lw *LinkW) UnderlineMode(mode string) *LinkW

UnderlineMode sets when the link is underlined: "always", "hover" or "never" (Element underline; the default follows the theme: never for Ant, on hover for Element, always for shadcn). Other values restore the theme's.

ListActionsW 实验性 ​

go
type ListActionsW struct {
	*Box
	// contains filtered or unexported fields
}

ListActionsW is the action row ListActions returns; it embeds the row's Box.

func ListActions 实验性 ​

go
func ListActions(c *Context, fn func()) *ListActionsW

ListActions lays out item actions at the end of a list row, separated by short vertical bars (Ant's actions). In a vertical list they sit under the content, wider apart.

ListItemMetaW 实验性 ​

go
type ListItemMetaW struct {
	*Box
	// contains filtered or unexported fields
}

ListItemMetaW is the block ListItemMeta returns; it embeds the row's Box.

func ListItemMeta 实验性 ​

go
func ListItemMeta(c *Context, avatar func(), title, desc string) *ListItemMetaW

ListItemMeta is the avatar + title + description block of a list item. avatar may be nil. It grows to take the row's free space.

In a vertical list (List.ItemLayout("vertical")) the title is large with a 12px gap under it and the block keeps 16px below.

ListToolBarW 实验性 ​

go
type ListToolBarW struct {
	// contains filtered or unexported fields
}

ListToolBarW composes the title, subtitle, tooltip, search, actions, settings, filter, tabs and header menu of a list. ProTable uses this same public component for its toolbar, passing its existing settings.

func ListToolBar 实验性 ​

go
func ListToolBar(c *Context) *ListToolBarW

ListToolBar starts a list toolbar; chain options, then Show. ConfigProvider.Defaults keys: "title", "subTitle", "tooltip" (strings), "search" (bool, default false), "multipleLine" (bool, default false).

func (*ListToolBarW) Actions 实验性 ​

go
func (w *ListToolBarW) Actions(fn func()) *ListToolBarW

Actions builds the right-hand actions.

func (*ListToolBarW) Filter 实验性 ​

go
func (w *ListToolBarW) Filter(fn func()) *ListToolBarW

Filter builds the filter area (for example LightFilter).

func (*ListToolBarW) ID 实验性 ​

go
func (w *ListToolBarW) ID() ID

ID returns the toolbar ID after Show.

func (*ListToolBarW) Menu 实验性 ​

go
func (w *ListToolBarW) Menu(kind string, active *string, items []TabItem) *ListToolBarW

Menu sets the header menu, replacing the heading; kind is "inline" (default), "tab" or "dropdown". A nil active pointer is uncontrolled.

func (*ListToolBarW) MultipleLine 实验性 ​

go
func (w *ListToolBarW) MultipleLine(on bool) *ListToolBarW

MultipleLine places filters and tabs on a separate line.

func (*ListToolBarW) OnSearch 实验性 ​

go
func (w *ListToolBarW) OnSearch(fn func(string)) *ListToolBarW

OnSearch receives a submitted keyword (Enter or search button).

func (*ListToolBarW) Search 实验性 ​

go
func (w *ListToolBarW) Search(s *string) *ListToolBarW

Search binds the search input; nil hides it.

func (*ListToolBarW) Settings 实验性 ​

go
func (w *ListToolBarW) Settings(fn func()) *ListToolBarW

Settings builds the right-hand settings (use named IconButtons).

func (*ListToolBarW) Show 实验性 ​

go
func (w *ListToolBarW) Show() *ListToolBarW

Show builds the toolbar.

func (*ListToolBarW) SubTitle 实验性 ​

go
func (w *ListToolBarW) SubTitle(s string) *ListToolBarW

SubTitle sets the secondary text next to the heading.

func (*ListToolBarW) Tabs 实验性 ​

go
func (w *ListToolBarW) Tabs(active *string, items []TabItem) *ListToolBarW

Tabs sets the second-line tabs, shown only with MultipleLine(true). A nil active pointer keeps the active key internally.

func (*ListToolBarW) Title 实验性 ​

go
func (w *ListToolBarW) Title(s string) *ListToolBarW

Title sets the heading.

func (*ListToolBarW) Tooltip 实验性 ​

go
func (w *ListToolBarW) Tooltip(s string) *ListToolBarW

Tooltip sets the heading information tooltip.

ListW ​

go
type ListW struct {
	// contains filtered or unexported fields
}

ListW renders a list of n items (Ant Design List).

func List ​

go
func List(c *Context, n int) *ListW

List starts a list of n items; render each with Item.

ConfigProvider.Defaults("List", ...) keys: "size", "bordered", "split", "itemLayout" ("horizontal" | "vertical").

func (*ListW) Bordered ​

go
func (w *ListW) Bordered() *ListW

func (*ListW) EmptyText ​

go
func (w *ListW) EmptyText(s string) *ListW

func (*ListW) EstimatedItemHeight ​

go
func (w *ListW) EstimatedItemHeight(px float32) *ListW

EstimatedItemHeight is the height Virtual assumes for an item not measured yet. Default: one line of text plus the item padding (46 at the middle size, as Listy).

func (*ListW) Footer ​

go
func (w *ListW) Footer(fn func()) *ListW

func (*ListW) Grid ​

go
func (w *ListW) Grid(columns int, gap float32) *ListW

Grid lays the items out in columns separated by gap px (antd grid gutter); every grid row keeps GridItemMarginBottom below it.

func (*ListW) GridAt ​

go
func (w *ListW) GridAt(bp Breakpoint, columns int) *ListW

GridAt sets the grid column count from breakpoint bp upwards (Ant grid={{ xs: 1, sm: 2, md: 4 }}); the largest set breakpoint not above the window width wins, Grid's count is the fallback. Without Grid the list becomes a grid with a 16px gap.

func (*ListW) Header ​

go
func (w *ListW) Header(fn func()) *ListW

func (*ListW) Height ​

go
func (w *ListW) Height(px float32) *ListW

Height fixes the height of the items' viewport (antd height); longer content scrolls inside it. Header, Footer, LoadMore and the pager stay outside it. Default 0: the list grows with its items.

func (*ListW) Item ​

go
func (w *ListW) Item(fn func(i int)) *ListW

Item builds the list, calling fn for every visible item index.

func (*ListW) ItemExtra ​

go
func (w *ListW) ItemExtra(fn func(i int)) *ListW

ItemExtra builds extra content of item i (antd List.Item extra): at the inline end of the row, or in its own column beside the content and actions with the vertical layout.

func (*ListW) ItemHeight ​

go
func (w *ListW) ItemHeight(px float32) *ListW

ItemHeight fixes every item's height, padding included (the fast path of Virtual: nothing is measured). Default 0: items size to their content.

func (*ListW) ItemLayout ​

go
func (w *ListW) ItemLayout(s string) *ListW

ItemLayout sets the item layout (antd itemLayout): "horizontal" (the default: content and actions on one line) or "vertical" (actions under the content, ItemExtra in a column at the inline end; ListItemMeta gets the large title and ListActions moves under the content).

func (*ListW) Layout ​

go
func (w *ListW) Layout(o ...layout.Option) *ListW

Layout applies layout options to the list (call after Item).

func (*ListW) LoadMore ​

go
func (w *ListW) LoadMore(label string, busy bool) *ListW

LoadMore shows a centered "load more" button under the items; query the click with LoadMoreClicked. busy shows the button in its loading state.

func (*ListW) LoadMoreClicked ​

go
func (w *ListW) LoadMoreClicked() bool

LoadMoreClicked reports a click on the load-more button in the last Item call.

func (*ListW) Loading ​

go
func (w *ListW) Loading(on bool) *ListW

func (*ListW) PageChanged ​

go
func (w *ListW) PageChanged() bool

PageChanged reports a page change in the last Item call.

func (*ListW) Pagination ​

go
func (w *ListW) Pagination(page *int, pageSize int) *ListW

Pagination shows a pager under the list and only renders the current page's items; *page is 1-based and owned by the app (out-of-range pages show the nearest page).

func (*ListW) PaginationAlign ​

go
func (w *ListW) PaginationAlign(a string) *ListW

PaginationAlign aligns the pager (antd pagination.align): "start", "center" or "end" (default).

func (*ListW) PaginationPosition ​

go
func (w *ListW) PaginationPosition(pos string) *ListW

PaginationPosition places the pager (antd pagination.position): "bottom" (default), "top" or "both".

func (*ListW) Range ​

go
func (w *ListW) Range() (first, end int)

Range returns the item indexes [first, end) built by the last Item call: the current page, or under Virtual the window (the focused item aside, which is built even outside it).

func (*ListW) RowKey ​

go
func (w *ListW) RowKey(fn func(i int) any) *ListW

RowKey gives items stable identities for the heights Virtual measures (default: the index; the measured heights are kept for every key seen, as Listy does). It does not change how items are keyed; wrap the item content in Key for state that follows the data.

func (*ListW) ScrollToKey ​

go
func (w *ListW) ScrollToKey(key any, align string, offset float64) *ListW

ScrollToKey scrolls the viewport (Height) to the item with key (RowKey; the index without one) using align (AlignTop, AlignBottom or AlignAuto) plus offset pixels. An item of the current page only; under Virtual an item not measured yet is placed by its estimate first and corrected over the next frames, as Listy.

func (*ListW) Size ​

go
func (w *ListW) Size(s ControlSize) *ListW

func (*ListW) Split ​

go
func (w *ListW) Split(on bool) *ListW

func (*ListW) Virtual ​

go
func (w *ListW) Virtual() *ListW

Virtual builds only the items in the viewport (and a few past each edge) instead of every item; it needs Height and is ignored without it. With Pagination it windows the current page; with Grid it windows rows of columns items (a row is as high as its tallest item). The item that holds the keyboard focus is built on the frame it leaves the viewport, but once its focused control is clipped out of view the focus is lost, exactly as in the non-virtual Height form. Items scrolled out of view are not built, so state kept inside them (State, an input's text) is dropped after a while and they are missing from the accessibility tree, FindText and the Tab order, as with Listy and VirtualList. Heights are measured as items come into view and cached by RowKey; an item never measured counts EstimatedItemHeight, so the scroll bar can adjust the first time a taller item appears.

ListyW 实验性 ​

go
type ListyW struct {
	// contains filtered or unexported fields
}

ListyW is a Listy list. Configure it and call Show.

func Listy 实验性 ​

go
func Listy(c *Context, n int, item func(i int)) *ListyW

Listy starts a list of n items; item(i) builds the content of row i (padded 12/16 with a divider and hover background).

ui.Listy(c, len(users), func(i int) { ui.Text(c, users[i].Name) }).
	Virtual().Height(400).Group(byLetter, letterHeader).Sticky().Show()

func (*ListyW) Clicked 实验性 ​

go
func (w *ListyW) Clicked() (int, bool)

Clicked returns the item clicked in Show.

func (*ListyW) DataVersion 实验性 ​

go
func (w *ListyW) DataVersion(v int) *ListyW

DataVersion tells the list that the data behind n, RowKey or Group changed without n changing (grouping and offsets are cached by n and this number).

func (*ListyW) EndReached 实验性 ​

go
func (w *ListyW) EndReached() bool

EndReached reports that the viewport is within 100px of the end while more data can be loaded (after Show).

func (*ListyW) EstimatedItemHeight 实验性 ​

go
func (w *ListyW) EstimatedItemHeight(px float32) *ListyW

EstimatedItemHeight is assumed for items not measured yet (default 46).

func (*ListyW) Group 实验性 ​

go
func (w *ListyW) Group(key func(i int) string, title func(key string, count int)) *ListyW

Group groups items by key(i) (items with equal keys are gathered in order of first appearance) under headers built by title(key, count).

func (*ListyW) Height 实验性 ​

go
func (w *ListyW) Height(px float32) *ListyW

Height fixes the viewport height; longer content scrolls.

func (*ListyW) ID 实验性 ​

go
func (w *ListyW) ID() ID

ID returns the viewport's ID (after Show; 0 without Height).

func (*ListyW) ItemHeight 实验性 ​

go
func (w *ListyW) ItemHeight(px float32) *ListyW

ItemHeight fixes every item's height (fast path; default: measured).

func (*ListyW) LoadMore 实验性 ​

go
func (w *ListyW) LoadMore(hasMore, loading bool) *ListyW

LoadMore adds a footer: a spinner while loading, "no more" when hasMore is false. EndReached reports when the user scrolled near it.

func (*ListyW) Offset 实验性 ​

go
func (w *ListyW) Offset() float64

Offset returns the scroll offset (0 without a viewport).

func (*ListyW) Range 实验性 ​

go
func (w *ListyW) Range() (first, end int)

Range returns the rows [first, end) built by Show (headers count as rows).

func (*ListyW) RowHoverable 实验性 ​

go
func (w *ListyW) RowHoverable(on bool) *ListyW

RowHoverable toggles the row hover background (default on).

func (*ListyW) RowKey 实验性 ​

go
func (w *ListyW) RowKey(fn func(i int) any) *ListyW

RowKey gives rows stable identities (default: the index).

func (*ListyW) ScrollTo 实验性 ​

go
func (w *ListyW) ScrollTo(px float64) *ListyW

ScrollTo scrolls to a vertical pixel offset.

func (*ListyW) ScrollToGroup 实验性 ​

go
func (w *ListyW) ScrollToGroup(group string, align string, offset float64) *ListyW

ScrollToGroup scrolls to a group header.

func (*ListyW) ScrollToKey 实验性 ​

go
func (w *ListyW) ScrollToKey(key any, align string, offset float64) *ListyW

ScrollToKey scrolls to the item with key (RowKey) using align (AlignTop, AlignBottom or AlignAuto) plus offset pixels.

func (*ListyW) Show 实验性 ​

go
func (w *ListyW) Show() *ListyW

Show builds the list.

func (*ListyW) Split 实验性 ​

go
func (w *ListyW) Split(on bool) *ListyW

Split toggles the row dividers (default on).

func (*ListyW) Sticky 实验性 ​

go
func (w *ListyW) Sticky() *ListyW

Sticky pins the current group header to the top while scrolling.

func (*ListyW) Virtual 实验性 ​

go
func (w *ListyW) Virtual() *ListyW

Virtual builds only the visible rows (needs Height).

LoadingW 实验性 ​

go
type LoadingW struct {
	// contains filtered or unexported fields
}

LoadingW covers a region or the window while loading.

func Loading 实验性 ​

go
func Loading(c *Context, on bool) *LoadingW

Loading starts a loading mask shown while on; chain options, then Body (cover a region) or Fullscreen (cover the window):

ui.Loading(c, busy).Text("加载中").Body(func() { ... })
ui.Loading(c, busy).Fullscreen()

ConfigProvider.Defaults("Spin", ...) "size" and "tip" apply.

func (*LoadingW) Background 实验性 ​

go
func (m *LoadingW) Background(col theme.Color) *LoadingW

Background overrides the mask color.

func (*LoadingW) Body 实验性 ​

go
func (m *LoadingW) Body(fn func()) *Box

Body builds the region and covers it while loading.

func (*LoadingW) Fullscreen 实验性 ​

go
func (m *LoadingW) Fullscreen() *LoadingW

Fullscreen covers the whole window while loading.

func (*LoadingW) Size 实验性 ​

go
func (m *LoadingW) Size(s ControlSize) *LoadingW

Size sets the spinner size.

func (*LoadingW) Spinner 实验性 ​

go
func (m *LoadingW) Spinner(ic *icon.Icon) *LoadingW

Spinner replaces the indicator with a spinning icon (EP element-loading-spinner, antd indicator).

func (*LoadingW) Text 实验性 ​

go
func (m *LoadingW) Text(s string) *LoadingW

Text shows a caption under the spinner (EP element-loading-text, antd Spin description).

func (*LoadingW) Tip 实验性 ​

go
func (m *LoadingW) Tip(s string) *LoadingW

Tip shows a caption under the spinner.

Deprecated: use Text.

Locale ​

go
type Locale struct {
	Code string // BCP 47 tag, e.g. "zh-CN"
	Name string // native display name, e.g. "简体中文"

	// Dir is the layout direction of the language; the zero value DirAuto
	// infers it from Code (ar, he, fa ... and Arab / Hebr script tags are
	// RTL). Not copied by FillLocale.
	Dir Direction

	// Common actions.
	OK, Cancel, Close, Confirm, Back, Clear, Reset, Search, Save, Delete, Edit, Copy, Copied, More string
	Expand, Collapse, SelectAll, Loading, Retry                                                    string
	GotIt                                                                                          string // acknowledge-only button of an alert box ("知道了")

	// Empty & lists.
	NoData, NoMore, LoadMore, LoadFailed string

	// Pagination.
	TotalFmt, RangeTotalFmt, PageSizeFmt, PrevPage, NextPage, Prev5, Next5, JumpTo, PageSuffix string

	// Form controls.
	Placeholder, SelectPlaceholder, Required, NotFound string
	LabelColon                                         string // appended to form / description labels (":", ":")
	SelectedFmt                                        string // selection count, arg: n ("已选择 %d 项")

	// Date & time.
	Today, Now, SelectDate, SelectTime, SelectDateTime, StartDate, EndDate string
	PrevYear, NextYear, PrevMonth, NextMonth                               string
	RangeSeparator                                                         string       // between the two ends of a range input ("至")
	YearFmt                                                                string       // year label, arg: year ("%d年")
	MonthFmt                                                               string       // month label, args: month number, Months entry ("%d月", "%[2]s")
	YearMonthFmt                                                           string       // panel title, args: year, month number, Months entry ("%d年%d月", "%[3]s %[1]d")
	Weekdays                                                               [7]string    // short names, Sunday first
	Months                                                                 [12]string   // short names, January first
	WeekStart                                                              time.Weekday // first column of month grids (zero value: Sunday)

	// Table.
	FilterConfirm, FilterReset, SortAsc, SortDesc, CancelSort, SelectionAll, SelectionInvert, ExpandRow, CollapseRow string

	// Counts & search.
	ItemUnit, ItemsUnit, Searching string

	// Currency is the symbol or ISO 4217 code of money values (ProField /
	// ProColumn money type) unless the field sets its own ("¥", "$", "NT$",
	// "EUR"). See FormatMoney.
	Currency string

	// Feedback & navigation.
	MessageBoxTitle, Info, Success, Warning, Error, BackTop, CollapseMenu, ExpandMenu, Fullscreen, ExitFullscreen string
	PromptPlaceholder, PromptInvalid, CloseAll, Steps                                                             string

	// Component groups.
	Calendar       CalendarLocale
	Carousel       CarouselLocale
	Image          ImageLocale
	ColorPicker    ColorPickerLocale
	Tour           TourLocale
	QRCode         QRCodeLocale
	Table          TableLocale
	ProTable       ProTableLocale
	Transfer       TransferLocale
	Upload         UploadLocale
	Markdown       MarkdownLocale
	Form           FormLocale
	MarkdownEditor MarkdownEditorLocale
	Command        CommandLocale
	A11y           A11yLocale
	Chart          ChartLocale
	Mobile         MobileLocale
	Graph          GraphLocale

	// Groups of the Pro / entry components added later.
	DatePicker      DatePickerLocale
	TimePicker      TimePickerLocale
	Tabs            TabsLocale
	Pagination      PaginationLocale
	Slider          SliderLocale
	DropZone        DropZoneLocale
	EditableTable   EditableTableLocale
	PageContainer   PageContainerLocale
	ProCard         ProCardLocale
	StatisticCard   StatisticCardLocale
	ProField        ProFieldLocale
	ProDescriptions ProDescriptionsLocale
	LightFilter     LightFilterLocale
	LoginForm       LoginFormLocale
	SettingDrawer   SettingDrawerLocale
	Dock            DockLocale

	// Groups of the data viewers (types in codeblock.go, jsonview.go,
	// logview.go).
	CodeBlock CodeBlockLocale
	JSONView  JSONViewLocale
	LogView   LogViewLocale
	// Workbench shell (locale_shell.go).
	StatusBar          StatusBarLocale
	TitleBar           TitleBarLocale
	NotificationCenter NotificationCenterLocale
	HotkeyInput        HotkeyInputLocale
	Chat               ChatLocale // AI chat components (chat_locale.go)

	// Extra holds texts of other components by key ("MyWidget.title", ...).
	Extra map[string]string
	// contains filtered or unexported fields
}

Locale holds the built-in texts of every component. Components read it with c.Locale() while building, so wrapping a page in ConfigProvider(c).Locale(ui.EnUS) switches all of them at once.

Component code never writes interface text literally: every label, placeholder, tooltip and accessible name comes from here (see AUTHORING.md section 15). The built-in packs are ZhCN (default), EnUS, ZhTW and Ja (locale_packs.go).

Texts with a number use fmt verbs (TotalFmt "共 %d 条"); call the helper methods (Total, PageSizeLabel, YearMonth ...) instead of formatting by hand. A format may ignore trailing arguments or pick them with explicit indexes ("%[3]s %[1]d"), the helpers tolerate both. Texts of a single component are grouped in a nested struct (l.Image.ZoomIn, l.Tour.Next); texts of third-party components go to Extra and are read with Locale.T(key, fallback).

只有部分成员是稳定的:未标「实验性」的方法和下列以外的字段受兼容性承诺约束。

实验性 实验性成员:Calendar、Carousel、Image、ColorPicker、Tour、QRCode、ProTable、Transfer、Upload、Markdown、MarkdownEditor、Command、Chart、Mobile、Graph、DropZone、EditableTable、PageContainer、ProCard、StatisticCard、ProField、ProDescriptions、LightFilter、LoginForm、SettingDrawer、Dock、CodeBlock、JSONView、LogView、StatusBar、TitleBar、NotificationCenter、HotkeyInput、Chat

func LocaleByCode ​

go
func LocaleByCode(code string) (*Locale, bool)

LocaleByCode looks up a registered locale ("zh-CN", "en_us", "en", "zh_TW.UTF-8"). Chinese is matched by script: zh-Hant, zh-TW, zh-HK and zh-MO find zh-TW (ZhTW), other zh tags find zh-CN; the two never stand in for each other. Otherwise a tag matches the same language without regard to region ("ja" → ja-JP, "en-GB" → en-US); the language-only entry wins, then the first registered region in code order.

func Locales ​

go
func Locales() []*Locale

Locales lists the registered locales sorted by code.

func (*Locale) Date ​

go
func (l *Locale) Date(y, m, d int) string

Date formats the full date of a calendar cell ("2026年11月12日" / "Nov 12, 2026").

func (*Locale) Digit ​

go
func (l *Locale) Digit(n, total int) string

Digit names cell n of a total-cell one-time code ("第 1 位,共 6 位").

func (*Locale) IsRTL ​

go
func (l *Locale) IsRTL() bool

IsRTL reports whether the locale lays out right to left: Dir when set, else inferred from Code.

func (*Locale) Items ​

go
func (l *Locale) Items(n int) string

Items formats a count with the item unit ("3 项" / "3 items").

func (*Locale) Month ​

go
func (l *Locale) Month(m int) string

Month formats a month label, m in 1-12 ("11月" / "Nov").

func (*Locale) Page ​

go
func (l *Locale) Page(n int) string

Page formats the accessible name of a pagination item ("第 3 页").

func (*Locale) PageSizeLabel ​

go
func (l *Locale) PageSizeLabel(n int) string

PageSizeLabel formats the page size option ("10 条/页").

func (*Locale) RangeTotal ​

go
func (l *Locale) RangeTotal(from, to, total int) string

RangeTotal formats "第 1-10 条/共 85 条".

func (*Locale) Rating ​

go
func (l *Locale) Rating(v float64, count int) string

Rating formats a rate value ("3.5 星,共 5 星").

func (*Locale) RemoveItem ​

go
func (l *Locale) RemoveItem(label string) string

RemoveItem names the remove button of a tag or file ("移除 标签").

func (*Locale) Selected ​

go
func (l *Locale) Selected(n int) string

Selected formats the selection count ("已选择 3 项").

func (*Locale) Slide ​

go
func (l *Locale) Slide(n, total int) string

Slide formats a carousel slide position ("第 2 张,共 5 张").

func (*Locale) T ​

go
func (l *Locale) T(key, fallback string) string

T returns Extra[key] or fallback.

func (*Locale) Total ​

go
func (l *Locale) Total(n int) string

Total formats the pagination total ("共 85 条").

func (*Locale) WeekdayNames ​

go
func (l *Locale) WeekdayNames() []string

WeekdayNames returns the short weekday names starting at WeekStart, in the column order of month grids.

func (*Locale) WithColon ​

go
func (l *Locale) WithColon(label string) string

WithColon appends LabelColon to a non-empty label.

func (*Locale) Year ​

go
func (l *Locale) Year(y int) string

Year formats a year label ("2026年" / "2026").

func (*Locale) YearMonth ​

go
func (l *Locale) YearMonth(y, m int) string

YearMonth formats a month title ("2026年11月" / "Nov 2026").

LogBuffer 实验性 ​

go
type LogBuffer struct {
	// contains filtered or unexported fields
}

LogBuffer holds log lines for LogView: escape sequences are parsed and levels detected once, when a line is added. It is safe for concurrent use: a goroutine reading a process's output can Write to it while the UI thread shows it (call the OnChange function to wake the UI).

With a line limit the oldest lines are dropped as new ones arrive.

func NewLogBuffer 实验性 ​

go
func NewLogBuffer(maxLines int) *LogBuffer

NewLogBuffer returns a buffer keeping at most maxLines lines (<= 0: no limit).

func (*LogBuffer) Append 实验性 ​

go
func (b *LogBuffer) Append(lines ...string)

Append adds lines (each may hold "\n", which splits it further).

func (*LogBuffer) AppendLevel 实验性 ​

go
func (b *LogBuffer) AppendLevel(level LogLevel, lines ...string)

AppendLevel adds lines with a known level (LogNone: detect it).

func (*LogBuffer) Clear 实验性 ​

go
func (b *LogBuffer) Clear()

Clear removes every line.

func (*LogBuffer) Flush 实验性 ​

go
func (b *LogBuffer) Flush()

Flush adds the unterminated tail of the written output as a line.

func (*LogBuffer) Len 实验性 ​

go
func (b *LogBuffer) Len() int

Len returns the number of lines.

func (*LogBuffer) Level 实验性 ​

go
func (b *LogBuffer) Level(i int) LogLevel

Level returns the level of line i (inherited from the line above when the line has none of its own).

func (*LogBuffer) Line 实验性 ​

go
func (b *LogBuffer) Line(i int) string

Line returns the plain text of line i (0 is the oldest kept line).

func (*LogBuffer) OnChange 实验性 ​

go
func (b *LogBuffer) OnChange(fn func())

OnChange sets a function called (outside the buffer's lock, from the goroutine that added lines) after lines are added or the buffer is cleared; pass a Context.Invalidator to repaint the view.

func (*LogBuffer) SetDetector 实验性 ​

go
func (b *LogBuffer) SetDetector(fn func(line string) LogLevel)

SetDetector replaces the level detector (default DetectLogLevel). It applies to lines added afterwards.

func (*LogBuffer) Write 实验性 ​

go
func (b *LogBuffer) Write(p []byte) (int, error)

Write appends p as output: complete lines are added, an unterminated tail waits for the next Write (or Flush). It implements io.Writer.

LogLevel 实验性 ​

go
type LogLevel uint8

LogLevel is the severity of a log line. LogView filters by a minimum level; lines whose level is unknown (LogNone) always pass.

go
const (
	LogNone LogLevel = iota
	LogTrace
	LogDebug
	LogInfo
	LogWarn
	LogError
)

The levels, lowest first.

实验性

func DetectLogLevel 实验性 ​

go
func DetectLogLevel(line string) LogLevel

DetectLogLevel finds a level word near the start of a line, within the first 120 bytes and not part of a longer word: TRACE, DEBUG, INFO, WARN, WARNING, ERROR, FATAL, PANIC, CRITICAL, SEVERE in any case, and the upper-case abbreviations TRC, DBG, INF, WRN, ERR, CRIT.

LogViewLocale 实验性 ​

go
type LogViewLocale struct {
	Name                 string // accessible name of the log area
	Search               string // search box placeholder
	PrevMatch, NextMatch string
	MatchFmt             string // current match and count, args: i, n ("%d/%d")
	NoMatch              string
	Wrap                 string
	Follow               string // keep showing the newest lines
	Level                string // level filter
	AllLevels            string
	Levels               [5]string // Trace, Debug, Info, Warn, Error
	LinesFmt             string    // line count, arg: n ("%d 行")
	// contains filtered or unexported fields
}

LogViewLocale holds the LogView toolbar texts.

func (*LogViewLocale) Lines 实验性 ​

go
func (l *LogViewLocale) Lines(n int) string

Lines formats a line count.

func (*LogViewLocale) Match 实验性 ​

go
func (l *LogViewLocale) Match(i, n int) string

Match formats the match position ("3/120").

LogViewW 实验性 ​

go
type LogViewW struct {
	// contains filtered or unexported fields
}

LogViewW shows a LogBuffer: millions of lines scroll smoothly (only the visible rows are shaped), ANSI colors and attributes are drawn, new lines keep the view at the bottom until the user scrolls up (scrolling back to the bottom follows again), and the toolbar searches (Enter / Shift+Enter or the arrows move between matches), filters by minimum level, toggles soft wrapping and following, and clears the buffer. Text is selectable and copies with Cmd/Ctrl+C.

func LogView 实验性 ​

go
func LogView(c *Context, buf *LogBuffer, opts ...layout.Option) *LogViewW

LogView adds a log viewer over buf.

logs := ui.NewLogBuffer(1_000_000) // keep the newest million lines
go cmd.Stdout.CopyTo(logs)        // Write is goroutine-safe
ui.LogView(c, logs).Height(400)

func (*LogViewW) A11yLabel 实验性 ​

go
func (w *LogViewW) A11yLabel(s string) *LogViewW

A11yLabel sets the accessible name of the log area.

func (*LogViewW) Follow 实验性 ​

go
func (w *LogViewW) Follow(on *bool) *LogViewW

Follow binds following the newest lines to *on.

func (*LogViewW) Height 实验性 ​

go
func (w *LogViewW) Height(px float32) *LogViewW

Height fixes the viewer's height (toolbar included). Without it the viewer grows in its parent (give the parent a height).

func (*LogViewW) ID 实验性 ​

go
func (w *LogViewW) ID() ID

ID returns the viewer's ID.

func (*LogViewW) Layout 实验性 ​

go
func (w *LogViewW) Layout(opts ...layout.Option) *LogViewW

Layout applies layout options to the viewer.

func (*LogViewW) LineNumbers 实验性 ​

go
func (w *LogViewW) LineNumbers(on bool) *LogViewW

LineNumbers shows line numbers (counting dropped lines, so a line keeps its number).

func (*LogViewW) Matches 实验性 ​

go
func (w *LogViewW) Matches() int

Matches returns the number of search matches found so far.

func (*LogViewW) MinLevel 实验性 ​

go
func (w *LogViewW) MinLevel(lv *LogLevel) *LogViewW

MinLevel binds the level filter to *lv: lines below it are hidden (LogNone shows everything; lines without a level always show).

func (*LogViewW) NoLevelColors 实验性 ​

go
func (w *LogViewW) NoLevelColors() *LogViewW

NoLevelColors draws warn / error / debug lines in the plain text color.

func (*LogViewW) NoToolbar 实验性 ​

go
func (w *LogViewW) NoToolbar() *LogViewW

NoToolbar hides the toolbar (bind Query / MinLevel / Wrap / Follow to drive the view from elsewhere).

func (*LogViewW) Query 实验性 ​

go
func (w *LogViewW) Query(q *string) *LogViewW

Query binds the search text to *q (case-insensitive).

func (*LogViewW) Selection 实验性 ​

go
func (w *LogViewW) Selection() string

Selection returns the selected text ("" if none).

func (*LogViewW) Wrap 实验性 ​

go
func (w *LogViewW) Wrap(on *bool) *LogViewW

Wrap binds soft wrapping to *on.

LoginFormLocale 实验性 ​

go
type LoginFormLocale struct {
	AccountTab, MobileTab      string
	Username, UsernameRequired string
	Password, PasswordRequired string
	Mobile, MobileRequired     string
	MobileInvalid              string
	Captcha, CaptchaRequired   string
	GetCode                    string
	ResendFmt                  string // code button while counting down, arg: seconds ("%d 秒后重新获取")
	CodeSentFmt                string // announcement after sending, arg: seconds
	CodeReady                  string // announcement when the countdown ends
	Remember, Forgot           string
	Submit                     string
	Others                     string // title of the other-methods row
	// contains filtered or unexported fields
}

LoginFormLocale holds the LoginForm / LoginFormPage texts.

LoginFormW 实验性 ​

go
type LoginFormW struct {
	// contains filtered or unexported fields
}

LoginFormW is a login form (Ant Design Pro LoginForm): logo, title and subtitle, account / mobile tabs, a verification code button with a countdown, "remember me", a forgot-password link, a slot for other login methods and a submit button with a loading state.

OnFinish receives ProValues with the keys loginType ("account" or "mobile"), username, password, mobile, captcha and autoLogin (bool).

ui.LoginForm(c).Title("Tango").SubTitle("...").
	OnSendCode(func(mobile string, done func(error)) { go sms(mobile, done) }).
	OnFinish(func(v ui.ProValues, done func(error)) { go login(v, done) }).
	Show()

func LoginForm 实验性 ​

go
func LoginForm(c *Context) *LoginFormW

LoginForm starts a login form; chain options, then Show.

func LoginFormPage 实验性 ​

go
func LoginFormPage(c *Context) *LoginFormW

LoginFormPage is LoginForm on a full page with a background color or image and an optional side area (Ant Design Pro LoginFormPage).

func (*LoginFormW) AccountOnly 实验性 ​

go
func (w *LoginFormW) AccountOnly() *LoginFormW

AccountOnly hides the tabs and the mobile login.

func (*LoginFormW) Actions 实验性 ​

go
func (w *LoginFormW) Actions(fn func()) *LoginFormW

Actions builds the other login methods (icons) under the form, in a group named "Other login methods". Icon-only buttons have no visible text: give each one an accessible name, e.g. ui.Button(c, "").Icon(icon.Wechat).Circle().A11yLabel("WeChat").

func (*LoginFormW) Background 实验性 ​

go
func (w *LoginFormW) Background(col theme.Color) *LoginFormW

Background sets the page background color (LoginFormPage).

func (*LoginFormW) BackgroundImage 实验性 ​

go
func (w *LoginFormW) BackgroundImage(img image.Image) *LoginFormW

BackgroundImage sets the page background image, scaled to cover (LoginFormPage).

func (*LoginFormW) CodeInterval 实验性 ​

go
func (w *LoginFormW) CodeInterval(sec int) *LoginFormW

CodeInterval sets the countdown in seconds (default 60).

func (*LoginFormW) CodeSent 实验性 ​

go
func (w *LoginFormW) CodeSent() bool

CodeSent reports that a verification code was sent in the last Show.

func (*LoginFormW) Countdown 实验性 ​

go
func (w *LoginFormW) Countdown() int

Countdown returns the seconds left before a new code can be sent.

func (*LoginFormW) Err 实验性 ​

go
func (w *LoginFormW) Err() error

Err returns the last OnFinish or OnSendCode error.

func (*LoginFormW) Finished 实验性 ​

go
func (w *LoginFormW) Finished() bool

Finished reports a completed login (OnFinish called done(nil)), once.

func (*LoginFormW) ForgotClicked 实验性 ​

go
func (w *LoginFormW) ForgotClicked() bool

ForgotClicked reports a click on the forgot-password link.

func (*LoginFormW) ID 实验性 ​

go
func (w *LoginFormW) ID() ID

ID returns the widget ID (valid after Show).

func (*LoginFormW) LoginType 实验性 ​

go
func (w *LoginFormW) LoginType() string

LoginType returns the active tab (LoginAccount or LoginMobile).

go
func (w *LoginFormW) Logo(fn func()) *LoginFormW

Logo builds the logo left of the title.

func (*LoginFormW) MobileOnly 实验性 ​

go
func (w *LoginFormW) MobileOnly() *LoginFormW

MobileOnly hides the tabs and the account login.

func (*LoginFormW) MobilePattern 实验性 ​

go
func (w *LoginFormW) MobilePattern(re string) *LoginFormW

MobilePattern replaces the mobile number pattern (default: 11 digits starting with 1).

func (*LoginFormW) OnFinish 实验性 ​

go
func (w *LoginFormW) OnFinish(fn func(v ProValues, done func(error))) *LoginFormW

OnFinish receives the values after validation; call done from any goroutine. The submit button spins meanwhile and an error is shown above the form.

func (*LoginFormW) OnForgot 实验性 ​

go
func (w *LoginFormW) OnForgot(fn func()) *LoginFormW

OnForgot shows the forgot-password link and calls fn on click.

func (*LoginFormW) OnSendCode 实验性 ​

go
func (w *LoginFormW) OnSendCode(fn func(mobile string, done func(error))) *LoginFormW

OnSendCode is called by the "get code" button with a valid mobile number; call done from any goroutine. A nil error starts the countdown.

func (*LoginFormW) Placement 实验性 ​

go
func (w *LoginFormW) Placement(s string) *LoginFormW

Placement puts the form card "left", "center" or "right" (default) of the page (LoginFormPage).

func (*LoginFormW) Show 实验性 ​

go
func (w *LoginFormW) Show() *LoginFormW

Show builds the form (or the page).

func (*LoginFormW) Side 实验性 ​

go
func (w *LoginFormW) Side(fn func()) *LoginFormW

Side builds content beside the form card (LoginFormPage), such as an activity banner.

func (*LoginFormW) SubTitle 实验性 ​

go
func (w *LoginFormW) SubTitle(s string) *LoginFormW

SubTitle sets the line under the title.

func (*LoginFormW) Submit 实验性 ​

go
func (w *LoginFormW) Submit()

Submit validates and submits the form.

func (*LoginFormW) SubmitText 实验性 ​

go
func (w *LoginFormW) SubmitText(s string) *LoginFormW

SubmitText sets the submit button's text.

func (*LoginFormW) Submitting 实验性 ​

go
func (w *LoginFormW) Submitting() bool

Submitting reports validation or OnFinish in progress.

func (*LoginFormW) Title 实验性 ​

go
func (w *LoginFormW) Title(s string) *LoginFormW

Title sets the title.

func (*LoginFormW) Values 实验性 ​

go
func (w *LoginFormW) Values() ProValues

Values returns the form values (see OnFinish).

func (*LoginFormW) Width 实验性 ​

go
func (w *LoginFormW) Width(px float32) *LoginFormW

Width sets the form width (default 328).

MarkdownEditorLocale 实验性 ​

go
type MarkdownEditorLocale struct {
	Placeholder                                                        string
	Heading, Bold, Italic, Strike, Code, Link, Quote                   string
	BulletList, OrderedList, Task, CodeBlock, Table, Divider           string
	BoldSample, ItalicSample, StrikeSample, LinkSample, TableColumnFmt string // TableColumnFmt arg: column number
	Edit, Split, Preview                                               string
	// contains filtered or unexported fields
}

MarkdownEditorLocale holds the MarkdownEditor toolbar, samples inserted by the toolbar and the view mode switch.

MarkdownEditorW 实验性 ​

go
type MarkdownEditorW struct {
	// contains filtered or unexported fields
}

MarkdownEditorW is a Markdown editor bound to *src.

func MarkdownEditor 实验性 ​

go
func MarkdownEditor(c *Context, src *string) *MarkdownEditorW

MarkdownEditor adds an editor for *src (default 400px high, split view).

ui.MarkdownEditor(c, &doc).Height(480)

func (*MarkdownEditorW) Changed 实验性 ​

go
func (w *MarkdownEditorW) Changed() bool

Changed reports an edit this frame (typing, toolbar, task toggles).

go
func (w *MarkdownEditorW) ClickedLink() string

ClickedLink returns a link clicked in the preview this frame.

func (*MarkdownEditorW) CurrentMode 实验性 ​

go
func (w *MarkdownEditorW) CurrentMode() string

CurrentMode returns the active view.

func (*MarkdownEditorW) Height 实验性 ​

go
func (w *MarkdownEditorW) Height(px float32) *MarkdownEditorW

Height sets the total height (toolbar included).

func (*MarkdownEditorW) Layout 实验性 ​

go
func (w *MarkdownEditorW) Layout(opts ...layout.Option) *MarkdownEditorW

Layout applies layout options to the outer frame.

func (*MarkdownEditorW) Mode 实验性 ​

go
func (w *MarkdownEditorW) Mode(m string) *MarkdownEditorW

Mode sets the initial view: "edit", "split" or "preview". The toolbar switches it afterwards.

func (*MarkdownEditorW) Placeholder 实验性 ​

go
func (w *MarkdownEditorW) Placeholder(s string) *MarkdownEditorW

Placeholder sets the empty-editor hint.

MarkdownImage 实验性 ​

go
type MarkdownImage struct {
	Src, Alt      string
	Width, Height float32
}

MarkdownImage describes a Markdown or HTML image. Width and Height are positive HTML pixel dimensions, or zero when unspecified.

MarkdownListStyle 实验性 ​

go
type MarkdownListStyle struct {
	Indent  float32 // logical pixels before item text, including the marker
	ItemGap float32 // logical pixels between items at the same depth
	Bullet  string  // optional marker text, reused at each depth
}

MarkdownListStyle controls Markdown list spacing and unordered markers.

MarkdownLocale 实验性 ​

go
type MarkdownLocale struct {
	ImagePrefix string // shown before the alt text of an image ("[图片] ")
	CopyCode    string
	Copied      string
	// contains filtered or unexported fields
}

MarkdownLocale holds the Markdown viewer texts.

MarkdownW 实验性 ​

go
type MarkdownW struct {
	// contains filtered or unexported fields
}

MarkdownW renders a Markdown document.

func Markdown 实验性 ​

go
func Markdown(c *Context, src string, opts ...layout.Option) *MarkdownW

Markdown adds a rendered Markdown document; it grows to its content (put it in a Scroll for long documents).

md := ui.Markdown(c, src)
if u := md.ClickedLink(); u != "" { openURL(u) }

func (*MarkdownW) BodyLineHeight 实验性 ​

go
func (m *MarkdownW) BodyLineHeight(px float32) *MarkdownW

BodyLineHeight sets the line height in logical pixels for prose, list items and table cells. Zero uses the theme line height.

go
func (m *MarkdownW) ClickedLink() string

ClickedLink returns the URL of a link clicked this frame ("" if none).

func (*MarkdownW) CodeBackground 实验性 ​

go
func (m *MarkdownW) CodeBackground(color theme.Color) *MarkdownW

CodeBackground overrides the theme's code block background. A transparent color makes the block background transparent.

func (*MarkdownW) CodeBorder 实验性 ​

go
func (m *MarkdownW) CodeBorder(color theme.Color) *MarkdownW

CodeBorder overrides the code block's border color. A transparent color hides the border.

func (*MarkdownW) CodeHeader 实验性 ​

go
func (m *MarkdownW) CodeHeader(style CodeHeaderStyle) *MarkdownW

CodeHeader styles the header of fenced code blocks. CodeLanguage and CopyCode still control whether the language and copy button are shown.

func (*MarkdownW) CodeLanguage 实验性 ​

go
func (m *MarkdownW) CodeLanguage(on bool) *MarkdownW

CodeLanguage controls whether fenced code blocks display their language label (default true). Syntax highlighting and copy controls are independent.

func (*MarkdownW) CodeLineHeight 实验性 ​

go
func (m *MarkdownW) CodeLineHeight(px float32) *MarkdownW

CodeLineHeight sets the line height of fenced code in logical pixels. Zero uses the theme line height for the code font size.

func (*MarkdownW) CodeSize 实验性 ​

go
func (m *MarkdownW) CodeSize(px float32) *MarkdownW

CodeSize sets the code block font size in logical pixels. Use 0 for the default (body size minus one).

func (*MarkdownW) Color 实验性 ​

go
func (m *MarkdownW) Color(col theme.Color) *MarkdownW

Color sets the color of body text and headings (default theme Text and TextHeading), for documents on a colored background such as a chat bubble.

func (*MarkdownW) ContentWidth 实验性 ​

go
func (m *MarkdownW) ContentWidth(px float32) *MarkdownW

ContentWidth caps the width of the document box, including its layout padding, in logical pixels. Use a positive maximum.

func (*MarkdownW) CopyCode 实验性 ​

go
func (m *MarkdownW) CopyCode(on bool) *MarkdownW

CopyCode controls whether fenced code blocks show a copy button (default true).

func (*MarkdownW) HeadingBlock 实验性 ​

go
func (m *MarkdownW) HeadingBlock(id string) (int, bool)

HeadingBlock returns the zero-based top-level block containing a heading. It accepts a heading ID or a URL fragment with a leading #. IDs are based on the heading's inline text: lowercase letters, marks, numbers, hyphens and underscores are kept, spaces become hyphens and other characters are removed. Duplicate IDs receive numeric suffixes in document order.

func (*MarkdownW) HeadingRules 实验性 ​

go
func (m *MarkdownW) HeadingRules(levels ...int) *MarkdownW

HeadingRules draws a bottom rule under the specified heading levels (1–6). With no levels, it removes the theme's heading rules.

func (*MarkdownW) HeadingSize 实验性 ​

go
func (m *MarkdownW) HeadingSize(level int, px float32) *MarkdownW

HeadingSize sets a heading level's font size in logical pixels. Use 0 for the theme default.

func (*MarkdownW) Highlighter 实验性 ​

go
func (m *MarkdownW) Highlighter(h CodeHighlighter) *MarkdownW

Highlighter sets the code highlighter of fenced code blocks with a language (default DefaultCodeHighlighter; nil: plain text).

func (*MarkdownW) ImageMaxSize 实验性 ​

go
func (m *MarkdownW) ImageMaxSize(width, height float32) *MarkdownW

ImageMaxSize caps both standalone and inline images, keeping their aspect ratio. A non-positive dimension leaves that axis unconstrained.

func (*MarkdownW) Images 实验性 ​

go
func (m *MarkdownW) Images(load func(src string) image.Image) *MarkdownW

Images supplies decoded images by source. Return nil to show the image fallback. Use ResolveImage to receive the alt text and size as well.

func (*MarkdownW) ListStyle 实验性 ​

go
func (m *MarkdownW) ListStyle(style MarkdownListStyle) *MarkdownW

ListStyle overrides the default list spacing and unordered markers.

func (*MarkdownW) NoCopy 实验性 ​

go
func (m *MarkdownW) NoCopy() *MarkdownW

NoCopy hides the copy button of code blocks.

func (*MarkdownW) NoSelect 实验性 ​

go
func (m *MarkdownW) NoSelect() *MarkdownW

NoSelect makes the text non-selectable (selection and Cmd/Ctrl+C copy are on by default).

func (*MarkdownW) QuoteBorder 实验性 ​

go
func (m *MarkdownW) QuoteBorder(color theme.Color) *MarkdownW

QuoteBorder overrides the quote's leading border color. A transparent color hides the border while preserving the quote's inset.

func (*MarkdownW) ReadOnlyTasks 实验性 ​

go
func (m *MarkdownW) ReadOnlyTasks(on bool) *MarkdownW

ReadOnlyTasks disables task toggling while retaining the checkboxes and their checked state in the accessibility tree.

func (*MarkdownW) ResolveImage 实验性 ​

go
func (m *MarkdownW) ResolveImage(load func(MarkdownImage) image.Image) *MarkdownW

ResolveImage supplies decoded images for inline and reference-style Markdown images and HTML img tags. It takes precedence over Images. Return nil to show the image fallback.

func (*MarkdownW) ScrollToBlock 实验性 ​

go
func (m *MarkdownW) ScrollToBlock(block int) bool

ScrollToBlock queues a jump to the zero-based top-level block in a Virtual Markdown viewport. It aligns the block near the top, within the scroll bounds. It returns false for a non-virtual document or an invalid index.

func (*MarkdownW) ScrollToHeading 实验性 ​

go
func (m *MarkdownW) ScrollToHeading(id string) bool

ScrollToHeading queues a jump to the heading's containing block in a Virtual Markdown viewport and reports whether the fragment was found. It returns false for a non-virtual document or an unknown heading.

func (*MarkdownW) Size 实验性 ​

go
func (m *MarkdownW) Size(px float32) *MarkdownW

Size sets the body font size (default theme FontSize).

func (*MarkdownW) TaskToggled 实验性 ​

go
func (m *MarkdownW) TaskToggled() (int, bool)

TaskToggled reports a click on a task-list checkbox: its index in document order. Apply it with src = ui.ToggleMarkdownTask(src, i).

func (*MarkdownW) Virtual 实验性 ​

go
func (m *MarkdownW) Virtual() *MarkdownW

Virtual makes Markdown a scroll viewport and builds only visible top-level blocks, with overscan. Give it a bounded height through the layout options and use it in place of an enclosing vertical Scroll.

MasonryW 实验性 ​

go
type MasonryW struct {
	// contains filtered or unexported fields
}

MasonryW is a masonry (waterfall) layout. Configure it and call Show.

func Masonry 实验性 ​

go
func Masonry(c *Context, n int, render func(i int)) *MasonryW

Masonry lays out n items built by render(i) in columns, each item going to the shortest column so far.

ui.Masonry(c, len(cards), func(i int) { card(i) }).Columns(4).Gutter(16).Show()

func (*MasonryW) Assignment 实验性 ​

go
func (w *MasonryW) Assignment() []int

Assignment returns the column of every item (after Show).

func (*MasonryW) Built 实验性 ​

go
func (w *MasonryW) Built() int

Built returns how many items were built by Show (virtual mode builds only the visible ones).

func (*MasonryW) Columns 实验性 ​

go
func (w *MasonryW) Columns(n int) *MasonryW

Columns sets the column count (default 3).

func (*MasonryW) ColumnsAt 实验性 ​

go
func (w *MasonryW) ColumnsAt(bp Breakpoint, n int) *MasonryW

ColumnsAt sets the column count from breakpoint bp upwards (Ant columns={{ xs: 1, sm: 2, md: 3 }}); the largest set breakpoint not above the window width wins, Columns is the fallback.

func (*MasonryW) EstimatedHeight 实验性 ​

go
func (w *MasonryW) EstimatedHeight(px float32) *MasonryW

EstimatedHeight is the height assumed for items not measured yet.

func (*MasonryW) Gutter 实验性 ​

go
func (w *MasonryW) Gutter(px float32) *MasonryW

Gutter sets the horizontal and vertical spacing.

func (*MasonryW) Gutters 实验性 ​

go
func (w *MasonryW) Gutters(h, v float32) *MasonryW

Gutters sets horizontal and vertical spacing separately.

func (*MasonryW) ID 实验性 ​

go
func (w *MasonryW) ID() ID

ID returns the viewport's ID in virtual mode (after Show).

func (*MasonryW) ItemColumn 实验性 ​

go
func (w *MasonryW) ItemColumn(fn func(i int) int) *MasonryW

ItemColumn pins items to a column (0-based; return -1 for automatic), so existing items keep their column when more are added.

func (*MasonryW) ItemHeight 实验性 ​

go
func (w *MasonryW) ItemHeight(fn func(i int) float32) *MasonryW

ItemHeight gives known item heights (Ant item.height); items then get that fixed height. Without it heights are measured after the first paint (EstimatedHeight is used until then).

func (*MasonryW) ItemKey 实验性 ​

go
func (w *MasonryW) ItemKey(fn func(i int) any) *MasonryW

ItemKey gives items stable identities (default: the index).

func (*MasonryW) LayoutChanged 实验性 ​

go
func (w *MasonryW) LayoutChanged() bool

LayoutChanged reports that Show placed some item in another column than the previous Show, or the item count changed (Ant onLayoutChange; read the columns with Assignment).

func (*MasonryW) Show 实验性 ​

go
func (w *MasonryW) Show() *MasonryW

Show builds the layout.

func (*MasonryW) Virtual 实验性 ​

go
func (w *MasonryW) Virtual(height float32) *MasonryW

Virtual scrolls the layout inside a viewport of the given height and builds only the items near it.

MentionsW 实验性 ​

go
type MentionsW struct {
	// contains filtered or unexported fields
}

MentionsW is a multi-line input that suggests options after a trigger character such as '@'.

func Mentions 实验性 ​

go
func Mentions(c *Context, val *string, opts []Option) *MentionsW

Mentions adds a mention input bound to *val with candidate opts.

func (*MentionsW) A11yLabel 实验性 ​

go
func (w *MentionsW) A11yLabel(s string) *MentionsW

A11yLabel sets the accessible name (inside a FormItem the item label is used; the placeholder is the last resort).

func (*MentionsW) AllowClear 实验性 ​

go
func (w *MentionsW) AllowClear() *MentionsW

AllowClear shows a clear button at the inline end of the first line while the input has text (Ant allowClear).

func (*MentionsW) Changed 实验性 ​

go
func (w *MentionsW) Changed() bool

Changed reports an edit this frame.

func (*MentionsW) Cleared 实验性 ​

go
func (w *MentionsW) Cleared() bool

Cleared reports that the clear button emptied the input this frame.

func (*MentionsW) DataVersion 实验性 ​

go
func (w *MentionsW) DataVersion(v int) *MentionsW

DataVersion tells the mentions input that the options slice was modified in place (a virtual list caches its matches and label widths by slice identity, length and this number): after editing options of the same slice without changing its length, change v (or pass a new slice) so the matches and the list's width are recomputed on the next frame.

func (*MentionsW) Debounce 实验性 ​

go
func (w *MentionsW) Debounce(d time.Duration) *MentionsW

Debounce sets the delay before a Remote call.

func (*MentionsW) Disabled 实验性 ​

go
func (w *MentionsW) Disabled(on bool) *MentionsW

func (*MentionsW) IsOpen 实验性 ​

go
func (w *MentionsW) IsOpen() bool

IsOpen reports whether suggestions are shown.

func (*MentionsW) Layout 实验性 ​

go
func (w *MentionsW) Layout(o ...layout.Option) *MentionsW

func (*MentionsW) Loading 实验性 ​

go
func (w *MentionsW) Loading(on bool) *MentionsW

Loading shows a spinner and the loading text in the suggestions (in place of the options with Remote, or when there are none).

func (*MentionsW) Open 实验性 ​

go
func (w *MentionsW) Open() *MentionsW

Open forces the suggestions open when a trigger is at the caret (tests, screenshots).

func (*MentionsW) Placeholder 实验性 ​

go
func (w *MentionsW) Placeholder(s string) *MentionsW

func (*MentionsW) Placement 实验性 ​

go
func (w *MentionsW) Placement(p Placement) *MentionsW

Placement opens the suggestions below (BottomStart, default) or above (TopStart) the input (Ant placement "bottom" / "top", Element placement); ConfigProvider.Defaults("Mentions", "placement") takes "top" / "bottom".

func (*MentionsW) Prefix 实验性 ​

go
func (w *MentionsW) Prefix(p ...string) *MentionsW

Prefix sets the trigger characters (default "@").

func (*MentionsW) Query 实验性 ​

go
func (w *MentionsW) Query() (prefix, query string, ok bool)

Query returns the mention being typed at the caret: its trigger prefix and the text after it; ok is false when the caret is not in a mention. Read it after the build (or from a Remote callback) to drive suggestions yourself.

func (*MentionsW) Remote 实验性 ​

go
func (w *MentionsW) Remote(fn func(prefix, query string)) *MentionsW

Remote turns on server-side suggestions: after an edit at an active mention, fn receives its trigger prefix and the text typed after it once Debounce (300ms by default) has passed, on the UI thread. Start the request in the background, pass Loading(true) while it runs, then replace the options given to Mentions (shown as-is, not filtered by the query) and wake the window with Invalidate.

ui.Mentions(c, &msg, users).Remote(func(p, q string) { go lookup(p, q) }).Loading(busy)

func (*MentionsW) Rows 实验性 ​

go
func (w *MentionsW) Rows(n int) *MentionsW

func (*MentionsW) Selected 实验性 ​

go
func (w *MentionsW) Selected() string

Selected returns the option value inserted this frame ("" if none).

func (*MentionsW) Size 实验性 ​

go
func (w *MentionsW) Size(s ControlSize) *MentionsW

func (*MentionsW) Split 实验性 ​

go
func (w *MentionsW) Split(s string) *MentionsW

Split sets the text inserted after a picked mention (Ant split, default " "; Element split). "" inserts nothing.

func (*MentionsW) Status 实验性 ​

go
func (w *MentionsW) Status(s string) *MentionsW

func (*MentionsW) Variant 实验性 ​

go
func (w *MentionsW) Variant(v FieldVariant) *MentionsW

Variant sets the frame look (FieldOutlined by default).

func (*MentionsW) Virtual 实验性 ​

go
func (w *MentionsW) Virtual(on bool) *MentionsW

Virtual forces the virtual suggestion list on or off; by default lists longer than 100 suggestions are virtual (only the visible rows and the keyboard row are built; the list keeps the width, height and scroll range of the full list, but suggestions out of view are not in the accessibility tree). Labels, values and Disabled are always read live. A virtual list keeps which options match while the options slice (identity and length), the query and the DataVersion stay the same, and measures label widths once per slice, DataVersion and theme: an option renamed in place (same slice, same length) does not join or leave the matches, nor change the list's width, until the query, the slice or the DataVersion (or the theme pointer) changes. Virtual(false) builds every row.

func (*MentionsW) Whole 实验性 ​

go
func (w *MentionsW) Whole() *MentionsW

Whole makes Backspace delete a mention as one unit (Element whole): with the caret right after a mention ("@name", or "@name " as inserted by a pick), one Backspace removes the whole mention. A mention is a trigger prefix at the start of a word followed by non-space text; see WholeCheck to restrict which ones count.

func (*MentionsW) WholeCheck 实验性 ​

go
func (w *MentionsW) WholeCheck(fn func(prefix, value string) bool) *MentionsW

WholeCheck decides which mentions Whole deletes as a unit (Element check-is-whole): fn receives the trigger prefix and the text after it. Implies Whole.

ui.Mentions(c, &msg, users).WholeCheck(func(p, v string) bool { return known[v] })

func (*MentionsW) Width 实验性 ​

go
func (w *MentionsW) Width(px float32) *MentionsW
go
type MenuItem struct {
	Key      string
	Label    string
	Icon     *icon.Icon
	Children []MenuItem
	Disabled bool
	Danger   bool
	Divider  bool // render a separator instead of an item
	// Group makes the entry a titled group of Children (Ant type="group",
	// Element el-menu-item-group): Label is a non-clickable title and the
	// children follow at the same level. Dropdowns and pop-out submenus
	// show it as a titled section (shadcn: a DropdownMenuLabel set apart
	// by separators); keyboard navigation skips the title.
	Group bool
	// Shortcut is the item's keyboard shortcut text ("Ctrl+C", "⌘K"),
	// shown in a dimmer column at the item's inline end of Dropdown panels,
	// Menu pop-out submenus and ContextMenuAt. It is display only (the app
	// handles the key itself); the label stays the accessible name and the
	// shortcut is exposed as the node's keyboard shortcut.
	Shortcut string
	// Radio marks a point context-menu leaf as a single-choice item. The
	// caller owns the checked value and updates it when the item is chosen.
	Radio *bool
}

MenuItem is an entry of Menu / Dropdown.

go
func MenuPath(items []MenuItem, key string) []MenuItem

MenuPath returns the items from the root to the item with key (parent submenus first), or nil when key is not in items.

go
type MenuMode uint8

MenuMode selects how Menu shows submenus.

Append-only: never reorder or insert; the zero value stays MenuInline.

go
const (
	MenuInline     MenuMode = iota // submenus expand in place (sider)
	MenuVertical                   // submenus pop out to the right
	MenuHorizontal                 // top bar, submenus drop down
)
go
type MenuW struct {
	// contains filtered or unexported fields
}

MenuW is a navigation menu: inline, vertical and horizontal modes, collapsed icon mode with pop-out submenus and tooltips, dark theme, accordion behavior and keyboard navigation.

Keyboard (the menu items are in the Tab order): Up/Down move between visible items; in inline mode Right opens a submenu (again: enters it) and Left closes it or returns to the parent; in vertical / collapsed mode Right or Enter opens the pop-out submenu and moves into it; in horizontal mode Left/Right move along the bar and Down or Enter opens the dropdown. Enter/Space choose a leaf and Escape closes a pop-out submenu.

go
func Menu(c *Context, items []MenuItem, selected *string) *MenuW

Menu starts a menu bound to the selected key; chain options, then Show.

ConfigProvider.Defaults("Menu", ...) keys: "mode" (MenuMode), "theme" ("dark" | "light"), "accordion", "inlineCollapsed", "selectable", "tooltip", "ellipsis" (bool), "inlineIndent" (float32 px), "subMenuOpenDelay" / "subMenuCloseDelay" (time.Duration; default the Menu token: Ant 100 / 100 ms, Element 300 / 300 ms, shadcn 200 / 150 ms), "triggerSubMenuAction" ("hover" | "click").

go
func (m *MenuW) Accordion() *MenuW

Accordion keeps only one branch of inline submenus open (Element unique-opened).

go
func (m *MenuW) Clicked() string

Clicked returns the leaf key clicked this frame.

go
func (m *MenuW) Collapsed(on bool) *MenuW

Collapsed shows icons only; submenus pop out on hover.

go
func (m *MenuW) Dark() *MenuW

Dark uses the dark sider colors (Ant theme="dark", Element's dark el-menu). Under shadcn/ui it is ignored by design: shadcn has a single Sidebar look built from the --sidebar-* variables, which already follow the light / dark theme (theme.Shadcn(theme.Dark()) gives the dark sidebar); a dark sidebar on a light shadcn page is not offered.

go
func (m *MenuW) DefaultOpen(keys ...string) *MenuW

DefaultOpen opens inline submenus initially.

go
func (m *MenuW) Ellipsis(on bool) *MenuW

Ellipsis(false) keeps every root item of a horizontal bar instead of folding the overflow into "…" (Element ellipsis).

go
func (m *MenuW) ExpandIcon(ic *icon.Icon) *MenuW

ExpandIcon replaces the submenu chevron (antd expandIcon).

go
func (m *MenuW) InlineIndent(px float32) *MenuW

InlineIndent sets the indent per inline level (antd inlineIndent 24, Element --el-menu-level-padding 20; default the Menu token).

go
func (m *MenuW) ItemPanel(key string, fn func()) *MenuW

ItemPanel shows fn in the drop-down panel of the root item keyed key of a horizontal menu instead of its children (shadcn NavigationMenuContent): hovering or focusing the item opens the panel, Escape or leaving it closes it. The item gets a chevron like a submenu.

go
func (m *MenuW) Mode(md MenuMode) *MenuW

Mode selects inline (default), vertical or horizontal.

go
func (m *MenuW) OpenChanged() bool

OpenChanged reports that the user opened or closed an inline submenu this frame.

go
func (m *MenuW) OpenKeys(keys *[]string) *MenuW

OpenKeys binds the keys of the open inline submenus (antd openKeys / onOpenChange, Element default-openeds): the menu reads and writes *keys; OpenChanged reports a change. Keys that are not submenus of the menu are ignored.

go
func (m *MenuW) OverflowedIndicator(ic *icon.Icon) *MenuW

OverflowedIndicator replaces the icon of the "…" item that collects the items a horizontal bar cannot fit (antd overflowedIndicator, Element ellipsis-icon).

go
func (m *MenuW) Selectable(on bool) *MenuW

Selectable(false) leaves the selected key alone when a leaf is clicked (antd selectable; Clicked still reports it).

go
func (m *MenuW) Show() *MenuW

Show builds the menu.

go
func (m *MenuW) SubMenuCloseDelay(d time.Duration) *MenuW

SubMenuCloseDelay waits d before a pop-out submenu closes once the pointer left it (antd subMenuCloseDelay, Element hide-timeout).

go
func (m *MenuW) SubMenuOpenDelay(d time.Duration) *MenuW

SubMenuOpenDelay waits d before a hovered pop-out submenu opens (antd subMenuOpenDelay, Element show-timeout).

go
func (m *MenuW) Tooltip(on bool) *MenuW

Tooltip(false) turns off the tooltip of a collapsed menu's root items (antd tooltip={false}).

go
func (m *MenuW) TriggerSubMenuAction(t Trigger) *MenuW

TriggerSubMenuAction selects how pop-out submenus open: TriggerHover (default) or TriggerClick (antd triggerSubMenuAction, Element menu-trigger); a click popup stays until a choice, Escape or a press outside.

go
func (m *MenuW) Width(px float32) *MenuW

Width sets the expanded width (default: fill).

go
type MenubarItem struct {
	Key      string
	Label    string
	Icon     *icon.Icon
	Shortcut string // display only, like MenuItem.Shortcut
	Disabled bool
	Danger   bool
	Divider  bool // a separator instead of an item
	// Group makes the entry a titled group of Children shown inline (a
	// radio group under a label, for example), like MenuItem.Group.
	Group bool
	Kind  MenubarItemKind
	// Checked is the value a checkbox item shows and toggles.
	Checked *bool
	// Radio is the value of the radio group the item belongs to: the item
	// is checked when *Radio equals Value (Key when Value is empty) and
	// choosing it stores that value.
	Radio *string
	Value string
	// Children open as a submenu (or, with Group, form the group).
	Children []MenubarItem
}

MenubarItem is an entry of a Menubar menu. Key identifies the item (Label is used when Key is empty) and must be unique within its menu.

go
type MenubarItemKind string

MenubarItemKind is the behaviour of a Menubar item. Open set: new kinds are added as new constants.

go
const (
	MenubarItemNormal   MenubarItemKind = ""         // runs a command
	MenubarItemCheckbox MenubarItemKind = "checkbox" // toggles *Checked
	MenubarItemRadio    MenubarItemKind = "radio"    // sets *Radio to its value
)

实验性

go
type MenubarMenu struct {
	Key      string // identifies the menu (Label when empty)
	Label    string
	Disabled bool
	Items    []MenubarItem
}

MenubarMenu is a top-level menu of a Menubar ("File", "Edit" …).

go
type MenubarW struct {
	// contains filtered or unexported fields
}

MenubarW is an application menu bar inside the window (shadcn/ui Menubar; the menu bar of desktop applications): a row of top-level menus that open drop-down panels (the Dropdown panels) on click, or with Alt / F10 and the arrow keys.

go
func Menubar(c *Context, menus []MenubarMenu) *MenubarW

Menubar adds a menu bar with the given top-level menus:

mb := ui.Menubar(c, []ui.MenubarMenu{
	{Label: "文件", Items: []ui.MenubarItem{{Key: "new", Label: "新建", Shortcut: "Ctrl+N"}}},
	{Label: "视图", Items: []ui.MenubarItem{{Label: "状态栏", Kind: ui.MenubarItemCheckbox, Checked: &status}}},
})
switch mb.Clicked() { case "new": ... }

A click on a trigger opens its menu; while a menu is open, moving the pointer onto another trigger switches to it. Alt (pressed and released alone) or F10 moves focus to the bar and back. Keyboard: Left/Right move between the menus (mirrored in RTL), Down/Enter/Space open one, Up/Down move in it, Right/Left open and close submenus, or at the edge switch to the neighbouring menu, Enter chooses, Escape closes, a letter jumps to the next item starting with it.

go
func (m *MenubarW) A11yLabel(s string) *MenubarW

A11yLabel names the bar for assistive technology.

go
func (m *MenubarW) Changed() bool

Changed reports that a checkbox or radio item changed its value this frame.

go
func (m *MenubarW) Clicked() string

Clicked returns the key of the item chosen this frame ("" if none). Checkbox and radio items have already updated their bound value.

go
func (m *MenubarW) ID() ID

ID returns the bar's ID.

go
func (m *MenubarW) OpenMenu() string

OpenMenu returns the key of the open menu ("" when all are closed).

MessagePlacement ​

go
type MessagePlacement string

MessagePlacement is where Message toasts appear. The start / end placements are logical: in RTL the end is the left side. The zero value is the design system's default (top center; shadcn/ui: the bottom end corner, as Sonner).

go
const (
	MessageTop         MessagePlacement = "top"
	MessageTopStart    MessagePlacement = "top-start"
	MessageTopEnd      MessagePlacement = "top-end"
	MessageBottom      MessagePlacement = "bottom"
	MessageBottomStart MessagePlacement = "bottom-start"
	MessageBottomEnd   MessagePlacement = "bottom-end"
)

MessageRef ​

go
type MessageRef struct {
	// contains filtered or unexported fields
}

MessageRef configures a message opened by Message. Use it in the same call chain; it does not need to be kept.

func Message ​

go
func Message(c *Context, status, content string) *MessageRef

Message shows a global toast at the top of the window and returns a reference for further options. status: success, info, warning, error, loading.

ui.Message(c, "loading", "保存中…").Key("save").Duration(0)
ui.Message(c, "success", "已保存").Key("save") // replaces the loading one

func (*MessageRef) Duration ​

go
func (r *MessageRef) Duration(d time.Duration) *MessageRef

Duration sets how long the message stays; d <= 0 keeps it until MessageDestroy or an update with a positive duration.

func (*MessageRef) Grouping ​

go
func (r *MessageRef) Grouping() *MessageRef

Grouping merges this message into a visible one with the same content and placement: that one restarts its timer, takes the new options and shows a repeat counter (EP grouping / repeatNum). The merge happens when the message is first shown, so the options chained after Grouping apply.

func (*MessageRef) Icon ​

go
func (r *MessageRef) Icon(ic *icon.Icon) *MessageRef

Icon replaces the status icon (antd icon).

func (*MessageRef) Key ​

go
func (r *MessageRef) Key(key string) *MessageRef

Key names the message; a message with the same key already on screen is updated in place (content, status and a restarted timer) instead of stacking a new one.

func (*MessageRef) Offset ​

go
func (r *MessageRef) Offset(px float32) *MessageRef

Offset sets the distance in px from the window's top (or bottom) edge to the stack (default MessageToken.Top). The newest message of a placement decides it. shadcn/ui's Sonner stack keeps its own inset.

func (*MessageRef) OnClick ​

go
func (r *MessageRef) OnClick(fn func()) *MessageRef

OnClick runs fn when the message is clicked (antd onClick).

func (*MessageRef) OnClose ​

go
func (r *MessageRef) OnClose(fn func()) *MessageRef

OnClose runs fn once when the message has closed (timed out, closed or destroyed), as antd onClose / EP onClose.

func (*MessageRef) PauseOnHover ​

go
func (r *MessageRef) PauseOnHover(on bool) *MessageRef

PauseOnHover pauses the countdown while the pointer is over the message (antd pauseOnHover, default true; Defaults key "pauseOnHover").

func (*MessageRef) Placement ​

go
func (r *MessageRef) Placement(p MessagePlacement) *MessageRef

Placement selects where the message appears (MessageTop by default; shadcn/ui: the bottom end corner). Messages of each placement stack separately; bottom placements stack upwards.

func (*MessageRef) Plain ​

go
func (r *MessageRef) Plain() *MessageRef

Plain draws the message on the neutral popup background with only the icon in the status color (Element plain); Ant's message already looks this way.

func (*MessageRef) ShowClose ​

go
func (r *MessageRef) ShowClose() *MessageRef

ShowClose adds a close button that dismisses the message.

MirrorReport 实验性 ​

go
type MirrorReport struct {
	Width      float32 // frame width both passes ran at
	Checked    int     // nodes compared
	Skipped    int     // nodes present in both frames but exempt (NoMirror, LTR parent)
	Violations []MirrorViolation
	// Icons lists directional icons drawn unmirrored in the RTL frame
	// (icon check); IconsSkipped counts those exempt inside a NoMirror
	// node or subtree.
	Icons        []IconViolation
	IconsSkipped int
}

MirrorReport is the result of Driver.MirrorCheck.

func (MirrorReport) OK 实验性 ​

go
func (r MirrorReport) OK() bool

OK reports whether no violation (layout or icon) was found.

func (MirrorReport) String 实验性 ​

go
func (r MirrorReport) String() string

String summarizes the report, one violation per line.

MirrorViolation 实验性 ​

go
type MirrorViolation struct {
	ID    ID
	Label string    // the node's internal label (to locate it)
	Under string    // label of the nearest labelled ancestor ("" if none)
	LTR   geom.Rect // absolute rectangle in the LTR frame
	RTL   geom.Rect // absolute rectangle in the RTL frame
	Want  geom.Rect // where the RTL rectangle was expected
}

MirrorViolation is a node whose RTL position is not the mirror of its LTR position inside its parent.

func (MirrorViolation) String 实验性 ​

go
func (v MirrorViolation) String() string

MobileLocale 实验性 ​

go
type MobileLocale struct {
	PullToRefresh, ReleaseToRefresh, Refreshed string // pull-to-refresh states (the loading state uses Loading)
	TapToRetry                                 string // appended to LoadFailed in infinite lists (",点击重试")
	DayFmt, HourFmt, MinuteFmt                 string // date-time picker columns, arg: number ("%d日", "%02d时", "%02d分")
	// contains filtered or unexported fields
}

MobileLocale holds the texts of ui/mobile components.

ModalFormW 实验性 ​

go
type ModalFormW struct {
	// contains filtered or unexported fields
}

ModalFormW is a ProForm inside a Modal (Ant Design Pro ModalForm): the dialog's OK button submits (spinning while OnFinish runs) and the dialog closes once the values are saved.

func DrawerForm 实验性 ​

go
func DrawerForm(c *Context, open *bool, title string, fields []ProField) *ModalFormW

DrawerForm is ModalForm in a right-side drawer (Ant Design Pro DrawerForm).

func ModalForm 实验性 ​

go
func ModalForm(c *Context, open *bool, title string, fields []ProField) *ModalFormW

ModalForm starts a dialog form bound to open; chain options, then Show.

ConfigProvider.Defaults("ModalForm" / "DrawerForm", ...) keys: "width", "columns" (number).

func (*ModalFormW) Columns 实验性 ​

go
func (m *ModalFormW) Columns(n int) *ModalFormW

Columns lays the fields out in n grid columns.

func (*ModalFormW) DestroyOnHidden 实验性 ​

go
func (m *ModalFormW) DestroyOnHidden(on bool) *ModalFormW

DestroyOnHidden resets the field values when the form is opened again (Pro modalProps/drawerProps.destroyOnHidden). By default values survive.

func (*ModalFormW) Finished 实验性 ​

go
func (m *ModalFormW) Finished() bool

Finished reports a completed submit (the dialog just closed), once.

func (*ModalFormW) KeepValues 实验性 ​

go
func (m *ModalFormW) KeepValues() *ModalFormW

KeepValues keeps the values after closing (the default, as in Pro v3).

func (*ModalFormW) OnFinish 实验性 ​

go
func (m *ModalFormW) OnFinish(fn func(vals ProValues, done func(error))) *ModalFormW

OnFinish receives the validated values; call done (from any goroutine) when saved. A nil error closes the dialog.

func (*ModalFormW) Readonly 实验性 ​

go
func (m *ModalFormW) Readonly(on bool) *ModalFormW

Readonly shows the values read-only (a details dialog): the drawer drops its OK button and the modal's OK just closes it.

func (*ModalFormW) Show 实验性 ​

go
func (m *ModalFormW) Show() *ModalFormW

Show builds the dialog (nothing while closed).

func (*ModalFormW) Values 实验性 ​

go
func (m *ModalFormW) Values(v *ProValues) *ModalFormW

Values binds the values.

func (*ModalFormW) Width 实验性 ​

go
func (m *ModalFormW) Width(px float32) *ModalFormW

Width sets the dialog width (drawer: its size).

ModalW ​

go
type ModalW struct {
	// contains filtered or unexported fields
}

ModalW is a dialog over a mask: centered or top placement, draggable, fullscreen, custom footer and close options.

go
func Modal(c *Context, open *bool, title string) *ModalW

Modal starts a dialog shown while *open; chain options, then Body.

The default width, top and centering come from theme.ModalToken (Ant 520 / 100, Element 50% / 15%, shadcn 512 centered). Besides the keys read in shad2c_defaults.go, ConfigProvider.Defaults("Modal", ...) reads "keyboard" (bool).

func (*ModalW) AfterOpenChanged ​

go
func (m *ModalW) AfterOpenChanged() bool

AfterOpenChanged reports, after Body, that the open or close transition finished this frame (antd afterOpenChange; read *open for the new state, false is antd afterClose).

func (*ModalW) Body ​

go
func (m *ModalW) Body(fn func()) *ModalW

Body builds the dialog content.

func (*ModalW) CancelText ​

go
func (m *ModalW) CancelText(s string) *ModalW

func (*ModalW) Cancelled ​

go
func (m *ModalW) Cancelled() bool

Cancelled reports cancel / close / mask click / Escape this frame.

func (*ModalW) Centered ​

go
func (m *ModalW) Centered() *ModalW

Centered centers the dialog vertically.

func (*ModalW) Closable ​

go
func (m *ModalW) Closable(on bool) *ModalW

func (*ModalW) ConfirmLoading ​

go
func (m *ModalW) ConfirmLoading(on bool) *ModalW

func (*ModalW) Danger ​

go
func (m *ModalW) Danger() *ModalW

func (*ModalW) Draggable ​

go
func (m *ModalW) Draggable() *ModalW

Draggable lets the user move the dialog by its header.

func (*ModalW) Footer ​

go
func (m *ModalW) Footer(fn func()) *ModalW

func (*ModalW) Fullscreen ​

go
func (m *ModalW) Fullscreen(on *bool) *ModalW

Fullscreen binds the fullscreen state.

func (*ModalW) FullscreenToggle ​

go
func (m *ModalW) FullscreenToggle() *ModalW

FullscreenToggle shows a maximize button in the header.

func (*ModalW) Header ​

go
func (m *ModalW) Header(fn func()) *ModalW

Header replaces the visible title with custom content. The title passed to Modal remains the accessible dialog name. The built-in fullscreen and close buttons, drag handle and focus management remain available.

func (*ModalW) Keyboard ​

go
func (m *ModalW) Keyboard(on bool) *ModalW

Keyboard sets whether Escape closes the dialog (default true; antd keyboard, Element close-on-press-escape).

func (*ModalW) Loading ​

go
func (m *ModalW) Loading(on bool) *ModalW

Loading shows an active Skeleton instead of the content and hides the footer (antd loading).

func (*ModalW) Mask ​

go
func (m *ModalW) Mask(on bool) *ModalW

Mask(false) hides the dimming mask (the page stays visible but blocked).

func (*ModalW) MaskBlur ​

go
func (m *ModalW) MaskBlur(radius float32) *ModalW

MaskBlur sets the Gaussian blur radius of the canvas behind the mask, in logical pixels. A zero radius draws the mask without blur.

func (*ModalW) MaskClosable ​

go
func (m *ModalW) MaskClosable(on bool) *ModalW

func (*ModalW) NoFooter ​

go
func (m *ModalW) NoFooter() *ModalW

func (*ModalW) Ok ​

go
func (m *ModalW) Ok() bool

Ok reports the OK button this frame.

func (*ModalW) OkText ​

go
func (m *ModalW) OkText(s string) *ModalW

func (*ModalW) Top ​

go
func (m *ModalW) Top(px float32) *ModalW

Top sets the distance from the window top (Ant 100, Element 15%).

func (*ModalW) Width ​

go
func (m *ModalW) Width(px float32) *ModalW

MultiDatePickerW 实验性 ​

go
type MultiDatePickerW struct {
	// contains filtered or unexported fields
}

MultiDatePickerW is a date input with several values shown as tags.

func MultiDatePicker 实验性 ​

go
func MultiDatePicker(c *Context, vals *[]time.Time) *MultiDatePickerW

MultiDatePicker adds a multiple date input bound to *vals (Ant DatePicker multiple; with Picker(PickerMonth / PickerYear) Element's type="months" / "years"). Each click in the panel toggles a date (with Picker: a period start, UTC midnight); the panel stays open, the values are kept sorted and shown as closable tags. Backspace removes the last tag; arrow keys move the panel cursor and Enter / Space toggle it.

func (*MultiDatePickerW) A11yLabel 实验性 ​

go
func (w *MultiDatePickerW) A11yLabel(s string) *MultiDatePickerW

A11yLabel sets the accessible name (inside a FormItem the item label is used; the placeholder is the last resort).

func (*MultiDatePickerW) AllowClear 实验性 ​

go
func (w *MultiDatePickerW) AllowClear(on bool) *MultiDatePickerW

AllowClear toggles the clear-all button shown on hover (on by default).

func (*MultiDatePickerW) Changed 实验性 ​

go
func (w *MultiDatePickerW) Changed() bool

Changed reports a committed change of the dates this frame.

func (*MultiDatePickerW) Disabled 实验性 ​

go
func (w *MultiDatePickerW) Disabled(on bool) *MultiDatePickerW

Disabled disables the picker.

func (*MultiDatePickerW) DisabledDate 实验性 ​

go
func (w *MultiDatePickerW) DisabledDate(fn func(time.Time) bool) *MultiDatePickerW

DisabledDate marks dates (period starts) that cannot be picked.

func (*MultiDatePickerW) Format 实验性 ​

go
func (w *MultiDatePickerW) Format(f string) *MultiDatePickerW

Format sets the Go layout of the tags (see DatePickerW.Format).

func (*MultiDatePickerW) IsOpen 实验性 ​

go
func (w *MultiDatePickerW) IsOpen() bool

IsOpen reports whether the panel is shown.

func (*MultiDatePickerW) MaxDate 实验性 ​

go
func (w *MultiDatePickerW) MaxDate(t time.Time) *MultiDatePickerW

MaxDate limits the pickable dates (Ant maxDate), like MinDate.

func (*MultiDatePickerW) MaxTagCount 实验性 ​

go
func (w *MultiDatePickerW) MaxTagCount(n int) *MultiDatePickerW

MaxTagCount folds the tags after the first n into "+ N ..." (0 = all).

func (*MultiDatePickerW) MinDate 实验性 ​

go
func (w *MultiDatePickerW) MinDate(t time.Time) *MultiDatePickerW

MinDate limits the pickable dates (Ant minDate): periods wholly before t cannot be toggled and the panel arrows stop at t's page.

func (*MultiDatePickerW) NeedConfirm 实验性 ​

go
func (w *MultiDatePickerW) NeedConfirm(on bool) *MultiDatePickerW

NeedConfirm keeps the toggled dates as a draft until the footer's OK button commits them; closing the panel otherwise drops the changes.

func (*MultiDatePickerW) Open 实验性 ​

go
func (w *MultiDatePickerW) Open() *MultiDatePickerW

Open forces the panel open (screenshots, tests).

func (*MultiDatePickerW) Picker 实验性 ​

go
func (w *MultiDatePickerW) Picker(p PickerType) *MultiDatePickerW

Picker sets the granularity: PickerDate (default), PickerWeek, PickerMonth, PickerQuarter or PickerYear.

func (*MultiDatePickerW) Placeholder 实验性 ​

go
func (w *MultiDatePickerW) Placeholder(s string) *MultiDatePickerW

func (*MultiDatePickerW) Placement 实验性 ​

go
func (w *MultiDatePickerW) Placement(p Placement) *MultiDatePickerW

Placement sets where the panel opens: BottomStart (default), BottomEnd, TopStart or TopEnd (Ant placement); it flips when there is no room.

func (*MultiDatePickerW) Size 实验性 ​

go
func (w *MultiDatePickerW) Size(s ControlSize) *MultiDatePickerW

func (*MultiDatePickerW) Status 实验性 ​

go
func (w *MultiDatePickerW) Status(s string) *MultiDatePickerW

Status sets the validation look: "error" or "warning".

func (*MultiDatePickerW) Width 实验性 ​

go
func (w *MultiDatePickerW) Width(px float32) *MultiDatePickerW

Width sets the input width in pixels (default 260; tags wrap).

MultiSelectW 实验性 ​

go
type MultiSelectW struct {
	// contains filtered or unexported fields
}

MultiSelectW is a select with multiple values shown as closable tags.

func MultiSelect 实验性 ​

go
func MultiSelect(c *Context, val *[]string, opts []Option) *MultiSelectW

MultiSelect adds a multiple-choice select bound to *val (selected values).

func (*MultiSelectW) A11yLabel 实验性 ​

go
func (w *MultiSelectW) A11yLabel(s string) *MultiSelectW

A11yLabel sets the accessible name (inside a FormItem the item label is used; the placeholder is the last resort).

func (*MultiSelectW) AllowClear 实验性 ​

go
func (w *MultiSelectW) AllowClear() *MultiSelectW

AllowClear shows a clear-all button on hover.

func (*MultiSelectW) AllowCreate 实验性 ​

go
func (w *MultiSelectW) AllowCreate() *MultiSelectW

AllowCreate offers the typed text as a new option (Ant mode="tags", Element allow-create); read it with Created. Implies Searchable.

func (*MultiSelectW) Changed 实验性 ​

go
func (w *MultiSelectW) Changed() bool

Changed reports a selection change this frame.

func (*MultiSelectW) Created 实验性 ​

go
func (w *MultiSelectW) Created() (string, bool)

Created returns the value of an entry created with AllowCreate this frame.

func (*MultiSelectW) DataVersion 实验性 ​

go
func (w *MultiSelectW) DataVersion(v int) *MultiSelectW

DataVersion tells the select that the option slice was modified in place.

func (*MultiSelectW) Debounce 实验性 ​

go
func (w *MultiSelectW) Debounce(d time.Duration) *MultiSelectW

Debounce sets the delay before a Remote call.

func (*MultiSelectW) Disabled 实验性 ​

go
func (w *MultiSelectW) Disabled(on bool) *MultiSelectW

func (*MultiSelectW) FilterMethod 实验性 ​

go
func (w *MultiSelectW) FilterMethod(fn func(query string, o Option) bool) *MultiSelectW

FilterMethod replaces the label match of the search text with fn (see SelectW.FilterMethod). Implies Searchable.

func (*MultiSelectW) Groups 实验性 ​

go
func (w *MultiSelectW) Groups(groups []OptionGroup) *MultiSelectW

Groups shows the options under titled groups; the opts passed to MultiSelect are ignored. Options can also be grouped with Option.Group.

func (*MultiSelectW) IsOpen 实验性 ​

go
func (w *MultiSelectW) IsOpen() bool

IsOpen reports whether the dropdown is shown.

func (*MultiSelectW) Layout 实验性 ​

go
func (w *MultiSelectW) Layout(o ...layout.Option) *MultiSelectW

func (*MultiSelectW) ListHeight 实验性 ​

go
func (w *MultiSelectW) ListHeight(px float32) *MultiSelectW

ListHeight sets the maximum dropdown height.

func (*MultiSelectW) Loading 实验性 ​

go
func (w *MultiSelectW) Loading(on bool) *MultiSelectW

Loading shows a spinner and the loading text in the dropdown.

func (*MultiSelectW) MaxCount 实验性 ​

go
func (w *MultiSelectW) MaxCount(n int) *MultiSelectW

MaxCount limits how many values may be selected (Ant maxCount, Element multiple-limit); the other options turn disabled at the limit.

func (*MultiSelectW) MaxTagCount 实验性 ​

go
func (w *MultiSelectW) MaxTagCount(n int) *MultiSelectW

MaxTagCount collapses tags after n into a "+ N ..." tag.

func (*MultiSelectW) MaxTagPlaceholder 实验性 ​

go
func (w *MultiSelectW) MaxTagPlaceholder(fn func(omitted []string) string) *MultiSelectW

MaxTagPlaceholder builds the text of the collapsed tag from the labels MaxTagCount hides (Ant maxTagPlaceholder; default "+ N ...").

func (*MultiSelectW) MaxTagTextLength 实验性 ​

go
func (w *MultiSelectW) MaxTagTextLength(n int) *MultiSelectW

MaxTagTextLength cuts tag labels longer than n runes to n runes plus "..." (Ant maxTagTextLength); the accessible names keep the full label.

func (*MultiSelectW) NotFoundContent 实验性 ​

go
func (w *MultiSelectW) NotFoundContent(s string) *MultiSelectW

NotFoundContent sets the text of an empty dropdown (Ant notFoundContent, Element no-data-text).

func (*MultiSelectW) Open 实验性 ​

go
func (w *MultiSelectW) Open() *MultiSelectW

Open forces the dropdown open (screenshots, tests).

func (*MultiSelectW) OpenChanged 实验性 ​

go
func (w *MultiSelectW) OpenChanged() bool

OpenChanged reports that the dropdown opened or closed this frame (Ant onOpenChange, Element visible-change).

func (*MultiSelectW) OptionRender 实验性 ​

go
func (w *MultiSelectW) OptionRender(fn func(o Option, s OptionState)) *MultiSelectW

OptionRender builds each option row's content with fn.

func (*MultiSelectW) Placeholder 实验性 ​

go
func (w *MultiSelectW) Placeholder(s string) *MultiSelectW

func (*MultiSelectW) Placement 实验性 ​

go
func (w *MultiSelectW) Placement(p Placement) *MultiSelectW

Placement sets where the dropdown opens: BottomStart (default), BottomEnd, TopStart or TopEnd (Ant placement, Element placement); it flips when there is no room.

func (*MultiSelectW) Prefix 实验性 ​

go
func (w *MultiSelectW) Prefix(ic *icon.Icon) *MultiSelectW

Prefix shows ic before the tags (Ant prefix).

func (*MultiSelectW) PrefixText 实验性 ​

go
func (w *MultiSelectW) PrefixText(s string) *MultiSelectW

PrefixText shows s before the tags (Ant prefix, Element prefix slot).

func (*MultiSelectW) Remote 实验性 ​

go
func (w *MultiSelectW) Remote(fn func(query string)) *MultiSelectW

Remote turns on server-side search (see SelectW.Remote). Implies Searchable.

func (*MultiSelectW) Searchable 实验性 ​

go
func (w *MultiSelectW) Searchable() *MultiSelectW

Searchable filters options by typing into the selector.

func (*MultiSelectW) Size 实验性 ​

go
func (w *MultiSelectW) Size(s ControlSize) *MultiSelectW

func (*MultiSelectW) Status 实验性 ​

go
func (w *MultiSelectW) Status(s string) *MultiSelectW

func (*MultiSelectW) SuffixIcon 实验性 ​

go
func (w *MultiSelectW) SuffixIcon(ic *icon.Icon) *MultiSelectW

SuffixIcon replaces the dropdown arrow with ic (Ant suffixIcon); the clear button still takes its place on hover with AllowClear.

func (*MultiSelectW) Variant 实验性 ​

go
func (w *MultiSelectW) Variant(v FieldVariant) *MultiSelectW

Variant sets the frame look (FieldOutlined by default).

func (*MultiSelectW) Virtual 实验性 ​

go
func (w *MultiSelectW) Virtual(on bool) *MultiSelectW

Virtual forces the virtual dropdown on or off (default: lists longer than 100 options). With false, the dropdown builds every row.

func (*MultiSelectW) Width 实验性 ​

go
func (w *MultiSelectW) Width(px float32) *MultiSelectW

NativeRegion 实验性 ​

go
type NativeRegion struct {
	ID ID
	// Rect is the whole box.
	Rect geom.Rect
	// Visible is the part of Rect that ancestors (scroll containers,
	// clipping boxes, the window) leave visible; empty when the box is
	// scrolled or clipped out of view, or culled.
	Visible geom.Rect
	// Covered reports that a layer above the box (an Overlay: dropdown,
	// tooltip, popover, dialog, message), including a margin for its
	// shadow, overlaps Visible.
	Covered bool
	// Focused reports the UI's keyboard focus on the box.
	Focused bool
}

NativeRegion is where a native view sits in the frame just painted. Rectangles are host window logical pixels, after UI scaling.

NativeViewW 实验性 ​

go
type NativeViewW struct {
	*Box
	// contains filtered or unexported fields
}

NativeViewW is the builder of NativeView. Box modifiers (Bg, Border, Radius, Paint, ...) style what the canvas draws under the native view, which shows wherever the native view is hidden (before it exists, while it is frozen as a snapshot, when the platform has none).

func NativeView 实验性 ​

go
func NativeView(c *Context, key string, opts ...layout.Option) *NativeViewW

NativeView reserves a box for a platform view. key identifies the view among its siblings (it is part of the ID: views with the same key in the same scope share an ID). The box is a Tab stop like a focusable control (Focusable(false) removes it from the Tab order); Enter and Space are left to the native view.

func (*NativeViewW) A11yLabel 实验性 ​

go
func (w *NativeViewW) A11yLabel(s string) *NativeViewW

A11yLabel names the region for assistive technologies.

func (*NativeViewW) Clicked 实验性 ​

go
func (w *NativeViewW) Clicked() bool

Clicked reports a click on the box itself (the canvas only sees clicks where the native view is hidden).

func (*NativeViewW) Focusable 实验性 ​

go
func (w *NativeViewW) Focusable(on bool) *NativeViewW

Focusable puts the box in the Tab order (the default) or takes it out.

func (*NativeViewW) Focused 实验性 ​

go
func (w *NativeViewW) Focused() bool

Focused reports whether the box has the UI's keyboard focus.

NotificationAction 实验性 ​

go
type NotificationAction struct {
	Key     string
	Label   string
	Primary bool
}

NotificationAction is a button under a NotificationItem.

NotificationCenterLocale 实验性 ​

go
type NotificationCenterLocale struct {
	MarkAllRead, ClearAll, Dismiss         string
	Empty                                  string // empty panel ("暂无通知")
	UnreadFmt                              string // unread count, arg: n ("%d 条未读")
	JustNow                                string // under a minute ago
	MinutesAgoFmt, HoursAgoFmt, DaysAgoFmt string // arg: n ("%d 分钟前")
	// contains filtered or unexported fields
}

NotificationCenterLocale holds the NotificationCenter texts. The trigger and panel are named by Locale.A11y.Notifications.

func (*NotificationCenterLocale) Unread 实验性 ​

go
func (l *NotificationCenterLocale) Unread(n int) string

Unread formats the unread count of a NotificationCenter ("3 条未读").

NotificationCenterW 实验性 ​

go
type NotificationCenterW struct {
	// contains filtered or unexported fields
}

NotificationCenterW is the bell button with its notification panel.

func NotificationCenter 实验性 ​

go
func NotificationCenter(c *Context, items *[]NotificationItem) *NotificationCenterW

NotificationCenter adds a bell button whose badge counts the unread entries of *items; it opens a panel listing them, grouped, newest first as the app orders them:

nc := ui.NotificationCenter(c, &notes)
if key, ok := nc.Clicked(); ok { open(key) }
if key, act, ok := nc.Action(); ok { run(key, act) }

Activating an entry or one of its actions marks it read and closes the panel. The header marks everything read or clears the list; each entry can be dismissed on its own. Changed reports any such edit of *items. The panel is a Popover: Esc or a click outside closes it.

func (*NotificationCenterW) Action 实验性 ​

go
func (w *NotificationCenterW) Action() (key, action string, ok bool)

Action reports the entry and action keys of an action button activated this frame.

func (*NotificationCenterW) Changed 实验性 ​

go
func (w *NotificationCenterW) Changed() bool

Changed reports that the center edited *items this frame (marked read, dismissed, cleared).

func (*NotificationCenterW) Clicked 实验性 ​

go
func (w *NotificationCenterW) Clicked() (string, bool)

Clicked reports the key of the entry activated this frame.

func (*NotificationCenterW) IsOpen 实验性 ​

go
func (w *NotificationCenterW) IsOpen() bool

IsOpen reports whether the panel is shown.

func (*NotificationCenterW) Open 实验性 ​

go
func (w *NotificationCenterW) Open(v *bool) *NotificationCenterW

Open binds the panel's open state (controlled mode).

func (*NotificationCenterW) Placement 实验性 ​

go
func (w *NotificationCenterW) Placement(s string) *NotificationCenterW

Placement places the panel like Popover.Placement ("bottomRight" by default; "topRight" for a trigger in a status bar).

func (*NotificationCenterW) Title 实验性 ​

go
func (w *NotificationCenterW) Title(s string) *NotificationCenterW

Title replaces the panel heading (Locale.A11y.Notifications).

func (*NotificationCenterW) Unread 实验性 ​

go
func (w *NotificationCenterW) Unread() int

Unread returns the number of unread entries.

func (*NotificationCenterW) Width 实验性 ​

go
func (w *NotificationCenterW) Width(px float32) *NotificationCenterW

Width sets the panel width.

NotificationItem 实验性 ​

go
type NotificationItem struct {
	Key   string // stable identity (required for the list to keep state)
	Title string
	Body  string
	// Level picks the leading status icon: "info", "success", "warning",
	// "error" ("" for none).
	Level string
	// Group is the section the entry is listed under. Sections appear in
	// the order their first entry has in the slice ("" = no heading).
	Group   string
	Time    time.Time // shown relative to now ("3 分钟前"); zero hides it
	Read    bool
	Actions []NotificationAction
}

NotificationItem is one entry of a NotificationCenter. The app owns the slice; the center marks entries read and removes them.

NotificationRef ​

go
type NotificationRef struct {
	// contains filtered or unexported fields
}

NotificationRef configures a notification opened by Notification. Use it in the same call chain; it does not need to be kept.

func Notification ​

go
func Notification(c *Context, status, title string) *NotificationRef

Notification opens a notification card in a window corner (top end by default: top right, top left in RTL) and returns a reference for further options:

ui.Notification(c, "success", "已发布").Description("版本 1.2 已上线").Placement(ui.NotifyBottomRight)

status is success, info, warning, error or "" (no icon). Cards close after 4.5s (paused while hovered), collapse into a stack when more than NotifyStackThreshold share a corner, and can be updated in place by key.

func (*NotificationRef) Actions ​

go
func (r *NotificationRef) Actions(fn func()) *NotificationRef

Actions adds buttons under the description.

func (*NotificationRef) Closable ​

go
func (r *NotificationRef) Closable(on bool) *NotificationRef

Closable shows (default) or hides the close button (antd closable, EP showClose).

func (*NotificationRef) CloseIcon ​

go
func (r *NotificationRef) CloseIcon(ic *icon.Icon) *NotificationRef

CloseIcon replaces the close icon (antd closeIcon, EP closeIcon).

func (*NotificationRef) Description ​

go
func (r *NotificationRef) Description(s string) *NotificationRef

Description sets the text under the title.

func (*NotificationRef) Duration ​

go
func (r *NotificationRef) Duration(d time.Duration) *NotificationRef

Duration sets how long the card stays; d <= 0 keeps it until closed.

func (*NotificationRef) Icon ​

go
func (r *NotificationRef) Icon(ic *icon.Icon) *NotificationRef

Icon replaces the status icon (antd icon, EP icon).

func (*NotificationRef) Key ​

go
func (r *NotificationRef) Key(key string) *NotificationRef

Key names the card; opening another card with the same key replaces the existing one in place (its timer restarts).

func (*NotificationRef) NoPause ​

go
func (r *NotificationRef) NoPause() *NotificationRef

NoPause keeps counting down while the card is hovered.

func (*NotificationRef) OnClick ​

go
func (r *NotificationRef) OnClick(fn func()) *NotificationRef

OnClick runs fn when the card is clicked.

func (*NotificationRef) OnClose ​

go
func (r *NotificationRef) OnClose(fn func()) *NotificationRef

OnClose runs fn once when the card has closed (timed out, closed or destroyed), as antd onClose / EP onClose.

func (*NotificationRef) Placement ​

go
func (r *NotificationRef) Placement(p NotifyPlacement) *NotificationRef

Placement selects the corner (NotifyTopEnd default).

func (*NotificationRef) Role ​

go
func (r *NotificationRef) Role(role string) *NotificationRef

Role sets the live-region role: "alert" (assertive) or "status" (polite). By default errors and warnings are alerts (antd role).

func (*NotificationRef) ShowProgress ​

go
func (r *NotificationRef) ShowProgress() *NotificationRef

ShowProgress draws a countdown bar at the bottom.

NotifyPlacement ​

go
type NotifyPlacement uint8

NotifyPlacement is the corner a notification appears in. NotifyTopEnd (the zero value and default), NotifyTopStart, NotifyBottomEnd and NotifyBottomStart are logical: in RTL the end is the left side. The Right / Left placements are always that physical side.

Append-only: never reorder or insert; the zero value stays NotifyTopEnd.

go
const (
	NotifyTopEnd NotifyPlacement = iota
	NotifyTopStart
	NotifyBottomEnd
	NotifyBottomStart
	NotifyTop
	NotifyBottom
	NotifyTopRight
	NotifyTopLeft
	NotifyBottomRight
	NotifyBottomLeft
)

OTPW 实验性 ​

go
type OTPW struct {
	// contains filtered or unexported fields
}

OTPW is a one-time-password input: one box per character.

func OTP 实验性 ​

go
func OTP(c *Context, val *string, n int) *OTPW

OTP adds an n-character code input bound to *val.

func (*OTPW) A11yLabel 实验性 ​

go
func (w *OTPW) A11yLabel(s string) *OTPW

A11yLabel names the group of boxes (inside a FormItem use the item label); each box is announced as "character n of total".

func (*OTPW) CellID 实验性 ​

go
func (w *OTPW) CellID(i int) ID

CellID returns the ID of box i.

func (*OTPW) Changed 实验性 ​

go
func (w *OTPW) Changed() bool

Changed reports an edit this frame.

func (*OTPW) Completed 实验性 ​

go
func (w *OTPW) Completed() bool

Completed reports an edit that filled every box.

func (*OTPW) Disabled 实验性 ​

go
func (w *OTPW) Disabled(on bool) *OTPW

func (*OTPW) Focus 实验性 ​

go
func (w *OTPW) Focus() *OTPW

Focus focuses the first empty box.

func (*OTPW) Gap 实验性 ​

go
func (w *OTPW) Gap(px float32) *OTPW

func (*OTPW) Mask 实验性 ​

go
func (w *OTPW) Mask(s string) *OTPW

Mask shows s instead of each character (e.g. "•").

func (*OTPW) Numeric 实验性 ​

go
func (w *OTPW) Numeric() *OTPW

Numeric accepts digits only.

func (*OTPW) ReadOnly 实验性 ​

go
func (w *OTPW) ReadOnly() *OTPW

ReadOnly shows the code without letting it change; the boxes can still be focused and walked with the arrow keys (Element readonly).

func (*OTPW) Separator 实验性 ​

go
func (w *OTPW) Separator(s string) *OTPW

Separator shows s between every two boxes (antd / Element separator, shadcn InputOTPSeparator); "" shows none.

func (*OTPW) SeparatorFunc 实验性 ​

go
func (w *OTPW) SeparatorFunc(fn func(i int) string) *OTPW

SeparatorFunc shows fn(i) between box i and box i+1 (antd separator as a function of the index); "" leaves that gap empty, e.g. a "-" only after the third box of six.

func (*OTPW) Size 实验性 ​

go
func (w *OTPW) Size(s ControlSize) *OTPW

func (*OTPW) Status 实验性 ​

go
func (w *OTPW) Status(s string) *OTPW

func (*OTPW) Variant 实验性 ​

go
func (w *OTPW) Variant(v string) *OTPW

Variant sets the look of the boxes like InputW.Variant: "outlined" (default), "filled", "borderless" or "underlined" (antd variant, Element type).

Option ​

go
type Option struct {
	Label, Value string
	Disabled     bool
	Group        string
	// contains filtered or unexported fields
}

Option is an item of a Select / RadioGroup / CheckboxGroup. Group puts the option under a titled group in Select / MultiSelect / VirtualSelect dropdowns (Ant OptGroup, Element el-option-group); options of one group are listed together in order of the group's first appearance.

func Opts ​

go
func Opts(labels ...string) []Option

Opts builds options whose value equals the label.

OptionGroup 实验性 ​

go
type OptionGroup = VirtualOptionGroup

OptionGroup is a titled group of options for Select / MultiSelect Groups (the same type as VirtualOptionGroup).

OptionState 实验性 ​

go
type OptionState = VirtualOptionState

OptionState tells an OptionRender function how the row is shown.

OverlayOptions 实验性 ​

go
type OverlayOptions struct {
	Anchor ID // widget to attach to (anchored placements)
	// AnchorRect supplies a non-empty anchor in UI logical coordinates
	// for placement, such as an editor caret. Anchor still owns focus.
	AnchorRect geom.Rect
	Place      Placement
	Offset     float32 // gap between anchor and overlay
	MatchWidth bool    // at least as wide as the anchor
	Margin     float32 // distance from window edges for Screen* placements
	Flip       bool    // flip to the opposite side when it does not fit (currently always on for anchored placements)
	ShiftX     float32 // translation applied after placement (enter/leave motion)
	ShiftY     float32
	// contains filtered or unexported fields
}

OverlayOptions configure an overlay layer.

PageContainerLocale 实验性 ​

go
type PageContainerLocale struct {
	FooterToolbar string // accessible name of the FooterToolbar ("页面操作")
	// contains filtered or unexported fields
}

PageContainerLocale holds the PageContainer / FooterToolbar texts.

PageContainerW 实验性 ​

go
type PageContainerW struct {
	// contains filtered or unexported fields
}

PageContainerW builds a PageContainer.

func PageContainer 实验性 ​

go
func PageContainer(c *Context, title string) *PageContainerW

PageContainer starts a page container titled title; chain options, then Body with the page content.

ConfigProvider.Defaults("PageContainer", ...) keys: "ghost", "fill", "tabsCard" (bool).

func (*PageContainerW) Back 实验性 ​

go
func (p *PageContainerW) Back() *PageContainerW

Back shows the back button (query BackClicked).

func (*PageContainerW) BackClicked 实验性 ​

go
func (p *PageContainerW) BackClicked() bool

BackClicked reports a click on the back button.

func (*PageContainerW) Body 实验性 ​

go
func (p *PageContainerW) Body(fn func()) *PageContainerW

Body builds the container with fn as the page content.

func (*PageContainerW) Breadcrumb 实验性 ​

go
func (p *PageContainerW) Breadcrumb(items ...string) *PageContainerW

Breadcrumb shows a breadcrumb above the title.

func (*PageContainerW) Content 实验性 ​

go
func (p *PageContainerW) Content(fn func()) *PageContainerW

Content builds the description area under the title.

func (*PageContainerW) CrumbClicked 实验性 ​

go
func (p *PageContainerW) CrumbClicked() int

CrumbClicked returns the index of a clicked breadcrumb item or -1.

func (*PageContainerW) Extra 实验性 ​

go
func (p *PageContainerW) Extra(fn func()) *PageContainerW

Extra builds the actions at the right of the title.

func (*PageContainerW) ExtraContent 实验性 ​

go
func (p *PageContainerW) ExtraContent(fn func()) *PageContainerW

ExtraContent builds a block at the right of Content.

func (*PageContainerW) Fill 实验性 ​

go
func (p *PageContainerW) Fill() *PageContainerW

Fill makes the container take its parent's free height: header and body scroll inside it and the footer toolbar stays at the bottom.

func (*PageContainerW) Footer 实验性 ​

go
func (p *PageContainerW) Footer(fn func()) *PageContainerW

Footer builds the right-hand buttons of a FooterToolbar.

func (*PageContainerW) FooterExtra 实验性 ​

go
func (p *PageContainerW) FooterExtra(fn func()) *PageContainerW

FooterExtra builds the left side of the FooterToolbar.

func (*PageContainerW) Ghost 实验性 ​

go
func (p *PageContainerW) Ghost() *PageContainerW

Ghost drops the header background and the content padding (for use inside a padded content area). Inside ProLayout a non-ghost PageContainer switches the content area to NoPadding, so the header spans it.

func (*PageContainerW) Layout 实验性 ​

go
func (p *PageContainerW) Layout(o ...layout.Option) *PageContainerW

Layout applies layout options to the container.

func (*PageContainerW) Loading 实验性 ​

go
func (p *PageContainerW) Loading(on bool) *PageContainerW

Loading shows a centred spinner instead of the body.

func (*PageContainerW) NoHeader 实验性 ​

go
func (p *PageContainerW) NoHeader() *PageContainerW

NoHeader hides the page header (body and footer only).

func (*PageContainerW) ScrollID 实验性 ​

go
func (p *PageContainerW) ScrollID() ID

ScrollID returns the scroll box of a Fill container (0 otherwise).

func (*PageContainerW) SubTitle 实验性 ​

go
func (p *PageContainerW) SubTitle(s string) *PageContainerW

SubTitle sets the secondary title.

func (*PageContainerW) TabChanged 实验性 ​

go
func (p *PageContainerW) TabChanged() bool

TabChanged reports a tab switch this frame.

func (*PageContainerW) TabExtra 实验性 ​

go
func (p *PageContainerW) TabExtra(fn func()) *PageContainerW

TabExtra builds content at the right of the tab list.

func (*PageContainerW) Tabs 实验性 ​

go
func (p *PageContainerW) Tabs(active *string, items []TabItem) *PageContainerW

Tabs shows a tab list at the bottom of the header bound to active.

func (*PageContainerW) TabsCard 实验性 ​

go
func (p *PageContainerW) TabsCard() *PageContainerW

TabsCard uses card-style tabs.

func (*PageContainerW) Tags 实验性 ​

go
func (p *PageContainerW) Tags(fn func()) *PageContainerW

Tags builds tags after the title.

PageHeaderW 实验性 ​

go
type PageHeaderW struct {
	// contains filtered or unexported fields
}

PageHeaderW is the page title bar: back action, breadcrumb, title, subtitle, tags, extra actions, content and footer (tabs).

go
func PageHeader(c *Context, title string) *PageHeaderW

PageHeader starts a page header; chain options, then Show. Sizes and colors come from theme.PageHeaderToken (Pro Components v3 PageHeader, Element el-page-header); a Bordered header is the container color, as Pro's non-ghost header.

func (*PageHeaderW) Avatar 实验性 ​

go
func (p *PageHeaderW) Avatar(fn func()) *PageHeaderW

Avatar builds an avatar before the title (Pro avatar), e.g. func() { ui.Avatar(c, "U") }.

func (*PageHeaderW) Back 实验性 ​

go
func (p *PageHeaderW) Back() *PageHeaderW

Back shows the back button.

func (*PageHeaderW) BackClicked 实验性 ​

go
func (p *PageHeaderW) BackClicked() bool

BackClicked reports a click on the back button.

func (*PageHeaderW) BackIcon 实验性 ​

go
func (p *PageHeaderW) BackIcon(ic *icon.Icon) *PageHeaderW

BackIcon replaces the back arrow and shows the back button (Pro backIcon, Element icon).

func (*PageHeaderW) BackText 实验性 ​

go
func (p *PageHeaderW) BackText(s string) *PageHeaderW

BackText overrides the Element back label (default Locale().Back).

func (*PageHeaderW) Bordered 实验性 ​

go
func (p *PageHeaderW) Bordered() *PageHeaderW

Bordered draws the container background (Pro ghost=false; a bottom line only when PageHeaderToken.BorderColor is set).

func (*PageHeaderW) Breadcrumb 实验性 ​

go
func (p *PageHeaderW) Breadcrumb(items ...string) *PageHeaderW

Breadcrumb shows a breadcrumb above the title.

func (*PageHeaderW) BreadcrumbItems 实验性 ​

go
func (p *PageHeaderW) BreadcrumbItems(items []BreadcrumbItem) *PageHeaderW

BreadcrumbItems shows a structured breadcrumb above the title (Pro breadcrumb {items}); CrumbClicked reports clicks on it.

func (*PageHeaderW) Content 实验性 ​

go
func (p *PageHeaderW) Content(fn func()) *PageHeaderW

Content adds the description area below the title.

func (*PageHeaderW) CrumbClicked 实验性 ​

go
func (p *PageHeaderW) CrumbClicked() int

CrumbClicked returns the clicked breadcrumb index or -1.

func (*PageHeaderW) Extra 实验性 ​

go
func (p *PageHeaderW) Extra(fn func()) *PageHeaderW

Extra adds actions at the right.

func (*PageHeaderW) Footer 实验性 ​

go
func (p *PageHeaderW) Footer(fn func()) *PageHeaderW

Footer adds a footer (usually Tabs).

func (*PageHeaderW) Ghost 实验性 ​

go
func (p *PageHeaderW) Ghost(on bool) *PageHeaderW

Ghost toggles the transparent background (Pro ghost, default true).

func (*PageHeaderW) Padding 实验性 ​

go
func (p *PageHeaderW) Padding(in geom.Insets) *PageHeaderW

Padding overrides the header padding (Ant 16px 24px, Element none), e.g. to align it with a surrounding container.

func (*PageHeaderW) Show 实验性 ​

go
func (p *PageHeaderW) Show() *PageHeaderW

Show builds the header.

func (*PageHeaderW) SubTitle 实验性 ​

go
func (p *PageHeaderW) SubTitle(s string) *PageHeaderW

SubTitle sets the secondary title.

func (*PageHeaderW) Tags 实验性 ​

go
func (p *PageHeaderW) Tags(fn func()) *PageHeaderW

Tags adds tags after the title.

PageLoadingW 实验性 ​

go
type PageLoadingW struct {
	// contains filtered or unexported fields
}

PageLoadingW is ProLayout's centred, large Spin wrapper.

func PageLoading 实验性 ​

go
func PageLoading(c *Context) *PageLoadingW

PageLoading starts a page loading indicator; chain options, then Show. Like Pro v3 PageLoading, it adds 100px top padding and centres a large Spin. The legacy react-loadable isLoading/pastDelay/error props do not control visibility; Spinning is the Spin visibility input. ConfigProvider.Defaults("PageLoading", ...): "spinning", "size", "delay" (time.Duration), "description".

func (*PageLoadingW) Delay 实验性 ​

go
func (p *PageLoadingW) Delay(d time.Duration) *PageLoadingW

Delay delays showing the indicator; stopping always hides immediately.

func (*PageLoadingW) Description 实验性 ​

go
func (p *PageLoadingW) Description(s string) *PageLoadingW

Description sets the loading indicator's text and accessible name.

func (*PageLoadingW) Show 实验性 ​

go
func (p *PageLoadingW) Show() *PageLoadingW

Show builds the page loading wrapper using the shared Spin implementation.

func (*PageLoadingW) Size 实验性 ​

go
func (p *PageLoadingW) Size(size ControlSize) *PageLoadingW

Size selects the Spin size (default large).

func (*PageLoadingW) Spinning 实验性 ​

go
func (p *PageLoadingW) Spinning(on bool) *PageLoadingW

Spinning controls the loading indicator, not the surrounding page.

PaginationLocale ​

go
type PaginationLocale struct {
	Jump, Current string
	// Confirm is the quick jumper's go button (antd jump_to_confirm);
	// Prev3 / Next3 name the ••• jumps of ShowLessItems.
	Confirm, Prev3, Next3 string
	// contains filtered or unexported fields
}

PaginationLocale holds the accessible names of the Pagination inputs (quick jumper, simple mode current page).

PaginationPart ​

go
type PaginationPart string

PaginationPart is one part of a Pagination arranged by PaginationW.Layout (Element's layout).

go
const (
	PaginationPrev   PaginationPart = "prev"   // previous-page button
	PaginationPager  PaginationPart = "pager"  // page buttons (the editable page in Simple)
	PaginationNext   PaginationPart = "next"   // next-page button
	PaginationJumper PaginationPart = "jumper" // "go to [ ] page"
	PaginationSizes  PaginationPart = "sizes"  // page-size select (needs SizeChanger)
	PaginationTotal  PaginationPart = "total"  // "total N items"
	PaginationSpacer PaginationPart = "->"     // pushes the following parts to the end
)

PaginationW ​

go
type PaginationW struct {
	// contains filtered or unexported fields
}

PaginationW is a page navigator: page buttons with ellipsis jumps, total text, size changer, quick jumper, simple mode, hide on a single page, disabled state and Element's background (filled) style.

func Pagination ​

go
func Pagination(c *Context, page *int, total, pageSize int) *PaginationW

Pagination adds a pager bound to *page (1-based).

ConfigProvider.Defaults("Pagination", ...) keys: "showQuickJumper", "showTotal", "simple", "hideOnSinglePage", "background", "disabled", "showLessItems" (bool), "size" (ControlSize or "small" | "default" | "large"), "align" ("start" | "center" | "end"), "pageSizeOptions" ([]int), "pagerCount" (int).

The page buttons follow @rc-component/pagination: every page up to 7 pages (5 with ShowLessItems), else the first, the last, the pages around the current one and ••• jumps of 5 (3) pages. The Element theme uses PagerCount(7) by default (el-pagination pager-count), Background on, and page sizes 10/20/30/40/50/100 (PaginationToken). With total 0 a single disabled page 1 shows, like antd.

Under shadcn/ui page links are ghost buttons, the current page an outline button and Previous / Next carry their label next to the chevron (icon only in the small and simple pagers).

func (*PaginationW) Align ​

go
func (p *PaginationW) Align(a string) *PaginationW

Align places the pager in its row: "start", "center" or "end" (antd align); "" leaves it at its natural width.

func (*PaginationW) Background ​

go
func (p *PaginationW) Background(on bool) *PaginationW

Background toggles the filled page buttons (Element background; the default of the Element theme, off by default in Ant). A Simple pager is plain unless Background(true) is given, so it sits lightly at the bottom of a list or transfer panel.

func (*PaginationW) Changed ​

go
func (p *PaginationW) Changed() bool

func (*PaginationW) Disabled ​

go
func (p *PaginationW) Disabled(on bool) *PaginationW

Disabled disables every part of the pager.

func (*PaginationW) GoButton ​

go
func (p *PaginationW) GoButton(label string) *PaginationW

GoButton adds a confirm button after the quick jumper input (antd showQuickJumper.goButton) and turns the jumper on; label "" uses Locale().Pagination.Confirm.

func (*PaginationW) HideOnSinglePage ​

go
func (p *PaginationW) HideOnSinglePage() *PaginationW

HideOnSinglePage hides the pager when there is at most one page.

func (*PaginationW) Layout ​

go
func (p *PaginationW) Layout(parts ...PaginationPart) *PaginationW

Layout arranges the pager from parts in the given order (Element's layout "total, prev, pager, next, sizes, jumper"); only the listed parts show, whatever ShowTotal / ShowQuickJumper say. PaginationSizes needs SizeChanger. PaginationSpacer pushes the parts after it to the end of the row.

func (*PaginationW) NextIcon ​

go
func (p *PaginationW) NextIcon(ic *icon.Icon) *PaginationW

func (*PaginationW) NextText ​

go
func (p *PaginationW) NextText(s string) *PaginationW

func (*PaginationW) PageSizeOptions ​

go
func (p *PaginationW) PageSizeOptions(sizes ...int) *PaginationW

PageSizeOptions sets the choices of the size changer (antd pageSizeOptions, default 10/20/50/100; Element page-sizes, default 10/20/30/40/50/100).

func (*PaginationW) PagerCount ​

go
func (p *PaginationW) PagerCount(n int) *PaginationW

PagerCount sets how many page-number buttons the pager shows at most (Element pager-count: an odd number from 5 to 21, others are rounded up to the next odd number in range). The first and last pages always show; the rest are a window around the current page with ••• jumps. Without it the pager follows Ant: every page up to 9 pages, else the first, the last and five around the current page.

func (*PaginationW) PrevIcon ​

go
func (p *PaginationW) PrevIcon(ic *icon.Icon) *PaginationW

PrevIcon / NextIcon replace the chevrons (Element prev-icon / next-icon, antd itemRender for prev / next).

func (*PaginationW) PrevText ​

go
func (p *PaginationW) PrevText(s string) *PaginationW

PrevText / NextText show a text instead of the chevron in the previous / next buttons (Element prev-text / next-text).

func (*PaginationW) ReadOnly ​

go
func (p *PaginationW) ReadOnly() *PaginationW

ReadOnly shows the current page of a Simple pager as text instead of an input ("< 2 / 5 >", Ant simple.readOnly): the narrowest pager, for embedding at the bottom of a list.

func (*PaginationW) Show ​

go
func (p *PaginationW) Show() *PaginationW

Show builds the pager.

func (*PaginationW) ShowLessItems ​

go
func (p *PaginationW) ShowLessItems() *PaginationW

ShowLessItems shows fewer page buttons: one page on each side of the current one and ••• jumps of 3 pages (antd showLessItems).

func (*PaginationW) ShowQuickJumper ​

go
func (p *PaginationW) ShowQuickJumper() *PaginationW

ShowQuickJumper adds the "go to [ ] page" input (Enter or leaving the input jumps).

func (*PaginationW) ShowTotal ​

go
func (p *PaginationW) ShowTotal() *PaginationW

func (*PaginationW) ShowTotalFunc ​

go
func (p *PaginationW) ShowTotalFunc(fn func(total, from, to int) string) *PaginationW

ShowTotalFunc shows the text fn returns before the pager (antd showTotal(total, range)): from and to are the 1-based items of the current page (0, 0 when total is 0).

func (*PaginationW) Simple ​

go
func (p *PaginationW) Simple() *PaginationW

Simple shows only prev, an editable current page, "/ pages" and next.

func (*PaginationW) Size ​

go
func (p *PaginationW) Size(s ControlSize) *PaginationW

Size picks the small pager (Small), the default one or the large one (Large: 40px buttons, antd 6 size="large", Element size="large"); Small with Simple is the narrow pager for list and transfer footers.

func (*PaginationW) SizeChanger ​

go
func (p *PaginationW) SizeChanger(size *int) *PaginationW

SizeChanger shows a page-size select bound to *size.

func (*PaginationW) Small ​

go
func (p *PaginationW) Small() *PaginationW

PaintFunc ​

go
type PaintFunc func(l *paint.List, r geom.Rect)

PaintFunc draws a node; r is the node's absolute rectangle.

PanAxis 实验性 ​

go
type PanAxis uint8

PanAxis is a set of drag directions.

Append-only: never reorder or insert; existing values never change.

go
const (
	PanX  PanAxis = 1 << iota // horizontal drags
	PanY                      // vertical drags
	PanXY = PanX | PanY
)

实验性

PickerType ​

go
type PickerType uint8

PickerType is the granularity of a DatePickerPanel (Ant picker, Element type).

Append-only: never reorder or insert; the zero value stays PickerDate.

go
const (
	PickerDate PickerType = iota
	PickerWeek
	PickerMonth
	PickerQuarter
	PickerYear
)

Placement ​

go
type Placement uint8

Placement positions an overlay relative to an anchor or the window.

BottomStart/BottomEnd/TopStart/TopEnd and the Inline* and Screen{Start, End,TopStart,TopEnd} values are logical: Start is the inline start edge (left in LTR, right in RTL). Left/Right/RightStart/LeftStart/RightEnd/ LeftEnd and ScreenLeft/ScreenRight/ScreenTopRight/ScreenTopLeft are physical and never mirror. The overlay's direction is that of the scope that built it; see Resolve.

Append-only: never reorder or insert; the zero value stays BottomStart.

go
const (
	BottomStart Placement = iota // below anchor, aligned to its inline start edge
	BottomEnd                    // below anchor, aligned to its inline end edge
	Bottom                       // below, centered
	TopStart                     // above anchor, aligned to its inline start edge
	TopEnd                       // above anchor, aligned to its inline end edge
	Top
	RightStart      // right of anchor, top edges aligned
	LeftStart       // left of anchor, top edges aligned
	ScreenCenter    // centered in the window
	ScreenTop       // horizontally centered, near the top (messages)
	ScreenTopRight  // notifications
	ScreenRight     // drawers: full height on the right
	ScreenLeft      // full height on the left
	ScreenFill      // covers the window (masks)
	ScreenTopCenter // modal: centered horizontally, 100px from top
	Right           // right of anchor, vertically centered
	Left            // left of anchor, vertically centered
	RightEnd        // right of anchor, bottom edges aligned
	LeftEnd         // left of anchor, bottom edges aligned

	InlineEnd         // after the anchor on the inline axis, vertically centered
	InlineEndTop      // after the anchor, top edges aligned (submenus)
	InlineEndBottom   // after the anchor, bottom edges aligned
	InlineStart       // before the anchor on the inline axis, vertically centered
	InlineStartTop    // before the anchor, top edges aligned
	InlineStartBottom // before the anchor, bottom edges aligned
	ScreenEnd         // full height on the inline end side (drawers)
	ScreenStart       // full height on the inline start side
	ScreenTopEnd      // top corner on the inline end side (notifications)
	ScreenTopStart    // top corner on the inline start side
	ScreenTopLeft     // physical top-left corner
	InsideTopRight    // inside the anchor, at its physical top-right corner
)

实验性 ScreenCenter、ScreenTop、ScreenTopRight、ScreenRight、ScreenLeft、ScreenFill、ScreenTopCenter、ScreenEnd、ScreenStart、ScreenTopEnd、ScreenTopStart、ScreenTopLeft、InsideTopRight

func (Placement) Resolve ​

go
func (p Placement) Resolve(rtl bool) Placement

Resolve maps a logical placement to the physical one used for the given direction. Physical placements are returned unchanged, so in LTR every placement resolves to its LTR meaning.

PopconfirmW ​

go
type PopconfirmW struct {
	// contains filtered or unexported fields
}

PopconfirmW asks for confirmation before an action. Options apply when the build finishes (or at Confirmed / Cancelled).

ConfigProvider.Defaults("Popconfirm", ...) keys: "okText", "cancelText", "placement", "okType", "cancelType" (string), "showCancel", "arrow", "disabled" (bool), "width" (float32).

func Popconfirm ​

go
func Popconfirm(c *Context, title, desc string, trigger func()) *PopconfirmW

Popconfirm wraps trigger content; clicking it opens a confirm bubble. The default placement, width, arrow and cancel button type come from theme.PopoverToken (Ant top; Element bottom, 150 wide, text cancel button; shadcn no arrow).

func (*PopconfirmW) Arrow ​

go
func (p *PopconfirmW) Arrow(on bool) *PopconfirmW

Arrow shows or hides the bubble arrow (default from the theme; antd arrow).

func (*PopconfirmW) CancelText ​

go
func (p *PopconfirmW) CancelText(s string) *PopconfirmW

CancelText sets the cancel button text (default Locale().Cancel).

func (*PopconfirmW) CancelType ​

go
func (p *PopconfirmW) CancelType(t string) *PopconfirmW

CancelType sets the cancel button type, as OkType (default "default"; Element "text", its cancel-button-type).

func (*PopconfirmW) Cancelled ​

go
func (p *PopconfirmW) Cancelled() bool

Cancelled reports the cancel button.

func (*PopconfirmW) Confirmed ​

go
func (p *PopconfirmW) Confirmed() bool

Confirmed reports the OK button.

func (*PopconfirmW) Description ​

go
func (p *PopconfirmW) Description(s string) *PopconfirmW

Description sets the text under the title.

func (*PopconfirmW) Disabled ​

go
func (p *PopconfirmW) Disabled(on bool) *PopconfirmW

Disabled keeps the bubble from opening.

func (*PopconfirmW) Icon ​

go
func (p *PopconfirmW) Icon(ic *icon.Icon) *PopconfirmW

Icon replaces the warning icon (nil hides it).

func (*PopconfirmW) IconColor ​

go
func (p *PopconfirmW) IconColor(col theme.Color) *PopconfirmW

IconColor colors a custom Icon (default the warning color).

func (*PopconfirmW) IsOpen ​

go
func (p *PopconfirmW) IsOpen() bool

IsOpen reports whether the bubble is shown.

func (*PopconfirmW) OkDanger ​

go
func (p *PopconfirmW) OkDanger() *PopconfirmW

OkDanger styles the confirm button as dangerous (okType="danger").

func (*PopconfirmW) OkText ​

go
func (p *PopconfirmW) OkText(s string) *PopconfirmW

OkText sets the confirm button text (default Locale().OK).

func (*PopconfirmW) OkType ​

go
func (p *PopconfirmW) OkType(t string) *PopconfirmW

OkType sets the confirm button type: "primary" (default), "default", "dashed", "text", "link" or "danger" (antd okType, Element confirm-button-type).

func (*PopconfirmW) Placement ​

go
func (p *PopconfirmW) Placement(s string) *PopconfirmW

Placement as Popover.Placement (default "top").

func (*PopconfirmW) ShowCancel ​

go
func (p *PopconfirmW) ShowCancel(on bool) *PopconfirmW

ShowCancel shows or hides the cancel button (default shown).

func (*PopconfirmW) Width ​

go
func (p *PopconfirmW) Width(px float32) *PopconfirmW

Width fixes the bubble width (Element width, default 150 there; zero fits the content).

PopoverW ​

go
type PopoverW struct {
	// contains filtered or unexported fields
}

PopoverW is a floating card attached to a trigger: title, content and an arrow, in twelve placements, opened by hover, click or focus.

func Popover ​

go
func Popover(c *Context) *PopoverW

Popover starts a popover; set options then call Body with the trigger.

ConfigProvider.Defaults("Popover", ...) keys: "placement", "trigger", "arrow" (bool; default PopoverToken.Arrow: true, false for shadcn whose popover has none), "mouseEnterDelay", "mouseLeaveDelay" (time.Duration; default the theme's PopoverToken delays: antd 0.1 s / 0.1 s, Element 0 / 0.2 s).

func (*PopoverW) Arrow ​

go
func (p *PopoverW) Arrow(on bool) *PopoverW

Arrow shows or hides the arrow (antd arrow; NoArrow is Arrow(false)).

func (*PopoverW) Body ​

go
func (p *PopoverW) Body(fn func()) *Box

Body builds the trigger content and, when open, the panel.

func (*PopoverW) Content ​

go
func (p *PopoverW) Content(fn func()) *PopoverW

Content builds the body.

func (*PopoverW) IsOpen ​

go
func (p *PopoverW) IsOpen() bool

IsOpen reports whether the panel is shown.

func (*PopoverW) MouseEnterDelay ​

go
func (p *PopoverW) MouseEnterDelay(d time.Duration) *PopoverW

MouseEnterDelay waits d before a hover popover opens (antd mouseEnterDelay, Element show-after).

func (*PopoverW) MouseLeaveDelay ​

go
func (p *PopoverW) MouseLeaveDelay(d time.Duration) *PopoverW

MouseLeaveDelay keeps a hover popover open for d after the pointer left the trigger and the panel (antd mouseLeaveDelay, Element hide-after).

func (*PopoverW) NoArrow ​

go
func (p *PopoverW) NoArrow() *PopoverW

NoArrow hides the arrow.

func (*PopoverW) NoPadding ​

go
func (p *PopoverW) NoPadding() *PopoverW

NoPadding removes the panel padding (menus, custom cards).

func (*PopoverW) Open ​

go
func (p *PopoverW) Open(v *bool) *PopoverW

Open binds the open state (controlled mode).

func (*PopoverW) OpenChanged ​

go
func (p *PopoverW) OpenChanged() bool

OpenChanged reports a state change caused by the user this frame.

func (*PopoverW) Placement ​

go
func (p *PopoverW) Placement(s string) *PopoverW

Placement: top, topLeft, topRight, bottom, bottomLeft, bottomRight, left, leftTop, leftBottom, right, rightTop, rightBottom. Left and right are logical (start / end): in RTL "left" opens on the right.

func (*PopoverW) Text ​

go
func (p *PopoverW) Text(s string) *PopoverW

Text sets a plain text body.

func (*PopoverW) Title ​

go
func (p *PopoverW) Title(s string) *PopoverW

Title sets the bold heading.

func (*PopoverW) Trigger ​

go
func (p *PopoverW) Trigger(s string) *PopoverW

Trigger: "hover" (default), "click", "focus" or "manual" (Open only).

func (*PopoverW) Width ​

go
func (p *PopoverW) Width(px float32) *PopoverW

Width fixes the panel width.

ProBreadcrumbW 实验性 ​

go
type ProBreadcrumbW struct {
	*BreadcrumbW
	// contains filtered or unexported fields
}

ProBreadcrumbW is the route-aware Breadcrumb exported by ProLayout. It delegates rendering, keyboard handling and semantics to BreadcrumbW.

func ProBreadcrumb 实验性 ​

go
func ProBreadcrumb(c *Context) *ProBreadcrumbW

ProBreadcrumb starts a breadcrumb from the innermost ProLayout's route. Items overrides the route items, including with an empty slice. ConfigProvider.Defaults("ProBreadcrumb", ...): "separator" (string).

func (*ProBreadcrumbW) Items 实验性 ​

go
func (b *ProBreadcrumbW) Items(items []BreadcrumbItem) *ProBreadcrumbW

Items replaces the breadcrumb items (rather than appending).

func (*ProBreadcrumbW) Len 实验性 ​

go
func (b *ProBreadcrumbW) Len() int

Len reports the number of breadcrumb items.

func (*ProBreadcrumbW) Separator 实验性 ​

go
func (b *ProBreadcrumbW) Separator(s string) *ProBreadcrumbW

Separator replaces the separator between items.

func (*ProBreadcrumbW) Show 实验性 ​

go
func (b *ProBreadcrumbW) Show() *ProBreadcrumbW

Show builds the breadcrumb. Empty route breadcrumbs produce no landmark.

ProCardLocale 实验性 ​

go
type ProCardLocale struct {
	MoreInfo string // accessible name of the title tooltip icon
	// contains filtered or unexported fields
}

ProCardLocale holds the ProCard / StatisticCard texts.

ProCardTab 实验性 ​

go
type ProCardTab struct {
	Key, Label string
	Icon       *icon.Icon
	Disabled   bool
	Body       func()
}

ProCardTab is one tab of a tabbed ProCard.

ProCardW 实验性 ​

go
type ProCardW struct {
	// contains filtered or unexported fields
}

ProCardW builds a ProCard.

func ProCard 实验性 ​

go
func ProCard(c *Context, title string) *ProCardW

ProCard starts a ProCard ("" title = no header unless Extra, Tooltip or Collapsible need one); chain options, then call Body.

ConfigProvider.Defaults("ProCard", ...) keys: "size" ("small" | "default" or a ControlSize), "bordered", "headerBordered", "ghost", "hoverable", "collapsible", "boxShadow" (bool), "gutter" (number).

Like Pro Components v3 (variant defaults to "outlined") a card is bordered unless Borderless is set; ghost cards and split children have no border.

func StatisticCardGroup 实验性 ​

go
func StatisticCardGroup(c *Context) *ProCardW

StatisticCardGroup builds StatisticCard.Group: a ProCard with zero body padding. Use Divider for explicit separators, or Split for automatic ones.

func (*ProCardW) Actions 实验性 ​

go
func (w *ProCardW) Actions(fns ...func()) *ProCardW

Actions adds the bottom action bar (Ant ProCard actions): each fn builds one equal-width slot, separated by dividers (CardAction makes an icon action). The bar is hidden while the card is folded.

func (*ProCardW) Body 实验性 ​

go
func (w *ProCardW) Body(fn func()) *ProCardW

Body builds the card with fn as its content.

func (*ProCardW) BodyPadding 实验性 ​

go
func (w *ProCardW) BodyPadding(in geom.Insets) *ProCardW

BodyPadding overrides the body padding.

func (*ProCardW) Bordered 实验性 ​

go
func (w *ProCardW) Bordered() *ProCardW

Bordered draws a border around the card (the default; it overrides a "bordered": false ConfigProvider default).

func (*ProCardW) Borderless 实验性 ​

go
func (w *ProCardW) Borderless() *ProCardW

Borderless removes the border (Pro v3 variant "borderless").

func (*ProCardW) Box 实验性 ​

go
func (w *ProCardW) Box() *Box

Box returns the card container (valid after Body).

func (*ProCardW) BoxShadow 实验性 ​

go
func (w *ProCardW) BoxShadow(on bool) *ProCardW

BoxShadow gives the card the tertiary shadow and hides its border (Pro v3 boxShadow).

func (*ProCardW) Centered 实验性 ​

go
func (w *ProCardW) Centered() *ProCardW

Centered centres the body content on both axes.

func (*ProCardW) Clicked 实验性 ​

go
func (w *ProCardW) Clicked() bool

Clicked reports a click on a hoverable card.

func (*ProCardW) ColSpan 实验性 ​

go
func (w *ProCardW) ColSpan(span int) *ProCardW

ColSpan sizes the card inside a parent ProCard row: span of 24 columns.

func (*ProCardW) ColWidth 实验性 ​

go
func (w *ProCardW) ColWidth(px float32) *ProCardW

ColWidth gives the card a fixed width inside a parent ProCard row.

func (*ProCardW) Collapsed 实验性 ​

go
func (w *ProCardW) Collapsed(v *bool) *ProCardW

Collapsed binds the folded state (implies Collapsible).

func (*ProCardW) Collapsible 实验性 ​

go
func (w *ProCardW) Collapsible() *ProCardW

Collapsible lets a click on the header fold the body.

func (*ProCardW) DefaultCollapsed 实验性 ​

go
func (w *ProCardW) DefaultCollapsed() *ProCardW

DefaultCollapsed starts an uncontrolled collapsible card folded.

func (*ProCardW) Direction 实验性 ​

go
func (w *ProCardW) Direction(d string) *ProCardW

Direction sets how child ProCards are arranged: "row" (default) or "column".

func (*ProCardW) Extra 实验性 ​

go
func (w *ProCardW) Extra(fn func()) *ProCardW

Extra builds the actions at the right of the header.

func (*ProCardW) Ghost 实验性 ​

go
func (w *ProCardW) Ghost() *ProCardW

Ghost removes the background and the body padding.

func (*ProCardW) Gutter 实验性 ​

go
func (w *ProCardW) Gutter(px float32) *ProCardW

Gutter sets the space between child ProCards.

func (*ProCardW) HeaderBordered 实验性 ​

go
func (w *ProCardW) HeaderBordered() *ProCardW

HeaderBordered draws a divider under the header.

func (*ProCardW) Hoverable 实验性 ​

go
func (w *ProCardW) Hoverable() *ProCardW

Hoverable lifts the card with a shadow on hover.

func (*ProCardW) ID 实验性 ​

go
func (w *ProCardW) ID() ID

ID returns the card's widget ID (valid after Body).

func (*ProCardW) IsCollapsed 实验性 ​

go
func (w *ProCardW) IsCollapsed() bool

IsCollapsed reports whether the body is folded.

func (*ProCardW) Layout 实验性 ​

go
func (w *ProCardW) Layout(o ...layout.Option) *ProCardW

Layout applies layout options to the card.

func (*ProCardW) Loading 实验性 ​

go
func (w *ProCardW) Loading(on bool) *ProCardW

Loading shows the animated loading placeholder instead of the body.

func (*ProCardW) Small 实验性 ​

go
func (w *ProCardW) Small() *ProCardW

Small uses the compact paddings.

func (*ProCardW) Split 实验性 ​

go
func (w *ProCardW) Split(dir string) *ProCardW

Split lays the child ProCards out on one surface separated by dividers (SplitVertical or SplitHorizontal).

func (*ProCardW) SubTitle 实验性 ​

go
func (w *ProCardW) SubTitle(s string) *ProCardW

SubTitle sets the secondary title shown after the title.

func (*ProCardW) TabChanged 实验性 ​

go
func (w *ProCardW) TabChanged() bool

TabChanged reports a tab switch this frame.

func (*ProCardW) TabExtra 实验性 ​

go
func (w *ProCardW) TabExtra(fn func()) *ProCardW

TabExtra builds content at the right of the tab bar.

func (*ProCardW) Tabs 实验性 ​

go
func (w *ProCardW) Tabs(active *string, tabs []ProCardTab) *ProCardW

Tabs turns the card into a tab card bound to active; the active tab's Body is shown as the card body.

func (*ProCardW) TabsCard 实验性 ​

go
func (w *ProCardW) TabsCard() *ProCardW

TabsCard uses card-style tabs.

func (*ProCardW) Toggled 实验性 ​

go
func (w *ProCardW) Toggled() bool

Toggled reports a collapse / expand by the user this frame.

func (*ProCardW) Tooltip 实验性 ​

go
func (w *ProCardW) Tooltip(tip string) *ProCardW

Tooltip adds a question icon after the title showing tip on hover.

func (*ProCardW) Wrap 实验性 ​

go
func (w *ProCardW) Wrap() *ProCardW

Wrap lets child ProCards wrap onto new lines.

ProColumn 实验性 ​

go
type ProColumn[T any] struct {
	Key, Title string
	Width      float32
	MinWidth   float32
	Fixed      string
	Align      TextAlign
	Ellipsis   bool
	Hidden     bool // hidden until enabled in the column settings

	// ValueType formats Value (see the Value* constants).
	ValueType string
	ValueEnum []ProEnum
	Value     func(row T) any
	// Render overrides the cell (i is the row index in the current page).
	Render func(row T, i int)
	// OnClick makes link cells clickable.
	OnClick func(row T)
	// Currency is the ISO 4217 code ("USD", "JPY") or symbol of money cells
	// (default: the Locale's, "¥" for zh-CN / ja, "$" for en-US, "NT$" for
	// zh-TW). A code also sets the decimals (JPY: none); see FormatMoney.
	Currency string

	// Editor makes the column editable in EditableProTable: the field
	// (Required, Rules, Validate, AsyncValidate, Options, Min / Max ...)
	// picks the control by its ValueType; Key, Label, ValueType and
	// ValueEnum default to the column's. Set writes an edited value back
	// into a copy of the row; without Set the column stays read-only.
	Editor *ProField
	Set    func(row *T, v any)

	Sortable     bool // server-side sort (reported in ProRequest.Sort)
	Filterable   bool // filter dropdown from ValueEnum (ProRequest.Filters)
	HideInSearch bool
	HideInTable  bool
}

ProColumn is a ProTable column over rows of type T.

ProDescItem 实验性 ​

go
type ProDescItem struct {
	Key, Label string
	ValueType  string
	ValueEnum  []ProEnum
	Span       int // columns taken (default 1)

	// ReadOnly keeps the item out of inline editing.
	ReadOnly bool
	// Render replaces the value display (all holds every value).
	Render func(c *Context, v any, all ProValues)
	// Field configures the inline editor (Required, Rules, Min / Max,
	// Placeholder, Options ...). Key, Label, ValueType and ValueEnum
	// default to the item's.
	Field *ProField
}

ProDescItem is one entry of ProDescriptions. ValueType and ValueEnum use the ProTable / ProForm value types (text, money, digit, percent, date, dateTime, select, status, tag, progress, textarea ...): they format the value and pick the inline editor.

ProDescriptionsLocale 实验性 ​

go
type ProDescriptionsLocale struct {
	EditFmt string // inline edit button, arg: item label ("编辑%s")
	// contains filtered or unexported fields
}

ProDescriptionsLocale holds the ProDescriptions texts.

ProDescriptionsW 实验性 ​

go
type ProDescriptionsW struct {
	// contains filtered or unexported fields
}

ProDescriptionsW is a description list driven by item definitions (Ant Design Pro ProDescriptions): values formatted by value type, data loaded by a request function with a loading state, and inline editing of single items with save / cancel.

ui.ProDescriptions(c, items).Title("Rule").Column(2).Bordered().
	Request(func() (map[string]any, error) { return api.Rule(id) }).
	Editable(func(key string, v any, all ui.ProValues, done func(error)) { go save(key, v, done) }).
	Show()

func ProDescriptions 实验性 ​

go
func ProDescriptions(c *Context, items []ProDescItem) *ProDescriptionsW

ProDescriptions starts a description list over items; chain options, then Show.

func (*ProDescriptionsW) Bordered 实验性 ​

go
func (p *ProDescriptionsW) Bordered() *ProDescriptionsW

Bordered draws the table-like bordered style.

func (*ProDescriptionsW) Column 实验性 ​

go
func (p *ProDescriptionsW) Column(n int) *ProDescriptionsW

Column sets the number of columns (default: Descriptions' DEFAULT_COLUMN_MAP, 1 on xs, 2 on sm, 3 from md up).

func (*ProDescriptionsW) ColumnAt 实验性 ​

go
func (p *ProDescriptionsW) ColumnAt(bp Breakpoint, n int) *ProDescriptionsW

ColumnAt sets the number of columns from breakpoint bp upwards.

func (*ProDescriptionsW) Columns 实验性 ​

go
func (p *ProDescriptionsW) Columns(m map[Breakpoint]int) *ProDescriptionsW

Columns sets the number of columns for several breakpoints.

func (*ProDescriptionsW) DataSource 实验性 ​

go
func (p *ProDescriptionsW) DataSource(v *ProValues) *ProDescriptionsW

DataSource binds the values (inline edits are written into it).

func (*ProDescriptionsW) Editable 实验性 ​

go
func (p *ProDescriptionsW) Editable(onSave func(key string, v any, all ProValues, done func(error))) *ProDescriptionsW

Editable turns on inline editing: every item without ReadOnly gets an edit icon. onSave (may be nil) receives the new value; call done from any goroutine. A nil error commits the value, an error stays shown under the editor.

func (*ProDescriptionsW) Editing 实验性 ​

go
func (p *ProDescriptionsW) Editing(key string) bool

Editing reports whether the item key is being edited.

func (*ProDescriptionsW) Err 实验性 ​

go
func (p *ProDescriptionsW) Err() error

Err returns the last request error.

func (*ProDescriptionsW) Extra 实验性 ​

go
func (p *ProDescriptionsW) Extra(fn func()) *ProDescriptionsW

Extra builds actions right of the heading.

func (*ProDescriptionsW) ID 实验性 ​

go
func (p *ProDescriptionsW) ID() ID

ID returns the widget ID (valid after Show).

func (*ProDescriptionsW) Loading 实验性 ​

go
func (p *ProDescriptionsW) Loading() bool

Loading reports a pending request.

func (*ProDescriptionsW) Reload 实验性 ​

go
func (p *ProDescriptionsW) Reload()

Reload runs the request again (valid after Show).

func (*ProDescriptionsW) Request 实验性 ​

go
func (p *ProDescriptionsW) Request(fn func() (map[string]any, error)) *ProDescriptionsW

Request loads the values on a background goroutine; the list shows a loading mask meanwhile and an error banner when it fails.

func (*ProDescriptionsW) Saved 实验性 ​

go
func (p *ProDescriptionsW) Saved() string

Saved returns the key of the item committed this frame ("" if none).

func (*ProDescriptionsW) Show 实验性 ​

go
func (p *ProDescriptionsW) Show() *ProDescriptionsW

Show builds the list.

func (*ProDescriptionsW) Size 实验性 ​

go
func (p *ProDescriptionsW) Size(s ControlSize) *ProDescriptionsW

Size sets the density (Large default, Middle, Small).

func (*ProDescriptionsW) Title 实验性 ​

go
func (p *ProDescriptionsW) Title(s string) *ProDescriptionsW

Title sets the heading.

func (*ProDescriptionsW) Values 实验性 ​

go
func (p *ProDescriptionsW) Values() ProValues

Values returns the current values.

func (*ProDescriptionsW) Vertical 实验性 ​

go
func (p *ProDescriptionsW) Vertical() *ProDescriptionsW

Vertical puts labels above values.

ProEnum 实验性 ​

go
type ProEnum struct {
	Value, Label  string
	Status, Color string
	// Children nests options for the cascader and treeSelect value types.
	Children []ProEnum
	// Disabled marks an option that can't be picked (Pro valueEnum
	// disabled, es/field/components/Select/index.js
	// proFieldParsingValueEnumToArray).
	Disabled bool
}

ProEnum is one value of an enumerated ProTable column (status, tag, select). Status is a badge status ("success", "error", "processing", "warning", "default"); Color a tag color.

ProField 实验性 ​

go
type ProField struct {
	Key, Label  string
	ValueType   string    // see the Value* constants (default text)
	ValueEnum   []ProEnum // options of select / radio / checkbox / status / tag
	Placeholder string
	Help        string // hint under the control
	Span        int    // grid columns out of 24 (default: 24 / form columns)
	// Group puts the field in a titled ProFormGroup with the consecutive
	// fields of the same Group (ProForm, ModalForm, StepsForm).
	Group   string
	Width   float32 // fixed control width (default: fill the column)
	Initial any     // value when the form starts or resets

	// Validation: Required adds a required rule with the locale message;
	// Rules check the value's text form; Validate checks the typed value
	// against all values (cross-field); AsyncValidate runs after them.
	Required      bool
	Rules         []Rule
	Validate      func(v any, all ProValues) string
	AsyncValidate func(v any, done func(msg string))

	// Linkage: Dependencies lists keys whose change re-validates this
	// field, refreshes Options and drops a value Options no longer offers.
	Dependencies []string
	Hide         func(all ProValues) bool
	Disable      func(all ProValues) bool
	Options      func(all ProValues) []ProEnum

	// Number fields.
	Min, Max  float64
	Precision int

	// Pick handles the upload field's trigger (open a file dialog); call
	// done from any goroutine with the files to add.
	Pick func(done func(files []UploadFile))
	// Dragger shows the upload field as a drag area (Upload.Dragger):
	// it highlights while files are dragged over it and takes dropped
	// files (DropZone inside Upload).
	Dragger bool

	// Render replaces the built-in control (bind it to vals[Key]).
	Render func(c *Context, vals ProValues)

	// Readonly shows the value as read-only text (ProFormW.Readonly does
	// it for every field); a read-only field is not validated.
	Readonly bool
	// OnCaptcha sends the code of a captcha field (call done from any
	// goroutine; nil starts the countdown); the button then counts down
	// CaptchaSeconds (default 60).
	OnCaptcha      func(vals ProValues, done func(error))
	CaptchaSeconds int
	// Captcha configures the phone key, button text and timing callback.
	Captcha *ProFieldCaptcha
	// Segmented configures the ValueSegmented editor (custom item content,
	// direction, size, icons, etc.) before it is built.
	Segmented func(w *SegmentedW)

	// List gives the row fields of a formList field.
	List *ProFieldList
	// contains filtered or unexported fields
}

ProField describes a form field; ProForm, QueryFilter, StepsForm, ModalForm and DrawerForm render fields from it.

func ProFormFieldSet 实验性 ​

go
func ProFormFieldSet(c *Context, fs ProFieldSet) ProField

ProFormFieldSet turns a field set into a ProField for ProForm, QueryFilter, ModalForm, StepsForm …:

fields = append(fields, ui.ProFormFieldSet(c, ui.ProFieldSet{
	Key: "budget", Label: "Budget", Separator: "~", Required: true,
	Parts: []ui.ProField{{ValueType: ui.ValueDigit}, {ValueType: ui.ValueDigit}},
}))

ProFieldCaptcha 实验性 ​

go
type ProFieldCaptcha struct {

	// PhoneKey is the key of the phone field: inside a form that field is
	// validated first and nothing is sent while it is invalid (Pro
	// phoneName). OnCaptcha receives all values, the phone included.
	PhoneKey string
	// Text returns the button text while counting down (timing true, count
	// = seconds left) or idle (count = the full countdown); nil uses the
	// locale's "get code" / "resend in %d s" (Pro captchaTextRender).
	Text func(timing bool, count int) string
	// OnTiming receives the count whenever it changes: the full countdown
	// when idle, then every second left while counting down (Pro onTiming).
	OnTiming func(count int)
	// contains filtered or unexported fields
}

ProFieldCaptcha configures a captcha field beyond ProField.OnCaptcha and ProField.CaptchaSeconds (Pro ProFormCaptcha phoneName, captchaTextRender, onTiming).

ProFieldList 实验性 ​

go
type ProFieldList struct {
	Fields   []ProField
	Min, Max int    // Max 0: no limit
	AddText  string // default: the locale's "add row"
	// contains filtered or unexported fields
}

ProFieldList configures a ValueFormList field: the fields of one row, the row count limits and the add button's text.

ProFieldLocale 实验性 ​

go
type ProFieldLocale struct {
	On, Off          string // switch value text
	StartFmt, EndFmt string // time range ends, arg: field label ("%s开始")
	Min, Max         string // digit range placeholders
	RangeEndFmt      string // accessible name of a digit range end, args: field label, Min / Max ("%s:%s")
	// fromNow and second value types: JustNow for under a minute, AgoFmt /
	// LaterFmt wrap an amount ("%s前"), the unit formats take a count
	// ("%d 分钟"); second joins the day … second amounts.
	JustNow, AgoFmt, LaterFmt                                string
	SecondFmt, MinuteFmt, HourFmt, DayFmt, MonthFmt, YearFmt string
	InvalidJSON                                              string // jsonCode validation message
	// contains filtered or unexported fields
}

ProFieldLocale holds texts of ProField / ProColumn value types (editors and read-only views).

ProFieldMode 实验性 ​

go
type ProFieldMode string

ProFieldMode selects how ProFieldOf shows its value.

go
const (
	ProFieldRead ProFieldMode = "read" // formatted read-only value (default)
	ProFieldEdit ProFieldMode = "edit" // the value type's editor
)

Modes of ProFieldOf.

实验性

ProFieldSet 实验性 ​

go
type ProFieldSet struct {
	Key, Label string
	Parts      []ProField // ValueType, ValueEnum, Placeholder, Width, Min / Max of each part
	Separator  string     // text between the parts (e.g. "~"); empty: a gap
	Required   bool       // every part must be filled
	// Validate checks the combined value (e.g. min <= max).
	Validate func(parts []any, all ProValues) string
	Help     string
	Span     int
	Initial  []any
}

ProFieldSet combines several controls into one form value (Ant Design Pro ProFormFieldSet), such as a numeric range or a phone area code plus number. The value of Key is a []any with one entry per part (nil for an empty part); read it with ProValues.Parts.

ProFieldW 实验性 ​

go
type ProFieldW struct {
	// contains filtered or unexported fields
}

ProFieldW renders a single value outside a form (Ant Design ProField): the same value types as ProForm, ProTable and ProDescriptions, read-only or as the editor, switched with Mode.

var price any = 12800.0
mode := ui.ProFieldRead
ui.ProFieldOf(c, ui.ProField{Label: "价格", ValueType: ui.ValueMoney}, &price).Mode(mode).Show()

func ProFieldOf 实验性 ​

go
func ProFieldOf(c *Context, fd ProField, val *any) *ProFieldW

ProFieldOf starts a standalone field over *val described by fd (its Label names the editor for assistive technologies; Key may be empty); chain options, then Show. The Go type of *val follows the value type, as in ProValues.

ConfigProvider.Defaults("ProField", ...) keys: "mode" ("read" | "edit").

func (*ProFieldW) Changed 实验性 ​

go
func (w *ProFieldW) Changed() bool

Changed reports an edit of the value in the last Show.

func (*ProFieldW) ID 实验性 ​

go
func (w *ProFieldW) ID() ID

ID returns the widget ID (valid after Show).

func (*ProFieldW) Mode 实验性 ​

go
func (w *ProFieldW) Mode(m ProFieldMode) *ProFieldW

Mode switches between the read-only view and the editor.

func (*ProFieldW) Show 实验性 ​

go
func (w *ProFieldW) Show() *ProFieldW

Show builds the field.

ProFormGroupW 实验性 ​

go
type ProFormGroupW struct {
	// contains filtered or unexported fields
}

ProFormGroupW builds a ProFormGroup.

func ProFormGroup 实验性 ​

go
func ProFormGroup(c *Context, title string) *ProFormGroupW

ProFormGroup starts a group titled title ("" = no title row); chain options, then Body.

ConfigProvider.Defaults("ProFormGroup", ...) keys: "collapsible" (bool), "columns", "gutter", "size" (gap between rows, number).

func (*ProFormGroupW) Body 实验性 ​

go
func (g *ProFormGroupW) Body(fn func()) *ProFormGroupW

Body builds the group with fn as its items.

func (*ProFormGroupW) Collapsed 实验性 ​

go
func (g *ProFormGroupW) Collapsed(v *bool) *ProFormGroupW

Collapsed binds the folded state (implies Collapsible).

func (*ProFormGroupW) Collapsible 实验性 ​

go
func (g *ProFormGroupW) Collapsible() *ProFormGroupW

Collapsible lets a click on the title fold the items.

func (*ProFormGroupW) Columns 实验性 ​

go
func (g *ProFormGroupW) Columns(n int) *ProFormGroupW

Columns lays the items out n per line (0: stacked).

func (*ProFormGroupW) DefaultCollapsed 实验性 ​

go
func (g *ProFormGroupW) DefaultCollapsed() *ProFormGroupW

DefaultCollapsed starts an uncontrolled collapsible group folded.

func (*ProFormGroupW) Description 实验性 ​

go
func (g *ProFormGroupW) Description(s string) *ProFormGroupW

Description adds a muted line under the title.

func (*ProFormGroupW) Extra 实验性 ​

go
func (g *ProFormGroupW) Extra(fn func()) *ProFormGroupW

Extra builds content at the right of the title row.

func (*ProFormGroupW) Gutter 实验性 ​

go
func (g *ProFormGroupW) Gutter(px float32) *ProFormGroupW

Gutter sets the horizontal space between columns (default 24).

func (*ProFormGroupW) ID 实验性 ​

go
func (g *ProFormGroupW) ID() ID

ID returns the group's widget ID (after Body).

func (*ProFormGroupW) Size 实验性 ​

go
func (g *ProFormGroupW) Size(px float32) *ProFormGroupW

Size sets the vertical space between item rows (default 0: the items' own margins).

func (*ProFormGroupW) Toggled 实验性 ​

go
func (g *ProFormGroupW) Toggled() bool

Toggled reports a fold / unfold by the user this frame.

ProFormW 实验性 ​

go
type ProFormW struct {
	// contains filtered or unexported fields
}

ProFormW renders a form from field definitions (Ant Design ProForm): a grid of fields whose controls follow their value types (shared with ProTable columns), linkage, validation (sync, cross-field, async), submit / reset buttons with a loading state and asynchronous initial values.

ui.ProForm(c, fields).Columns(2).
	Request(func(done func(ui.ProValues, error)) { go load(done) }).
	OnFinish(func(v ui.ProValues, done func(error)) { go save(v, done) }).
	Show()

func ProForm 实验性 ​

go
func ProForm(c *Context, fields []ProField) *ProFormW

ProForm starts a form over fields; chain options, then Show.

func (*ProFormW) Children 实验性 ​

go
func (p *ProFormW) Children(fn func(f *FormW)) *ProFormW

Children builds extra items after the fields (FormList, custom items).

func (*ProFormW) Columns 实验性 ​

go
func (p *ProFormW) Columns(n int) *ProFormW

Columns lays fields out in a grid of n equal columns (ProField.Span overrides a field's width out of 24).

func (*ProFormW) Err 实验性 ​

go
func (p *ProFormW) Err() error

Err returns the last OnFinish error.

func (*ProFormW) Finished 实验性 ​

go
func (p *ProFormW) Finished() bool

Finished reports a completed submit (OnFinish called done(nil)), once.

func (*ProFormW) Form 实验性 ​

go
func (p *ProFormW) Form() *FormW

Form returns the inner form of the last Show.

func (*ProFormW) Gutter 实验性 ​

go
func (p *ProFormW) Gutter(px float32) *ProFormW

Gutter sets the horizontal gap between grid columns (default 24).

func (*ProFormW) Horizontal 实验性 ​

go
func (p *ProFormW) Horizontal() *ProFormW

Horizontal puts labels left of the controls (default: above).

func (*ProFormW) ID 实验性 ​

go
func (p *ProFormW) ID() ID

ID returns the widget ID (valid after Show).

func (*ProFormW) LabelWidth 实验性 ​

go
func (p *ProFormW) LabelWidth(px float32) *ProFormW

LabelWidth sets the label width of a horizontal form.

func (*ProFormW) Loading 实验性 ​

go
func (p *ProFormW) Loading() bool

Loading reports the initial request in progress.

func (*ProFormW) NoReset 实验性 ​

go
func (p *ProFormW) NoReset() *ProFormW

NoReset hides the reset button.

func (*ProFormW) NoSubmitter 实验性 ​

go
func (p *ProFormW) NoSubmitter() *ProFormW

NoSubmitter hides the buttons (submit with Submit, e.g. from a modal).

func (*ProFormW) OnFinish 实验性 ​

go
func (p *ProFormW) OnFinish(fn func(vals ProValues, done func(error))) *ProFormW

OnFinish receives the values after a successful validation; call done (from any goroutine) when saved. The submit button spins meanwhile and a non-nil error is shown above the buttons.

func (*ProFormW) Readonly 实验性 ​

go
func (p *ProFormW) Readonly(on bool) *ProFormW

Readonly shows every field as its formatted read-only value (Ant ProForm readonly) and hides the submit / reset buttons; ProField.Readonly does it for one field. Read-only fields are not validated.

func (*ProFormW) Request 实验性 ​

go
func (p *ProFormW) Request(fn func(done func(ProValues, error))) *ProFormW

Request loads the initial values asynchronously; call done from any goroutine. The form shows a loading mask meanwhile.

func (*ProFormW) Reset 实验性 ​

go
func (p *ProFormW) Reset()

Reset restores the initial values and clears validation.

func (*ProFormW) ResetText 实验性 ​

go
func (p *ProFormW) ResetText(s string) *ProFormW

ResetText sets the reset button's text.

func (*ProFormW) Show 实验性 ​

go
func (p *ProFormW) Show() *ProFormW

Show builds the form.

func (*ProFormW) Submit 实验性 ​

go
func (p *ProFormW) Submit()

Submit validates (waiting for async rules) and calls OnFinish.

func (*ProFormW) SubmitText 实验性 ​

go
func (p *ProFormW) SubmitText(s string) *ProFormW

SubmitText sets the submit button's text.

func (*ProFormW) Submitter 实验性 ​

go
func (p *ProFormW) Submitter(fn func(s *ProSubmitter)) *ProFormW

Submitter replaces the buttons.

func (*ProFormW) Submitting 实验性 ​

go
func (p *ProFormW) Submitting() bool

Submitting reports validation or OnFinish in progress.

func (*ProFormW) Values 实验性 ​

go
func (p *ProFormW) Values(v *ProValues) *ProFormW

Values binds the values (otherwise the form keeps its own).

ProLayoutConfig 实验性 ​

go
type ProLayoutConfig struct {
	Title      string
	Logo       *icon.Icon
	Menu       []MenuItem
	Selected   *string
	Collapsed  *bool
	LightSider bool     // explicitly request a light sider
	NavTheme   string   // "light" (v3 default) or "dark"; LightSider still forces light
	Breadcrumb []string // shown in the header
	UserName   string
	Actions    func() // extra header actions (left of the avatar)
	Footer     string
	PageTitle  string
	// Layout is "side" (default: sider with logo and menu, header with
	// the collapse toggle), "top" (header with logo and a horizontal
	// menu, no sider) or "mix" (full-width header with logo and actions
	// above a sider with the menu and a collapse trigger).
	Layout string
	// NoPadding drops the 24px padding of the content area, so a
	// PageContainer (or any page) fills it edge to edge.
	NoPadding bool
	// Breakpoint collapses the sider when the window is narrower (side
	// and mix layouts; XS = never).
	Breakpoint Breakpoint
	// SiderWidth overrides the expanded sider width (0: the theme's).
	SiderWidth float32
	// ContentWidth is "Fluid" (default) or "Fixed": the content is then
	// centred in a 1152px GridContent in the top layout (Ant contentWidth).
	ContentWidth string
	// NoFixedHeader lets the header scroll away with the content (Ant
	// fixedHeader=false, the v3 default). FixedHeader explicitly pins it.
	NoFixedHeader bool
	// FixedHeader explicitly pins the header; NoFixedHeader takes precedence.
	FixedHeader bool
	// NoFixSiderbar lets the sider scroll with the page (Ant
	// fixSiderbar=false): sider and content share one scroll, so a long
	// menu is reached by scrolling the page. By default the sider stays
	// fixed and only the content area scrolls (side and mix layouts; in the
	// side layout the header then scrolls with the page too).
	NoFixSiderbar bool

	// AutoBreadcrumb derives the breadcrumb from the menu path of
	// *Selected (parent submenus, then the item) when Breadcrumb is empty;
	// clicking an ancestor that is a menu item selects it. MenuPath gives
	// the same path to the page (e.g. for PageContainer.Breadcrumb).
	AutoBreadcrumb bool
	// BreadcrumbRender adjusts the breadcrumb items (static or automatic)
	// before they are shown; returning none hides the breadcrumb.
	BreadcrumbRender func(items []BreadcrumbItem) []BreadcrumbItem

	// Render hooks (Ant menuHeaderRender, headerRender ...). def builds the
	// default part, so a hook can wrap or replace it.
	//
	// MenuHeaderRender builds the logo and title area (top of the sider;
	// the start of the header in the top and mix layouts).
	MenuHeaderRender func(def func(), collapsed bool)
	// MenuFooterRender builds content under the sider menu (side layout).
	MenuFooterRender func(collapsed bool)
	// HeaderRender builds the whole header bar.
	HeaderRender func(def func())
	// HeaderContentRender builds the middle of the header: in the side
	// layout it replaces the breadcrumb, in the top layout the horizontal
	// menu, in the mix layout it follows the logo.
	HeaderContentRender func()
	// MenuItemRender rewrites every menu item (children first) before the
	// menu is built: change labels, icons, Disabled, add Shortcut text.
	// The menu draws the items itself, so the hook returns data, not UI.
	MenuItemRender func(item MenuItem) MenuItem
	// FooterRender builds the footer at the end of the content area in
	// place of the default one (DefaultFooter with FooterLinks and Footer).
	FooterRender func()
	// FooterLinks are the links of the default footer, above the Footer
	// text (Ant DefaultFooter links); read DefaultFooterW.Clicked through
	// FooterRender to react, or give each link an OnClick.
	FooterLinks []FooterLink
}

ProLayoutConfig configures the admin shell.

ProListMetas 实验性 ​

go
type ProListMetas[T any] struct {
	Title       func(row T) string
	SubTitle    func(c *Context, row T) // next to the title (tags)
	Description func(row T) string
	Avatar      func(c *Context, row T)
	Content     func(c *Context, row T) // middle area
	Actions     func(c *Context, row T) // links at the end, split by bars
	Extra       func(c *Context, row T) // right-most (an image)
}

ProListMetas maps a row to the parts of a ProList item. Every part is optional.

ProListW 实验性 ​

go
type ProListW[T any] struct {
	// contains filtered or unexported fields
}

ProListW is a data-driven list (Ant Design Pro ProList): items built from metas, a toolbar with a title and actions, selection, expandable items, pagination, a loading state and a card grid mode.

ui.ProList(c, rows, metas).HeaderTitle("Projects").RowKey(key).
	Selection(&sel).Pagination(5).Show()

func ProList 实验性 ​

go
func ProList[T any](c *Context, rows []T, metas ProListMetas[T]) *ProListW[T]

ProList starts a list over rows; chain options, then Show.

func (*ProListW[T]) Bordered 实验性 ​

go
func (p *ProListW[T]) Bordered() *ProListW[T]

Bordered frames the list.

func (*ProListW[T]) DefaultExpandAllRows 实验性 ​

go
func (p *ProListW[T]) DefaultExpandAllRows(on bool) *ProListW[T]

DefaultExpandAllRows controls the initial expansion of each row (default true).

func (*ProListW[T]) EmptyText 实验性 ​

go
func (p *ProListW[T]) EmptyText(s string) *ProListW[T]

EmptyText replaces the empty-state text.

func (*ProListW[T]) Err 实验性 ​

go
func (p *ProListW[T]) Err() error

Err returns the error of the last Request.

func (*ProListW[T]) EstimatedItemHeight 实验性 ​

go
func (p *ProListW[T]) EstimatedItemHeight(px float32) *ProListW[T]

EstimatedItemHeight is the height Virtual assumes for an item not measured yet (List.EstimatedItemHeight).

func (*ProListW[T]) ExpandRowByClick 实验性 ​

go
func (p *ProListW[T]) ExpandRowByClick() *ProListW[T]

ExpandRowByClick toggles expansion when the row body is activated.

func (*ProListW[T]) Expandable 实验性 ​

go
func (p *ProListW[T]) Expandable(fn func(c *Context, row T)) *ProListW[T]

Expandable adds an expand toggle per item showing fn below it.

func (*ProListW[T]) ExpandedRowKeys 实验性 ​

go
func (p *ProListW[T]) ExpandedRowKeys(keys *[]string) *ProListW[T]

ExpandedRowKeys binds the expanded keys to application-owned state.

func (*ProListW[T]) Grid 实验性 ​

go
func (p *ProListW[T]) Grid(n int) *ProListW[T]

Grid lays the items out as cards in n columns.

func (*ProListW[T]) HeaderTitle 实验性 ​

go
func (p *ProListW[T]) HeaderTitle(s string) *ProListW[T]

HeaderTitle sets the toolbar title.

func (*ProListW[T]) Height 实验性 ​

go
func (p *ProListW[T]) Height(px float32) *ProListW[T]

Height fixes the height of the items' viewport (List.Height); the toolbar, selection bar and pager stay outside it.

func (*ProListW[T]) ID 实验性 ​

go
func (p *ProListW[T]) ID() ID

ID returns the widget ID (valid after Show).

func (*ProListW[T]) IsLoading 实验性 ​

go
func (p *ProListW[T]) IsLoading() bool

IsLoading reports a Request in flight.

func (*ProListW[T]) ItemLayout 实验性 ​

go
func (p *ProListW[T]) ItemLayout(s string) *ProListW[T]

ItemLayout selects horizontal (default) or vertical item actions.

func (*ProListW[T]) Loading 实验性 ​

go
func (p *ProListW[T]) Loading(on bool) *ProListW[T]

Loading shows the loading mask.

func (*ProListW[T]) OnItemClick 实验性 ​

go
func (p *ProListW[T]) OnItemClick(fn func(row T)) *ProListW[T]

OnItemClick makes the items (cards in grid mode) clickable.

func (*ProListW[T]) Page 实验性 ​

go
func (p *ProListW[T]) Page() int

Page returns the current page (1-based).

func (*ProListW[T]) Pagination 实验性 ​

go
func (p *ProListW[T]) Pagination(n int) *ProListW[T]

Pagination shows n items per page with a pager.

func (*ProListW[T]) Reload 实验性 ​

go
func (p *ProListW[T]) Reload()

Reload loads the current page again (valid after Show).

func (*ProListW[T]) Request 实验性 ​

go
func (p *ProListW[T]) Request(fn func(page, size int) ([]T, int, error)) *ProListW[T]

Request loads the list page by page from a server: fn runs on a background goroutine with the 1-based page and the page size (set with Pagination, default 10) and returns the page's rows and the total count. The rows passed to ProList are ignored; the list shows a loading mask while a page loads and an error with a retry button when it fails.

func (*ProListW[T]) RowExpandable 实验性 ​

go
func (p *ProListW[T]) RowExpandable(fn func(T) bool) *ProListW[T]

RowExpandable determines which rows offer an expand control.

func (*ProListW[T]) RowKey 实验性 ​

go
func (p *ProListW[T]) RowKey(f func(T) string) *ProListW[T]

RowKey gives rows stable keys (selection and expansion follow them; default: the row index).

func (*ProListW[T]) Selection 实验性 ​

go
func (p *ProListW[T]) Selection(keys *[]string) *ProListW[T]

Selection adds a checkbox per item bound to the selected keys.

func (*ProListW[T]) SelectionChanged 实验性 ​

go
func (p *ProListW[T]) SelectionChanged() bool

SelectionChanged reports a selection change in the last Show.

func (*ProListW[T]) Show 实验性 ​

go
func (p *ProListW[T]) Show() *ProListW[T]

Show builds the list.

func (*ProListW[T]) Split 实验性 ​

go
func (p *ProListW[T]) Split(on bool) *ProListW[T]

Split toggles the lines between items (default on).

func (*ProListW[T]) ToolBar 实验性 ​

go
func (p *ProListW[T]) ToolBar(fn func()) *ProListW[T]

ToolBar builds actions at the right of the toolbar.

func (*ProListW[T]) Total 实验性 ​

go
func (p *ProListW[T]) Total() int

Total returns the total count reported by Request.

func (*ProListW[T]) Virtual 实验性 ​

go
func (p *ProListW[T]) Virtual() *ProListW[T]

Virtual builds only the items in view (List.Virtual; needs Height). Item heights, expanded items included, are measured as they come into view and cached by RowKey; selection and expansion are kept by key and do not depend on which items are built. Keyboard focus in an item scrolled out of view is lost, as in the non-virtual Height form.

ProRequest 实验性 ​

go
type ProRequest struct {
	Page, PageSize int
	Sort           []SortState
	Filters        map[string][]string
	Params         map[string]string // query form values (non-empty only)
	// ExtParams is the value given to ProTableW.Params (Ant params); a
	// map[string]string / map[string]any is also merged into Params
	// (the query form wins on a shared key).
	ExtParams any
}

ProRequest is what the request function receives.

ProResult 实验性 ​

go
type ProResult[T any] struct {
	Rows  []T
	Total int
	Err   error
}

ProResult is delivered back by the request function (from any goroutine).

ProSettings 实验性 ​

go
type ProSettings struct {
	NavTheme     string      // "light", "dark" or "realDark"
	PrimaryColor theme.Color // zero: the theme's brand color
	Layout       string      // "side" (default), "top" or "mix"
	ContentWidth string      // "Fluid" (default) or "Fixed"
	FixedHeader  bool
	FixSiderbar  bool
	ColorWeak    bool
	Compact      bool
	// contains filtered or unexported fields
}

ProSettings are the shell settings edited by SettingDrawer.

func DefaultProSettings 实验性 ​

go
func DefaultProSettings() ProSettings

DefaultProSettings returns Pro v3 defaults: light menu, side layout, fluid content, scrolling header and fixed side menu.

func (ProSettings) Apply 实验性 ​

go
func (s ProSettings) Apply(cfg *ProLayoutConfig)

Apply copies the layout settings into cfg.

ProSkeletonW 实验性 ​

go
type ProSkeletonW struct {
	// contains filtered or unexported fields
}

ProSkeletonW builds a page skeleton.

func ProSkeleton 实验性 ​

go
func ProSkeleton(c *Context, kind string) *ProSkeletonW

ProSkeleton starts a page skeleton of kind (SkeletonList, SkeletonResult or SkeletonDescriptions; "" = list). Defaults: active, with page header, 2 statistics, a toolbar and 5 list rows (4 table rows on the descriptions page).

Pro v3 picks the statistic count from the first breakpoint key that is true; antd's screens put xs/sm first, so in a browser that is always 2 (xs and sm both map to 2). Tango renders that observed default, not the md/xl entries of the lookup table.

func (*ProSkeletonW) Active 实验性 ​

go
func (s *ProSkeletonW) Active(on bool) *ProSkeletonW

Active turns the shimmer on or off.

func (*ProSkeletonW) Layout 实验性 ​

go
func (s *ProSkeletonW) Layout(o ...layout.Option) *ProSkeletonW

Layout applies layout options to the skeleton.

func (*ProSkeletonW) List 实验性 ​

go
func (s *ProSkeletonW) List(n int) *ProSkeletonW

List sets the number of list rows (list type, default 5) or table rows (descriptions type, default 4); 0 hides the list, or the divider and table. The list toolbar is controlled by Toolbar alone.

func (*ProSkeletonW) PageHeader 实验性 ​

go
func (s *ProSkeletonW) PageHeader(on bool) *ProSkeletonW

PageHeader shows or hides the page header placeholder.

func (*ProSkeletonW) Show 实验性 ​

go
func (s *ProSkeletonW) Show() *Box

Show builds the skeleton.

func (*ProSkeletonW) Statistic 实验性 ​

go
func (s *ProSkeletonW) Statistic(n int) *ProSkeletonW

Statistic sets the number of statistic placeholders (list type; 0 hides them; default 2).

func (*ProSkeletonW) Toolbar 实验性 ​

go
func (s *ProSkeletonW) Toolbar(on bool) *ProSkeletonW

Toolbar shows or hides the list toolbar placeholder.

ProStatisticW 实验性 ​

go
type ProStatisticW struct {
	// contains filtered or unexported fields
}

ProStatisticW is the standalone Pro statistic (StatisticCard.Statistic). It shares StatisticCard's statistic renderer without adding a card surface.

func ProStatistic 实验性 ​

go
func ProStatistic(c *Context, title string) *ProStatisticW

ProStatistic starts a compact Pro statistic. ui.Statistic is the antd statistic; this entry adds Pro layout, descriptions, status, tip and trend.

func (*ProStatisticW) Description 实验性 ​

go
func (w *ProStatisticW) Description(fn func()) *ProStatisticW

Description builds description content.

func (*ProStatisticW) Icon 实验性 ​

go
func (w *ProStatisticW) Icon(ic *icon.Icon) *ProStatisticW

Icon adds a leading icon.

func (*ProStatisticW) Prefix 实验性 ​

go
func (w *ProStatisticW) Prefix(s string) *ProStatisticW

Prefix adds text before the value.

func (*ProStatisticW) Show 实验性 ​

go
func (w *ProStatisticW) Show() *ProStatisticW

Show builds a standalone statistic. Consecutive standalone statistics have a 4px block gap, as in Pro's `& + &` rule.

func (*ProStatisticW) StatisticLayout 实验性 ​

go
func (w *ProStatisticW) StatisticLayout(s string) *ProStatisticW

StatisticLayout sets vertical, horizontal or inline layout.

func (*ProStatisticW) Status 实验性 ​

go
func (w *ProStatisticW) Status(s string) *ProStatisticW

Status adds a status dot.

func (*ProStatisticW) Suffix 实验性 ​

go
func (w *ProStatisticW) Suffix(s string) *ProStatisticW

Suffix adds text after the value.

func (*ProStatisticW) Tooltip 实验性 ​

go
func (w *ProStatisticW) Tooltip(s string) *ProStatisticW

Tooltip adds a title tooltip.

func (*ProStatisticW) Trend 实验性 ​

go
func (w *ProStatisticW) Trend(s string) *ProStatisticW

Trend sets the trend direction.

func (*ProStatisticW) TrendColors 实验性 ​

go
func (w *ProStatisticW) TrendColors(up, down theme.Color) *ProStatisticW

TrendColors overrides the trend colors.

func (*ProStatisticW) Value 实验性 ​

go
func (w *ProStatisticW) Value(v float64, precision int) *ProStatisticW

Value formats a numeric value.

func (*ProStatisticW) ValueColor 实验性 ​

go
func (w *ProStatisticW) ValueColor(col theme.Color) *ProStatisticW

ValueColor overrides the value color.

func (*ProStatisticW) ValueText 实验性 ​

go
func (w *ProStatisticW) ValueText(s string) *ProStatisticW

ValueText sets a preformatted value.

ProSubmitter 实验性 ​

go
type ProSubmitter struct {
	// contains filtered or unexported fields
}

ProSubmitter is passed to a custom submitter.

func (*ProSubmitter) Context 实验性 ​

go
func (s *ProSubmitter) Context() *Context

Context returns the build context.

func (*ProSubmitter) Loading 实验性 ​

go
func (s *ProSubmitter) Loading() bool

Loading reports a running submit (show it on the submit button).

func (*ProSubmitter) Reset 实验性 ​

go
func (s *ProSubmitter) Reset()

Reset restores the initial values.

func (*ProSubmitter) Submit 实验性 ​

go
func (s *ProSubmitter) Submit()

Submit validates and submits the form.

ProTableLocale 实验性 ​

go
type ProTableLocale struct {
	Query, Reload, Density, DensityDefault, DensityMiddle, DensityCompact string
	ColumnSetting, ColumnDisplay, ClearSelection                          string
	LoadErrorFmt                                                          string // alert text, arg: error message
	// contains filtered or unexported fields
}

ProTableLocale holds the ProTable search form and toolbar texts.

ProTableW 实验性 ​

go
type ProTableW[T any] struct {
	// contains filtered or unexported fields
}

ProTableW is a query list page: an auto-generated query form, a toolbar (refresh, density, column settings, fullscreen) and a table fed by an asynchronous request function.

func ProTable 实验性 ​

go
func ProTable[T any](c *Context, cols []ProColumn[T]) *ProTableW[T]

ProTable starts a ProTable; set Request, then Show.

ConfigProvider.Defaults("ProTable", ...) keys: "search", "bordered", "options" (bool), "pagination" (false, a page size or Props{"pageSize": n}), "size" (density: "small" | "middle" | "large"), "headerTitle" (string), "polling" (time.Duration or milliseconds).

func (*ProTableW[T]) Bordered 实验性 ​

go
func (p *ProTableW[T]) Bordered() *ProTableW[T]

Bordered draws cell borders.

func (*ProTableW[T]) ColumnsState 实验性 ​

go
func (p *ProTableW[T]) ColumnsState(s *TableColumnState) *ProTableW[T]

ColumnsState binds the column state (order, visibility, widths, pinned side) to *s, so the application controls it (Ant columnsState.value).

func (*ProTableW[T]) DragSort 实验性 ​

go
func (p *ProTableW[T]) DragSort(fn func(from, to int)) *ProTableW[T]

DragSort adds a drag handle column (Ant Design Pro DragSortTable): dropping a row calls fn with the indices of the moved row and of the row it was dropped on, both in the current page (Rows). Reorder the data (locally or on the server) and Reload, or reorder the page in place with MovePageRow.

func (*ProTableW[T]) Expandable 实验性 ​

go
func (p *ProTableW[T]) Expandable(fn func(row T)) *ProTableW[T]

Expandable adds detail panels.

func (*ProTableW[T]) FullScreen 实验性 ​

go
func (p *ProTableW[T]) FullScreen(on bool) *ProTableW[T]

FullScreen enables the fullscreen toolbar option (v3 default: false).

func (*ProTableW[T]) Loading 实验性 ​

go
func (p *ProTableW[T]) Loading() bool

Loading reports a pending request.

func (*ProTableW[T]) MovePageRow 实验性 ​

go
func (p *ProTableW[T]) MovePageRow(from, to int)

MovePageRow moves row from to the position of row to in the current page without a new request (valid after Show; use it from DragSort).

func (*ProTableW[T]) NoOptions 实验性 ​

go
func (p *ProTableW[T]) NoOptions() *ProTableW[T]

NoOptions hides the toolbar setting icons (Ant options={false}).

func (*ProTableW[T]) NoPagination 实验性 ​

go
func (p *ProTableW[T]) NoPagination() *ProTableW[T]

NoPagination drops the pager: requests ask for every row (PageSize 0).

func (*ProTableW[T]) NoSearch 实验性 ​

go
func (p *ProTableW[T]) NoSearch() *ProTableW[T]

NoSearch hides the query form.

func (*ProTableW[T]) NoTableAlert 实验性 ​

go
func (p *ProTableW[T]) NoTableAlert() *ProTableW[T]

NoTableAlert hides the selection bar (Ant tableAlertRender={false}).

func (*ProTableW[T]) OnColumnsStateChange 实验性 ​

go
func (p *ProTableW[T]) OnColumnsStateChange(fn func(TableColumnState)) *ProTableW[T]

OnColumnsStateChange is called with the new column state after the user changes it in the column settings or by resizing (Ant columnsState.onChange).

func (*ProTableW[T]) PageSize 实验性 ​

go
func (p *ProTableW[T]) PageSize(n int) *ProTableW[T]

PageSize sets the initial page size (default 10).

func (*ProTableW[T]) Params 实验性 ​

go
func (p *ProTableW[T]) Params(v any) *ProTableW[T]

Params sets external request parameters (Ant params): a change of the value (compared by its printed form) requests page 1 again. The value reaches the request as ProRequest.ExtParams; maps are also merged into ProRequest.Params.

func (*ProTableW[T]) PausePolling 实验性 ​

go
func (p *ProTableW[T]) PausePolling()

PausePolling stops polling until ResumePolling (valid after Show).

func (*ProTableW[T]) PersistColumnsState 实验性 ​

go
func (p *ProTableW[T]) PersistColumnsState(key string, store ColumnsStateStore) *ProTableW[T]

PersistColumnsState loads the column state from store under key once and saves every change there (Ant columnsState.persistenceKey); the store decides where the state lives.

func (*ProTableW[T]) Polling 实验性 ​

go
func (p *ProTableW[T]) Polling(d time.Duration) *ProTableW[T]

Polling requests the current page again every d after the previous result arrived (0: off). Polling requests keep the rows on screen without the loading mask; PausePolling / ResumePolling control it.

func (*ProTableW[T]) PollingPaused 实验性 ​

go
func (p *ProTableW[T]) PollingPaused() bool

PollingPaused reports whether polling is paused.

func (*ProTableW[T]) Reload 实验性 ​

go
func (p *ProTableW[T]) Reload()

Reload requests the data again (valid after Show).

func (*ProTableW[T]) Request 实验性 ​

go
func (p *ProTableW[T]) Request(fn func(req ProRequest, done func(ProResult[T]))) *ProTableW[T]

Request sets the data source. It is called on the UI thread whenever the page, sort, filters or query change; call done (from any goroutine) with the page rows and total. The table shows a loading mask meanwhile and an error banner if Err is set.

func (*ProTableW[T]) ResumePolling 实验性 ​

go
func (p *ProTableW[T]) ResumePolling()

ResumePolling restarts paused polling (valid after Show); the next poll is due one interval after the last result.

func (*ProTableW[T]) RowClass 实验性 ​

go
func (p *ProTableW[T]) RowClass(fn func(row T) RowStyle) *ProTableW[T]

RowClass styles rows (see TableW.RowClass).

func (*ProTableW[T]) RowHeight 实验性 ​

go
func (p *ProTableW[T]) RowHeight(h float32) *ProTableW[T]

RowHeight overrides the row height derived from the density (TableW.RowHeight).

func (*ProTableW[T]) RowKey 实验性 ​

go
func (p *ProTableW[T]) RowKey(f func(T) string) *ProTableW[T]

RowKey gives rows stable keys (selection across pages).

func (*ProTableW[T]) Rows 实验性 ​

go
func (p *ProTableW[T]) Rows() []T

Rows returns the rows of the current page.

func (*ProTableW[T]) ScrollX 实验性 ​

go
func (p *ProTableW[T]) ScrollX(w float32) *ProTableW[T]

ScrollX sets the table's scroll width.

func (*ProTableW[T]) ScrollY 实验性 ​

go
func (p *ProTableW[T]) ScrollY(maxH float32) *ProTableW[T]

ScrollY bounds the table body to maxH (TableW.ScrollY): the header stays in place and only the visible rows of the page are built, so a page of many thousand rows stays fast. The toolbar, search form, alert and pager stay outside the scrolling body. Default 0: unbounded, every row of the page is built.

func (*ProTableW[T]) Selection 实验性 ​

go
func (p *ProTableW[T]) Selection(keys *[]string) *ProTableW[T]

Selection binds selected row keys (kept across pages).

func (*ProTableW[T]) Show 实验性 ​

go
func (p *ProTableW[T]) Show() *ProTableW[T]

Show builds the ProTable.

func (*ProTableW[T]) Table 实验性 ​

go
func (p *ProTableW[T]) Table() *TableW

Table returns the inner table of the last Show.

func (*ProTableW[T]) TableAlertOptionRender 实验性 ​

go
func (p *ProTableW[T]) TableAlertOptionRender(fn func(keys []string, clear func())) *ProTableW[T]

TableAlertOptionRender replaces the actions of the selection bar (the default clear link), e.g. with batch operations (Ant tableAlertOptionRender).

func (*ProTableW[T]) TableAlertRender 实验性 ​

go
func (p *ProTableW[T]) TableAlertRender(fn func(keys []string, clear func())) *ProTableW[T]

TableAlertRender replaces the text of the selection bar (Ant tableAlertRender); clear empties the selection.

func (*ProTableW[T]) Title 实验性 ​

go
func (p *ProTableW[T]) Title(s string) *ProTableW[T]

Title sets the toolbar title.

func (*ProTableW[T]) ToolBar 实验性 ​

go
func (p *ProTableW[T]) ToolBar(fn func()) *ProTableW[T]

ToolBar adds actions (e.g. a "新建" button) left of the toolbar icons.

func (*ProTableW[T]) Toolbar 实验性 ​

go
func (p *ProTableW[T]) Toolbar(fn func(*ListToolBarW)) *ProTableW[T]

Toolbar configures the public ListToolBar used by ProTable (search, subtitle, tooltip, filters, tabs and menus). ToolBar still adds actions.

func (*ProTableW[T]) Virtual 实验性 ​

go
func (p *ProTableW[T]) Virtual() *ProTableW[T]

Virtual is TableW.Virtual for the inner table: with ScrollY the body is windowed either way, Virtual states the intent and, like TableW.Virtual, takes the theme's Table V2 row height where it has one (Element Plus). Otherwise rows keep the height of the density (the density setting) unless RowHeight overrides it.

ProValues 实验性 ​

go
type ProValues map[string]any

ProValues holds form values by field key. The Go type depends on the value type: string (text, select, radio ...), float64 (digit, money, percent, rate, slider, progress), time.Time (date, dateTime), [2]time.Time (dateRange), []string (multiSelect, checkbox), bool (switch). A missing key is an empty value.

func (ProValues) Bool 实验性 ​

go
func (v ProValues) Bool(k string) bool

Bool returns a switch value.

func (ProValues) Clone 实验性 ​

go
func (v ProValues) Clone() ProValues

Clone copies the map (slices are copied too).

func (ProValues) DigitRange 实验性 ​

go
func (v ProValues) DigitRange(k string) [2]float64

DigitRange returns a number range; a missing value or end is NaN.

func (ProValues) Files 实验性 ​

go
func (v ProValues) Files(k string) []UploadFile

Files returns an upload value.

func (ProValues) Float 实验性 ​

go
func (v ProValues) Float(k string) float64

Float returns a number value (0 when missing or not a number).

func (ProValues) Parts 实验性 ​

go
func (v ProValues) Parts(k string) []any

Parts returns the value of a field set (nil when missing).

func (ProValues) Range 实验性 ​

go
func (v ProValues) Range(k string) [2]time.Time

Range returns a date range value.

func (ProValues) String 实验性 ​

go
func (v ProValues) String(k string) string

String returns the value of k as text ("" when missing).

func (ProValues) Strings 实验性 ​

go
func (v ProValues) Strings(k string) []string

Strings returns a multi-value (multiSelect, checkbox, cascader path).

func (ProValues) Time 实验性 ​

go
func (v ProValues) Time(k string) time.Time

Time returns a date value (zero when missing).

ProgressW ​

go
type ProgressW struct {
	// contains filtered or unexported fields
}

ProgressW is the full progress indicator: line / circle / dashboard types, steps, gradients, success segment, inside text, stripes and indeterminate motion.

func Progress ​

go
func Progress(c *Context, percent float64) *ProgressW

Progress adds a progress indicator (percent 0..100): a line bar by default, Circle/Dashboard for rings.

func (*ProgressW) A11yLabel ​

go
func (p *ProgressW) A11yLabel(s string) *ProgressW

A11yLabel sets the accessible name (default: the Locale's "progress").

func (*ProgressW) Circle ​

go
func (p *ProgressW) Circle(size float32) *ProgressW

Circle is Type("circle") with a diameter.

func (*ProgressW) Color ​

go
func (p *ProgressW) Color(col theme.Color) *ProgressW

Color overrides the bar color.

func (*ProgressW) ColorFunc ​

go
func (p *ProgressW) ColorFunc(fn func(percent float64) theme.Color) *ProgressW

ColorFunc picks the bar color from the percentage (Element color function; a color array is a ColorFunc with thresholds).

func (*ProgressW) Dashboard ​

go
func (p *ProgressW) Dashboard(size float32) *ProgressW

Dashboard is Type("dashboard") with a diameter.

func (*ProgressW) Format ​

go
func (p *ProgressW) Format(f func(percent float64) string) *ProgressW

Format customises the info text.

func (*ProgressW) GapDegree ​

go
func (p *ProgressW) GapDegree(d float64) *ProgressW

GapDegree sets the ring opening in degrees (dashboard default 75°; a circle with GapDegree opens too, like antd).

func (*ProgressW) GapPlacement ​

go
func (p *ProgressW) GapPlacement(s string) *ProgressW

GapPlacement sets where the ring opening sits: "bottom" (default), "top", "start" or "end" (logical: mirrored in RTL). antd 6 gapPlacement (gapPosition is deprecated there).

func (*ProgressW) Gradient ​

go
func (p *ProgressW) Gradient(a, b theme.Color) *ProgressW

Gradient paints the bar from a to b.

func (*ProgressW) HideInfo ​

go
func (p *ProgressW) HideInfo() *ProgressW

HideInfo hides the percentage text / status icon.

func (*ProgressW) Indeterminate ​

go
func (p *ProgressW) Indeterminate() *ProgressW

Indeterminate shows an endlessly moving segment (Element).

func (*ProgressW) Layout ​

go
func (p *ProgressW) Layout(o ...layout.Option) *ProgressW

Layout applies layout options.

func (*ProgressW) PercentPosition ​

go
func (p *ProgressW) PercentPosition(align, typ string) *ProgressW

PercentPosition places the info text of a line bar (antd 6 percentPosition): align "start", "center" or "end" (default); typ "outer" (default; center puts it under the bar) or "inner" (inside the filled part, like Element text-inside).

func (*ProgressW) RailColor ​

go
func (p *ProgressW) RailColor(col theme.Color) *ProgressW

RailColor sets the color of the unfilled rail (antd railColor).

func (*ProgressW) ShowInfo ​

go
func (p *ProgressW) ShowInfo() *ProgressW

ShowInfo shows the percentage text / status icon. It is the default, except for a line bar under a theme whose ProgressToken.ShowInfo is false (shadcn: like shadcn/ui's Progress, only the bar unless asked).

func (*ProgressW) Small ​

go
func (p *ProgressW) Small() *ProgressW

Small uses the compact size.

func (*ProgressW) Square ​

go
func (p *ProgressW) Square() *ProgressW

Square uses butt line caps instead of round ones.

func (*ProgressW) Status ​

go
func (p *ProgressW) Status(s string) *ProgressW

Status: "active" (Ant shimmer), "success", "exception", "warning".

func (*ProgressW) Steps ​

go
func (p *ProgressW) Steps(n int) *ProgressW

Steps splits the bar (or ring) into n segments.

func (*ProgressW) StepsGap ​

go
func (p *ProgressW) StepsGap(px float32) *ProgressW

StepsGap sets the gap between step segments in px (antd steps.gap; default 2).

func (*ProgressW) Striped ​

go
func (p *ProgressW) Striped(flow bool) *ProgressW

Striped draws diagonal stripes; flow animates them.

func (*ProgressW) StrokeWidth ​

go
func (p *ProgressW) StrokeWidth(w float32) *ProgressW

StrokeWidth sets the bar thickness / ring width in px.

func (*ProgressW) Success ​

go
func (p *ProgressW) Success(pct float64) *ProgressW

Success shows the first pct percent in the success color (Ant success).

func (*ProgressW) TextInside ​

go
func (p *ProgressW) TextInside() *ProgressW

TextInside draws the percentage inside the bar (Element text-inside).

func (*ProgressW) TrailColor ​

go
func (p *ProgressW) TrailColor(col theme.Color) *ProgressW

TrailColor sets the rail color.

Deprecated: use RailColor (antd 6 renamed trailColor to railColor).

func (*ProgressW) Type ​

go
func (p *ProgressW) Type(t string) *ProgressW

Type selects "line", "circle" or "dashboard".

func (*ProgressW) Width ​

go
func (p *ProgressW) Width(px float32) *ProgressW

Width sets the line length (or circle diameter).

PromptItem 实验性 ​

go
type PromptItem struct {
	Key         string
	Label       string
	Description string
	Icon        *icon.Icon
	Disabled    bool
	// contains filtered or unexported fields
}

PromptItem is one suggestion card of Prompts.

PromptsW 实验性 ​

go
type PromptsW struct {
	// contains filtered or unexported fields
}

PromptsW is a group of clickable prompt suggestion cards (the empty state of a chat, follow-up questions under an answer). Not to be confused with Prompt, the input dialog.

func Prompts 实验性 ​

go
func Prompts(c *Context, items []PromptItem) *PromptsW

Prompts adds prompt cards for items.

if k, ok := ui.Prompts(c, prompts).Title("试试这样问").Wrap().Clicked(); ok { ask(k) }

func (*PromptsW) CardWidth 实验性 ​

go
func (w *PromptsW) CardWidth(px float32) *PromptsW

CardWidth sets the minimum card width when wrapping (default 200).

func (*PromptsW) Clicked 实验性 ​

go
func (w *PromptsW) Clicked() (string, bool)

Clicked returns the key of the card activated this frame.

func (*PromptsW) Layout 实验性 ​

go
func (w *PromptsW) Layout(opts ...layout.Option) *PromptsW

Layout applies layout options to the group.

func (*PromptsW) Title 实验性 ​

go
func (w *PromptsW) Title(s string) *PromptsW

Title shows a heading above the cards (also the accessible name).

func (*PromptsW) Vertical 实验性 ​

go
func (w *PromptsW) Vertical() *PromptsW

Vertical stacks the cards in a column.

func (*PromptsW) Wrap 实验性 ​

go
func (w *PromptsW) Wrap() *PromptsW

Wrap lets the cards wrap onto more rows instead of shrinking.

Props 实验性 ​

go
type Props map[string]any

Props are default properties of one component, by property name ("size", "round", "duration" ...). Components document the keys they read.

QRCodeLocale 实验性 ​

go
type QRCodeLocale struct {
	Expired, Refresh, Scanned string
	// contains filtered or unexported fields
}

QRCodeLocale holds the QRCode status masks.

QRCodeW 实验性 ​

go
type QRCodeW struct {
	// contains filtered or unexported fields
}

QRCodeW renders a QR code (Ant Design QRCode / Element has none; the Element flavor keeps the same component with Element tokens).

func QRCode 实验性 ​

go
func QRCode(c *Context, value string) *QRCodeW

QRCode adds a QR code for value (default 160px, level M, bordered). An empty value draws nothing (Ant renders null), keeping the box size.

func (*QRCodeW) A11yLabel 实验性 ​

go
func (q *QRCodeW) A11yLabel(s string) *QRCodeW

A11yLabel sets the accessible name (default: the encoded value).

func (*QRCodeW) Bg 实验性 ​

go
func (q *QRCodeW) Bg(col theme.Color) *QRCodeW

Bg sets the background color.

func (*QRCodeW) BoostLevel 实验性 ​

go
func (q *QRCodeW) BoostLevel(on bool) *QRCodeW

BoostLevel(false) keeps the requested error-correction level; by default (Ant boostLevel true) the level is raised as far as the code keeps the same version (size).

func (*QRCodeW) Bordered 实验性 ​

go
func (q *QRCodeW) Bordered(on bool) *QRCodeW

Bordered toggles the outer border.

func (*QRCodeW) Color 实验性 ​

go
func (q *QRCodeW) Color(col theme.Color) *QRCodeW

Color sets the module color.

func (*QRCodeW) Icon 实验性 ​

go
func (q *QRCodeW) Icon(img image.Image) *QRCodeW

Icon draws img in the center (use level "H" so the code stays readable).

func (*QRCodeW) IconSize 实验性 ​

go
func (q *QRCodeW) IconSize(px float32) *QRCodeW

IconSize sets the center icon size (default 40).

func (*QRCodeW) Level 实验性 ​

go
func (q *QRCodeW) Level(l string) *QRCodeW

Level sets the error-correction level: "L", "M", "Q" or "H".

func (*QRCodeW) MarginSize 实验性 ​

go
func (q *QRCodeW) MarginSize(n int) *QRCodeW

MarginSize adds a quiet zone of n modules around the code (Ant marginSize, default 0).

func (*QRCodeW) Matrix 实验性 ​

go
func (q *QRCodeW) Matrix() *QRMatrix

Matrix returns the encoded matrix (nil if encoding failed).

func (*QRCodeW) Refreshed 实验性 ​

go
func (q *QRCodeW) Refreshed() bool

Refreshed reports a click on the "点击刷新" action of an expired code.

func (*QRCodeW) Size 实验性 ​

go
func (q *QRCodeW) Size(px float32) *QRCodeW

Size sets the outer size in px.

func (*QRCodeW) Status 实验性 ​

go
func (q *QRCodeW) Status(s string) *QRCodeW

Status sets "active" (default), "expired", "loading" or "scanned".

QRLevel 实验性 ​

go
type QRLevel uint8

QRLevel is the error-correction level.

Append-only: never reorder or insert; the zero value stays QRLevelL.

go
const (
	QRLevelL QRLevel = iota // ~7% recovery
	QRLevelM                // ~15%
	QRLevelQ                // ~25%
	QRLevelH                // ~30%
)

实验性

func ParseQRLevel 实验性 ​

go
func ParseQRLevel(s string) QRLevel

ParseQRLevel maps "L","M","Q","H" (any case) to a level; unknown → M.

QRMatrix 实验性 ​

go
type QRMatrix struct {
	Version int
	Level   QRLevel
	Mask    int
	Size    int
	// contains filtered or unexported fields
}

QRMatrix is an encoded symbol without quiet zone. Dark(x, y) reports a dark module at column x, row y.

func EncodeQR 实验性 ​

go
func EncodeQR(s string, level QRLevel) (*QRMatrix, error)

EncodeQR encodes text at the smallest version that fits level. Digits use numeric mode, [0-9A-Z $%*+-./:] alphanumeric mode, anything else UTF-8 bytes.

func (*QRMatrix) Dark 实验性 ​

go
func (m *QRMatrix) Dark(x, y int) bool

Dark reports whether module (x, y) is dark. Out of range is light.

QueryFilterW 实验性 ​

go
type QueryFilterW struct {
	// contains filtered or unexported fields
}

QueryFilterW is a collapsible query form (Ant Design Pro QueryFilter): fields flow in 1–4 columns by width with the buttons in the last cell; beyond the first row they fold behind an expand link. ProTable uses it for its search form.

q := ui.QueryFilter(c, fields).Values(&query).Show()
if q.Searched() { reload(q.Params()) }

func QueryFilter 实验性 ​

go
func QueryFilter(c *Context, fields []ProField) *QueryFilterW

QueryFilter starts a query form over fields; chain options, then Show.

ConfigProvider.Defaults("QueryFilter", ...) keys: "labelWidth" (number), "defaultCollapsed" (bool, false = start expanded), "searchText", "resetText" (string).

func (*QueryFilterW) DefaultExpanded 实验性 ​

go
func (q *QueryFilterW) DefaultExpanded() *QueryFilterW

DefaultExpanded starts with every field shown.

func (*QueryFilterW) ID 实验性 ​

go
func (q *QueryFilterW) ID() ID

ID returns the widget ID (valid after Show).

func (*QueryFilterW) LabelWidth 实验性 ​

go
func (q *QueryFilterW) LabelWidth(px float32) *QueryFilterW

LabelWidth sets the label width (default 80).

func (*QueryFilterW) Loading 实验性 ​

go
func (q *QueryFilterW) Loading(on bool) *QueryFilterW

Loading spins the search button.

func (*QueryFilterW) Params 实验性 ​

go
func (q *QueryFilterW) Params() map[string]string

Params returns the non-empty values as text (dates as 2006-01-02).

func (*QueryFilterW) ResetClicked 实验性 ​

go
func (q *QueryFilterW) ResetClicked() bool

ResetClicked reports a reset in the last Show.

func (*QueryFilterW) ResetText 实验性 ​

go
func (q *QueryFilterW) ResetText(s string) *QueryFilterW

ResetText sets the reset button's text.

func (*QueryFilterW) SearchText 实验性 ​

go
func (q *QueryFilterW) SearchText(s string) *QueryFilterW

SearchText sets the search button's text.

func (*QueryFilterW) Searched 实验性 ​

go
func (q *QueryFilterW) Searched() bool

Searched reports a search (or a reset, which searches again) in the last Show.

func (*QueryFilterW) Show 实验性 ​

go
func (q *QueryFilterW) Show() *QueryFilterW

Show builds the query form.

func (*QueryFilterW) Values 实验性 ​

go
func (q *QueryFilterW) Values(v *ProValues) *QueryFilterW

Values binds the values (otherwise the filter keeps its own).

RadioGroupW ​

go
type RadioGroupW struct {
	// contains filtered or unexported fields
}

RadioGroupW is a group of mutually exclusive options.

func RadioGroup ​

go
func RadioGroup(c *Context, val *string, opts []Option) *RadioGroupW

RadioGroup adds radio options bound to *val.

func (*RadioGroupW) A11yLabel ​

go
func (g *RadioGroupW) A11yLabel(s string) *RadioGroupW

A11yLabel names the group for screen readers (inside a FormItem the item label is used).

func (*RadioGroupW) Block ​

go
func (g *RadioGroupW) Block() *RadioGroupW

Block stretches the group to the full width and shares it equally among the options (antd block, typically with Buttons).

func (*RadioGroupW) Border ​

go
func (g *RadioGroupW) Border() *RadioGroupW

Border draws each radio with a frame (see RadioW.Border); it has no effect on the button style.

func (*RadioGroupW) Buttons ​

go
func (g *RadioGroupW) Buttons() *RadioGroupW

Buttons renders the group as segmented buttons.

func (*RadioGroupW) Changed ​

go
func (g *RadioGroupW) Changed() bool

Changed reports a selection change this frame.

func (*RadioGroupW) Disabled ​

go
func (g *RadioGroupW) Disabled(on bool) *RadioGroupW

Disabled disables every option of the group (radios or buttons).

func (*RadioGroupW) Orientation ​

go
func (g *RadioGroupW) Orientation(o string) *RadioGroupW

Orientation sets the direction of the options: "horizontal" (default) or "vertical" (antd 6 orientation). Other values are ignored.

func (*RadioGroupW) Size ​

go
func (g *RadioGroupW) Size(s ControlSize) *RadioGroupW

Size sets the size of the buttons (and of the radios: label font and Border height).

func (*RadioGroupW) Solid ​

go
func (g *RadioGroupW) Solid() *RadioGroupW

Solid fills the selected button with the primary color.

func (*RadioGroupW) Vertical ​

go
func (g *RadioGroupW) Vertical() *RadioGroupW

Vertical stacks the options in a column (antd 6 vertical); buttons join top to bottom.

RadioW ​

go
type RadioW struct {
	// contains filtered or unexported fields
}

RadioW is a single radio button.

func Radio ​

go
func Radio(c *Context, label string, checked bool) *RadioW

Radio adds a radio button; it reports Clicked so the caller can select it.

func (*RadioW) Border ​

go
func (w *RadioW) Border() *RadioW

Border draws a frame around the circle and the label (Element el-radio border); a checked one gets a brand-colored frame.

func (*RadioW) Clicked ​

go
func (w *RadioW) Clicked() bool

Clicked reports activation.

func (*RadioW) Disabled ​

go
func (w *RadioW) Disabled(on bool) *RadioW

func (*RadioW) Size ​

go
func (w *RadioW) Size(s ControlSize) *RadioW

Size sets the radio size: the label font and the height of the Border style.

func (*RadioW) Status ​

go
func (w *RadioW) Status(s string) *RadioW

Status sets the validation status ("error" marks the radio invalid).

RangePickerW 实验性 ​

go
type RangePickerW struct {
	// contains filtered or unexported fields
}

RangePickerW selects a date range in two adjacent month panels.

func RangePicker 实验性 ​

go
func RangePicker(c *Context, val *[2]time.Time) *RangePickerW

RangePicker adds a date range input bound to *val ([start, end], zero = empty). The first click picks one end, the second click the other; the result is ordered. Picker switches to week, month, quarter or year ranges. Each end can also be typed: printable keys edit the active end in place; Enter (or leaving the field) applies valid text, invalid text is dropped.

func (*RangePickerW) A11yLabel 实验性 ​

go
func (w *RangePickerW) A11yLabel(s string) *RangePickerW

A11yLabel sets the accessible name (inside a FormItem the item label is used; otherwise the two placeholders).

func (*RangePickerW) AllowClear 实验性 ​

go
func (w *RangePickerW) AllowClear(on bool) *RangePickerW

func (*RangePickerW) Changed 实验性 ​

go
func (w *RangePickerW) Changed() bool

Changed reports a committed range this frame.

func (*RangePickerW) Disabled 实验性 ​

go
func (w *RangePickerW) Disabled(on bool) *RangePickerW

Disabled disables the picker.

func (*RangePickerW) DisabledDate 实验性 ​

go
func (w *RangePickerW) DisabledDate(fn func(time.Time) bool) *RangePickerW

DisabledDate marks days that cannot be picked.

func (*RangePickerW) DisabledTime 实验性 ​

go
func (w *RangePickerW) DisabledTime(fn func(day time.Time, end bool) DisabledTimes) *RangePickerW

DisabledTime disables hours, minutes and seconds per day in the ShowTime columns (Ant disabledTime with type "start" / "end"): fn receives the drafted day of an end (UTC midnight) and end=false for the start, true for the end. A range with a disabled clock cannot be confirmed.

func (*RangePickerW) Format 实验性 ​

go
func (w *RangePickerW) Format(f string) *RangePickerW

func (*RangePickerW) IsOpen 实验性 ​

go
func (w *RangePickerW) IsOpen() bool

IsOpen reports whether the panels are shown.

func (*RangePickerW) Layout 实验性 ​

go
func (w *RangePickerW) Layout(o ...layout.Option) *RangePickerW

func (*RangePickerW) MaxDate 实验性 ​

go
func (w *RangePickerW) MaxDate(t time.Time) *RangePickerW

MaxDate limits the pickable dates (Ant maxDate), like MinDate.

func (*RangePickerW) MinDate 实验性 ​

go
func (w *RangePickerW) MinDate(t time.Time) *RangePickerW

MinDate limits the pickable dates (Ant minDate): periods wholly before t cannot be picked or typed, and the panel arrows stop at t's page.

func (*RangePickerW) Open 实验性 ​

go
func (w *RangePickerW) Open() *RangePickerW

Open forces the panels open (screenshots, tests).

func (*RangePickerW) Order 实验性 ​

go
func (w *RangePickerW) Order(on bool) *RangePickerW

Order toggles sorting the two ends (Ant order, on by default). With Order(false) the first pick is the start and the second the end, even when the end comes earlier.

func (*RangePickerW) Picker 实验性 ​

go
func (w *RangePickerW) Picker(p PickerType) *RangePickerW

Picker sets the granularity of both ends: PickerDate (default), PickerWeek, PickerMonth, PickerQuarter or PickerYear (Ant picker, Element type="monthrange" / "yearrange"). Ends are the first days of their periods (UTC midnights, like DatePicker with Picker); ShowTime is ignored.

func (*RangePickerW) Placeholder 实验性 ​

go
func (w *RangePickerW) Placeholder(start, end string) *RangePickerW

func (*RangePickerW) Placement 实验性 ​

go
func (w *RangePickerW) Placement(p Placement) *RangePickerW

Placement sets where the panels open: BottomStart (default), BottomEnd, TopStart or TopEnd (Ant placement); they flip when there is no room.

func (*RangePickerW) Presets 实验性 ​

go
func (w *RangePickerW) Presets(p ...DatePreset) *RangePickerW

func (*RangePickerW) Separator 实验性 ​

go
func (w *RangePickerW) Separator(s string) *RangePickerW

Separator sets the text between the two ends (Ant separator; default the Locale's RangeSeparator).

func (*RangePickerW) ShowTime 实验性 ​

go
func (w *RangePickerW) ShowTime() *RangePickerW

ShowTime adds start / end time columns under the month panels and an OK button (Ant RangePicker showTime, Element type="datetimerange"): days and times are drafts until OK (or Enter on the picked end day) commits. The default format becomes "2006-01-02 15:04:05"; a format without seconds hides the second columns.

func (*RangePickerW) Size 实验性 ​

go
func (w *RangePickerW) Size(s ControlSize) *RangePickerW

func (*RangePickerW) Status 实验性 ​

go
func (w *RangePickerW) Status(s string) *RangePickerW

func (*RangePickerW) Variant 实验性 ​

go
func (w *RangePickerW) Variant(v string) *RangePickerW

Variant sets the frame look: "outlined" (default), "filled", "borderless" or "underlined".

func (*RangePickerW) Width 实验性 ​

go
func (w *RangePickerW) Width(px float32) *RangePickerW

RateW ​

go
type RateW struct {
	// contains filtered or unexported fields
}

RateW is a star rating (Ant Rate / Element el-rate).

func Rate ​

go
func Rate(c *Context, val *float64) *RateW

Rate adds a rating bound to *val (0..count, steps of 1 or 0.5).

func (*RateW) A11yLabel ​

go
func (w *RateW) A11yLabel(s string) *RateW

A11yLabel sets the accessible name (default: the Locale's "rating"; inside a FormItem the item label is used).

func (*RateW) AllowClear ​

go
func (w *RateW) AllowClear(on bool) *RateW

AllowClear lets a click on the current value reset it to 0 (default on).

func (*RateW) AllowHalf ​

go
func (w *RateW) AllowHalf() *RateW

AllowHalf enables half-star values.

func (*RateW) Changed ​

go
func (w *RateW) Changed() bool

Changed reports a new value this frame.

func (*RateW) Character ​

go
func (w *RateW) Character(s string) *RateW

Character replaces the star with a text character (e.g. "A", "好").

func (*RateW) CharacterFunc ​

go
func (w *RateW) CharacterFunc(fn func(i int) string) *RateW

CharacterFunc draws the character fn returns for star i (0-based; Ant character as a function of the index).

func (*RateW) Color ​

go
func (w *RateW) Color(col theme.Color) *RateW

Color overrides the active color.

func (*RateW) Colors ​

go
func (w *RateW) Colors(cols ...theme.Color) *RateW

Colors sets the active color by the value (Element colors): a value at or below the low threshold uses the first color, below the high threshold the second, from it on the third. One color applies to every value; Color overrides them all.

func (*RateW) Count ​

go
func (w *RateW) Count(n int) *RateW

Count sets the number of stars (default 5).

func (*RateW) Disabled ​

go
func (w *RateW) Disabled(on bool) *RateW

Disabled makes the rating read-only.

func (*RateW) Hovered ​

go
func (w *RateW) Hovered() float64

Hovered returns the value previewed under the pointer (0 = none).

func (*RateW) Icons ​

go
func (w *RateW) Icons(on, void *icon.Icon) *RateW

Icons replaces the star icons: on for the filled part, void for the empty one (Element icons / void-icon; nil keeps the star).

func (*RateW) Keyboard ​

go
func (w *RateW) Keyboard(on bool) *RateW

Keyboard enables or disables the arrow / Home / End keys (Ant keyboard, default on).

func (*RateW) Large ​

go
func (w *RateW) Large() *RateW

Large uses the large star size (Ant size="large": 25px; Element keeps 18px in a 40px row).

func (*RateW) ScoreFormat ​

go
func (w *RateW) ScoreFormat(fn func(v float64) string) *RateW

ScoreFormat formats the score of ShowScore (Element score-template; by default the bare number).

func (*RateW) ShowScore ​

go
func (w *RateW) ShowScore() *RateW

ShowScore shows the numeric value after the stars.

func (*RateW) Size ​

go
func (w *RateW) Size(px float32) *RateW

Size sets the star size in px (Ant 20, Element 18).

func (*RateW) Small ​

go
func (w *RateW) Small() *RateW

Small uses the small star size (Ant size="small": 15px; Element 14px).

func (*RateW) Texts ​

go
func (w *RateW) Texts(t ...string) *RateW

Texts shows a description after the stars, one per star (Element show-text).

func (*RateW) Thresholds ​

go
func (w *RateW) Thresholds(low, high float64) *RateW

Thresholds sets the values that switch Colors (Element low-threshold / high-threshold; default 2 and 4).

func (*RateW) Tooltips ​

go
func (w *RateW) Tooltips(tips ...string) *RateW

Tooltips shows a tooltip over the star under the pointer, one text per star (Ant tooltips); "" entries show none.

func (*RateW) VoidColor ​

go
func (w *RateW) VoidColor(col theme.Color) *RateW

VoidColor sets the color of the empty stars (Element void-color / disabled-void-color).

ResultW ​

go
type ResultW struct {
	// contains filtered or unexported fields
}

ResultW is a result page: a status icon or illustration, a title, a subtitle, actions (Extra) and optional content (Body).

func Result ​

go
func Result(c *Context, status, title string) *ResultW

Result starts a result page; set options, then call Show or Body.

func (*ResultW) Body ​

go
func (w *ResultW) Body(fn func()) *Box

Body builds the result; fn (optional) fills the grey content panel below the actions (Ant) or the bottom slot (Element).

func (*ResultW) Extra ​

go
func (w *ResultW) Extra(fn func()) *ResultW

Extra builds the action area (usually buttons).

func (*ResultW) Icon ​

go
func (w *ResultW) Icon(fn func()) *ResultW

Icon replaces the status icon with custom content.

func (*ResultW) Show ​

go
func (w *ResultW) Show() *Box

Show builds the result without extra content.

func (*ResultW) SubTitle ​

go
func (w *ResultW) SubTitle(s string) *ResultW

SubTitle sets the secondary text below the title.

RichTextW 实验性 ​

go
type RichTextW struct {
	// contains filtered or unexported fields
}

RichTextW is a paragraph of spans.

func RichText 实验性 ​

go
func RichText(c *Context, spans ...Span) *RichTextW

RichText adds a wrapping paragraph made of spans.

ui.RichText(c, ui.Span{Text: "普通、"}, ui.Span{Text: "加粗", Bold: true}, ui.Span{Text: "链接", Link: "https://…"})

func (*RichTextW) Align 实验性 ​

go
func (w *RichTextW) Align(a TextAlign) *RichTextW

Align aligns lines inside the paragraph box.

go
func (w *RichTextW) ClickedLink() string

ClickedLink returns the URL of a link clicked this frame ("" if none).

func (*RichTextW) Color 实验性 ​

go
func (w *RichTextW) Color(col theme.Color) *RichTextW

Color sets the default text color.

go
func (w *RichTextW) HoveredLink() string

HoveredLink returns the URL under the pointer ("" if none).

func (*RichTextW) ID 实验性 ​

go
func (w *RichTextW) ID() ID

ID returns the paragraph's widget ID.

func (*RichTextW) Layout 实验性 ​

go
func (w *RichTextW) Layout(opts ...layout.Option) *RichTextW

Layout applies layout options.

func (*RichTextW) Pre 实验性 ​

go
func (w *RichTextW) Pre() *RichTextW

Pre keeps spaces and tabs and only breaks at newlines or when a line is too long (code blocks).

func (*RichTextW) Selectable 实验性 ​

go
func (w *RichTextW) Selectable() *RichTextW

Selectable lets the user select the text with the pointer (double click selects a word, triple click the paragraph) and copy it with Cmd/Ctrl+C; Cmd/Ctrl+A selects the whole paragraph while it has focus.

func (*RichTextW) Selection 实验性 ​

go
func (w *RichTextW) Selection() string

Selection returns the selected text ("" if none).

func (*RichTextW) Size 实验性 ​

go
func (w *RichTextW) Size(px float32) *RichTextW

Size sets the base font size.

RouteInfo 实验性 ​

go
type RouteInfo struct {
	InLayout        bool             // built inside a ProLayout content area
	Layout          string           // "side", "top" or "mix"
	Collapsed       bool             // sider collapsed
	IsMobile        bool             // window narrower than MD
	HasSiderMenu    bool             // side and mix layouts
	Breadcrumb      []string         // the shell's breadcrumb
	BreadcrumbItems []BreadcrumbItem // structured route breadcrumb, including navigation callbacks
	PageTitle       string
	Selected        string // selected menu key
	ContentWidth    string // "Fluid" or "Fixed"
	FixedHeader     bool
	FixSiderbar     bool // the sider stays while the content scrolls
}

RouteInfo is the shell state seen by the content of a ProLayout.

func RouteContext 实验性 ​

go
func RouteContext(c *Context) RouteInfo

RouteContext returns the state of the innermost ProLayout being built around the caller.

RowEditorTableW 实验性 ​

go
type RowEditorTableW[T any] struct {
	// contains filtered or unexported fields
}

RowEditorTableW is an editable table that edits one whole row at a time (Pro Components v3 RowEditorTable): double-click a row (or press Enter on one of its cells) to edit every editable cell of it; Enter or moving focus out of the row validates all of its editors and saves, Escape cancels and drops the drafts (a new row is removed). It is an EditableProTable preset, bordered and without pagination by default.

func RowEditorTable 实验性 ​

go
func RowEditorTable[T any](c *Context, cols []ProColumn[T], rows *[]T) *RowEditorTableW[T]

RowEditorTable starts a row-editing table over *rows; chain options, then Show.

ConfigProvider.Defaults("RowEditorTable", ...) keys: "bordered" (bool, default true), "size", "pagination" (page size or Props{"pageSize": n}; default none).

func (*RowEditorTableW[T]) AddAtTop 实验性 ​

go
func (w *RowEditorTableW[T]) AddAtTop() *RowEditorTableW[T]

AddAtTop puts new rows (and the add button) above the data.

func (*RowEditorTableW[T]) AddRow 实验性 ​

go
func (w *RowEditorTableW[T]) AddRow() string

AddRow adds a new draft row in edit mode and returns its key ("" when NewRow is not set or another row is being edited).

func (*RowEditorTableW[T]) Bordered 实验性 ​

go
func (w *RowEditorTableW[T]) Bordered(on bool) *RowEditorTableW[T]

Bordered turns the cell borders on or off (default on).

func (*RowEditorTableW[T]) Cancel 实验性 ​

go
func (w *RowEditorTableW[T]) Cancel()

Cancel leaves row editing without saving (as Escape does).

func (*RowEditorTableW[T]) Changed 实验性 ​

go
func (w *RowEditorTableW[T]) Changed() bool

Changed reports a change of *rows in the last Show.

func (*RowEditorTableW[T]) Edit 实验性 ​

go
func (w *RowEditorTableW[T]) Edit(k string)

Edit starts editing the row with key k (valid after Show).

func (*RowEditorTableW[T]) EditingKey 实验性 ​

go
func (w *RowEditorTableW[T]) EditingKey() string

EditingKey returns the key of the edited row ("" when none).

func (*RowEditorTableW[T]) Errors 实验性 ​

go
func (w *RowEditorTableW[T]) Errors(k string) map[string]string

Errors returns the validation messages of row k by column key.

func (*RowEditorTableW[T]) ID 实验性 ​

go
func (w *RowEditorTableW[T]) ID() ID

ID returns the widget ID (valid after Show).

func (*RowEditorTableW[T]) MaxLength 实验性 ​

go
func (w *RowEditorTableW[T]) MaxLength(n int) *RowEditorTableW[T]

MaxLength hides the add button once there are n rows.

func (*RowEditorTableW[T]) NewRow 实验性 ​

go
func (w *RowEditorTableW[T]) NewRow(fn func() T) *RowEditorTableW[T]

NewRow shows the "add a row" button (see EditableProTableW.NewRow); the new row opens in edit mode with focus in its first editor.

func (*RowEditorTableW[T]) OnSave 实验性 ​

go
func (w *RowEditorTableW[T]) OnSave(fn func(row T, index int, done func(error))) *RowEditorTableW[T]

OnSave receives a validated row (index -1 for a new row) before it is written back (see EditableProTableW.OnSave).

func (*RowEditorTableW[T]) Pagination 实验性 ​

go
func (w *RowEditorTableW[T]) Pagination(n int) *RowEditorTableW[T]

Pagination pages the rows locally, n per page (default: no pagination).

func (*RowEditorTableW[T]) RowEditable 实验性 ​

go
func (w *RowEditorTableW[T]) RowEditable(fn func(row T) bool) *RowEditorTableW[T]

RowEditable limits which rows can be edited.

func (*RowEditorTableW[T]) RowKey 实验性 ​

go
func (w *RowEditorTableW[T]) RowKey(f func(T) string) *RowEditorTableW[T]

RowKey gives rows stable keys (default: the row index).

func (*RowEditorTableW[T]) Save 实验性 ​

go
func (w *RowEditorTableW[T]) Save()

Save validates the edited row and saves it (as Enter does).

func (*RowEditorTableW[T]) Saved 实验性 ​

go
func (w *RowEditorTableW[T]) Saved() bool

Saved reports a row written back in the last Show.

func (*RowEditorTableW[T]) ScrollX 实验性 ​

go
func (w *RowEditorTableW[T]) ScrollX(px float32) *RowEditorTableW[T]

ScrollX sets the table's scroll width.

func (*RowEditorTableW[T]) ScrollY 实验性 ​

go
func (w *RowEditorTableW[T]) ScrollY(maxH float32) *RowEditorTableW[T]

ScrollY bounds the table body to maxH (EditableProTableW.ScrollY): only the visible rows are built. The edited row is always built, even scrolled out of view, so its draft and focus survive; starting to edit it (Edit), focus moving into it (Tab), typing in it and a failed validation scroll it into view. Default 0: unbounded, every row is built.

func (*RowEditorTableW[T]) Show 实验性 ​

go
func (w *RowEditorTableW[T]) Show() *RowEditorTableW[T]

Show builds the table.

func (*RowEditorTableW[T]) Size 实验性 ​

go
func (w *RowEditorTableW[T]) Size(s ControlSize) *RowEditorTableW[T]

Size sets the density.

func (*RowEditorTableW[T]) Table 实验性 ​

go
func (w *RowEditorTableW[T]) Table() *TableW

Table returns the inner table of the last Show.

func (*RowEditorTableW[T]) Title 实验性 ​

go
func (w *RowEditorTableW[T]) Title(s string) *RowEditorTableW[T]

Title sets the toolbar title.

func (*RowEditorTableW[T]) ToolBar 实验性 ​

go
func (w *RowEditorTableW[T]) ToolBar(fn func()) *RowEditorTableW[T]

ToolBar adds actions at the right of the toolbar.

func (*RowEditorTableW[T]) Validating 实验性 ​

go
func (w *RowEditorTableW[T]) Validating(k string) bool

Validating reports async validation or a save in flight for row k.

func (*RowEditorTableW[T]) Virtual 实验性 ​

go
func (w *RowEditorTableW[T]) Virtual() *RowEditorTableW[T]

Virtual is TableW.Virtual for the inner table (see EditableProTableW.Virtual): with ScrollY the body is windowed either way; rows keep the height of the density (Size) unless the theme has a Table V2 row height (Element Plus).

RowStyle 实验性 ​

go
type RowStyle struct {

	// Status tints the row with a palette background ("success",
	// "warning", "error", "info", "processing"), like Element Plus'
	// success-row / warning-row classes.
	Status string
	// Bg sets the row background (wins over Status).
	Bg theme.Color
	// Text colors the text of plain (Text) cells; Render cells style
	// their own widgets.
	Text theme.Color
	// Bold draws plain cell text in medium weight.
	Bold bool
}

RowStyle styles one body row (RowClass). Zero fields keep the default look; hover, selection and the current-row highlight still win over Bg.

Rule ​

go
type Rule struct {
	// contains filtered or unexported fields
}

Rule validates a form value; build rules with Required, MinLen, MaxLen, Pattern, Email, Match, Check or AsyncCheck.

func AsyncCheck 实验性 ​

go
func AsyncCheck(fn func(v string, done func(msg string))) Rule

AsyncCheck validates asynchronously (a server lookup): fn starts the check and calls done (from any goroutine) with an error message or "". It runs after the synchronous rules pass, once per value; the item shows a "validating" hint meanwhile.

func Check ​

go
func Check(fn func(v string) string) Rule

Check wraps a custom validator returning an error message or "".

func Email ​

go
func Email(msg string) Rule

Email checks a simple e-mail shape.

func Match ​

go
func Match(other *string, msg string) Rule

Match fails when the value differs from *other (confirm password). Give the item Dependencies(otherName) to re-check when the other field changes.

func MaxLen ​

go
func MaxLen(n int, msg string) Rule

MaxLen fails when the value has more than n characters.

func MinLen ​

go
func MinLen(n int, msg string) Rule

MinLen fails when the value has fewer than n characters (empty passes; combine with Required).

func Pattern ​

go
func Pattern(re string, msg string) Rule

Pattern fails when a non-empty value does not match re.

func Required ​

go
func Required(msg string) Rule

Required fails on an empty value.

func (Rule) Warning ​

go
func (r Rule) Warning() Rule

Warning turns the rule into a warning: a failing value shows the message in the warning color and status, but Validate still passes (Ant rule warningOnly).

RuleOf 实验性 ​

go
type RuleOf[T any] struct {
	// contains filtered or unexported fields
}

RuleOf validates a form value of type T; build them with RequiredValue, MinValue, MaxValue, RangeValue, RequiredItems, MinItems, MaxItems, MustBeTrue or CheckValue, and attach them with RulesOf.

func CheckValue 实验性 ​

go
func CheckValue[T any](fn func(v T) string) RuleOf[T]

CheckValue wraps a custom validator returning an error message or "".

func MaxItems 实验性 ​

go
func MaxItems[E any](n int, msg string) RuleOf[[]E]

MaxItems fails when the slice has more than n elements.

func MaxValue 实验性 ​

go
func MaxValue[T cmp.Ordered](hi T, msg string) RuleOf[T]

MaxValue fails when the value is above hi.

func MinItems 实验性 ​

go
func MinItems[E any](n int, msg string) RuleOf[[]E]

MinItems fails when a non-empty slice has fewer than n elements (combine with RequiredItems).

func MinValue 实验性 ​

go
func MinValue[T cmp.Ordered](lo T, msg string) RuleOf[T]

MinValue fails when the value is below lo.

func MustBeTrue 实验性 ​

go
func MustBeTrue(msg string) RuleOf[bool]

MustBeTrue fails unless the value is true ("I agree to the terms"); the item shows the required mark.

func RangeValue 实验性 ​

go
func RangeValue[T cmp.Ordered](lo, hi T, msg string) RuleOf[T]

RangeValue fails outside [lo, hi].

func RequiredItems 实验性 ​

go
func RequiredItems[E any](msg string) RuleOf[[]E]

RequiredItems fails on an empty slice (checkbox group, multi-select, upload list).

func RequiredValue 实验性 ​

go
func RequiredValue[T comparable](msg string) RuleOf[T]

RequiredValue fails on the zero value (0, false, "", nil).

func (RuleOf[T]) Warning 实验性 ​

go
func (r RuleOf[T]) Warning() RuleOf[T]

Warning turns the rule into a warning (see Rule.Warning).

Runner ​

go
type Runner struct {
	// contains filtered or unexported fields
}

Runner drives one window: it queues input, runs the page function, lays out, paints and presents. All methods except Invalidate, Post and Close must be called on the UI thread. Invalidate and Close are safe from any goroutine; so is Post when a thread is bound or the window implements UIPoster, while on a headless runner (neither) Post runs fn inline on the caller, which must then be on the UI thread. The UI thread is the one bound with BindThread, or the host's main thread when none is bound. Development builds (-tags tango_dev) panic when a bound runner is used off its thread.

With uihost.Open, uihost.Attach and tan dev, the UI thread is the app's main thread. Dedicated macOS UI threads are currently used only for internal testing. A headless Driver runs on the caller's thread. Use Post to update page state or call Runner methods from a background goroutine. The thread checks cover Runner and Context state on bound runners.

只有部分成员是稳定的:未标「实验性」的方法和全部字段受兼容性承诺约束。

func NewRunner ​

go
func NewRunner(page func(*Context), o RunnerOptions) *Runner

NewRunner creates a runner for page. Call Attach before Frame.

func Open 实验性 ​

go
func Open(h Host, opts WindowOptions, page func(*Context), ropts RunnerOptions) (*Runner, error)

Open creates a Runner for page and asks host to put it in a window.

func (*Runner) AccessibilityTree 实验性 ​

go
func (r *Runner) AccessibilityTree() *a11y.Tree

AccessibilityTree returns the semantics tree of the last frame, or nil when accessibility is off.

func (*Runner) Animating ​

go
func (r *Runner) Animating() bool

Animating reports whether the last frame had running transitions.

func (*Runner) Attach ​

go
func (r *Runner) Attach(w Window)

Attach binds the runner to its window.

func (*Runner) BindThread 实验性 ​

go
func (r *Runner) BindThread(t *uithread.Thread)

BindThread makes t the runner's UI thread: Post queues work there and, in development builds, the UI-thread entry points panic when called from elsewhere. Call it once, before Attach; only the host can end the binding (corehook.ReturnRunnerToMain, when it hands the window back to its main thread), never bind it again. Experimental: used by the platform host (uihost).

func (*Runner) ClearKeyboardInset ​

go
func (r *Runner) ClearKeyboardInset()

ClearKeyboardInset removes the SetKeyboardInset override. UI thread.

func (*Runner) ClearSafeArea ​

go
func (r *Runner) ClearSafeArea()

ClearSafeArea removes the SetSafeArea override.

func (*Runner) Close ​

go
func (r *Runner) Close()

Close releases resources. It may be called from any goroutine.

func (*Runner) Composing 实验性 ​

go
func (r *Runner) Composing() bool

Composing reports whether an input method is composing (a non-empty input.Composition has not been committed or cancelled yet) as of the latest frame. A host whose main thread decides on keys without the UI thread (window shortcuts) reads it after Frame.

Experimental: used by the platform host (uihost).

func (*Runner) Context ​

go
func (r *Runner) Context() *Context

Context exposes the context (tests, advanced integrations).

func (*Runner) DragRegions 实验性 ​

go
func (r *Runner) DragRegions() []geom.Rect

DragRegions returns the parts of the window, in window logical pixels, where a primary-button press in the latest frame lands on a self-drawn TitleBar's drag area (not on a control inside it or on anything drawn above it) and so would move the window. Only title bars that act on the runner's own window (no TitleBarW.Frame, not Manual) count, and the list is empty while any layer (Overlay) is open, since a press then may first have to close it. Call it after Frame; it allocates a new slice.

Experimental: used by the platform host (uihost), which may start the move itself on the main thread.

func (*Runner) DropFiles 实验性 ​

go
func (r *Runner) DropFiles(p geom.Point, paths []string)

DropFiles delivers files dropped at p (window logical pixels) to the DropZone under it: its Dropped returns them during the next frame. Files dropped outside every zone are discarded. UI thread only.

func (*Runner) EnableAccessibility 实验性 ​

go
func (r *Runner) EnableAccessibility(on bool)

EnableAccessibility builds the semantics tree every frame even when the window is not an AccessibilityHost (or reports it disabled): tests, automation and hosts that enable it explicitly. Off again leaves the decision to the host.

func (*Runner) FileDrag 实验性 ​

go
func (r *Runner) FileDrag() (geom.Point, bool)

FileDrag returns the position of a file drag in host window logical pixels.

func (*Runner) FileDragLeave 实验性 ​

go
func (r *Runner) FileDragLeave()

FileDragLeave reports that the file drag left the window, was cancelled or was dropped (hosts call it before DropFiles).

func (*Runner) FileDragOver 实验性 ​

go
func (r *Runner) FileDragOver(p geom.Point)

FileDragOver reports files dragged over the window at p (window logical pixels), when the drag enters and as it moves. Hosts call it on the UI thread (uihost does from platform.CanvasDropTarget).

func (*Runner) Frame ​

go
func (r *Runner) Frame() error

Frame processes queued input, rebuilds the UI and presents it.

func (*Runner) FrameMetrics 实验性 ​

go
func (r *Runner) FrameMetrics() (size geom.Size, scale float32)

FrameMetrics returns the viewport and effective device-pixel scale to use when rendering List again, for example to capture a screenshot.

func (*Runner) HandleEvent ​

go
func (r *Runner) HandleEvent(e input.Event)

HandleEvent queues an input event and requests a frame.

func (*Runner) Invalidate ​

go
func (r *Runner) Invalidate()

Invalidate requests a frame. It is safe to call from any goroutine (it only forwards to Window.Invalidate, which hosts must make thread-safe); the frame itself still runs on the UI thread.

func (*Runner) List ​

go
func (r *Runner) List() *paint.List

List returns the display list in UI logical pixels (debugging, GPU hosts). FrameMetrics gives the parameters for rendering it.

func (*Runner) NativeRegions 实验性 ​

go
func (r *Runner) NativeRegions() []NativeRegion

NativeRegions returns the native views of the latest frame in build order (later ones stack above earlier ones). Call it after Frame (or from Window.Present); it allocates a new slice.

func (*Runner) NextWake ​

go
func (r *Runner) NextWake() time.Time

NextWake returns the requested wake time (zero if none).

func (*Runner) PerformAction 实验性 ​

go
func (r *Runner) PerformAction(id a11y.NodeID, act a11y.Action, arg string) error

PerformAction asks the widget behind node id to perform act (from a screen reader, voice control or a test). arg is the new value for SetValue (text, or a number for sliders and spin buttons). The node and action must be in the last reported tree; the action runs at the start of the next frame, which this call requests. It must be called on the UI thread.

func (*Runner) PointerPos 实验性 ​

go
func (r *Runner) PointerPos() (geom.Point, bool)

PointerPos returns the last pointer position in the window and whether the pointer is inside it (hosts placing drops that carry no point).

func (*Runner) Post 实验性 ​

go
func (r *Runner) Post(fn func())

Post runs fn on the UI thread, then requests a frame. It never blocks. On a bound runner (BindThread) fn is queued on that thread; otherwise, when the attached window implements UIPoster, it is queued through PostUI. Either way any goroutine may call Post, and a Post from the page function runs fn after the frame. A headless runner (no bound thread, no UIPoster: Driver, tests) runs fn on the calling goroutine before Post returns, so the caller must be on the UI thread. After Close, fn is dropped, also when it was queued before.

func (*Runner) SetKeyboardInset ​

go
func (r *Runner) SetKeyboardInset(in geom.Insets)

SetKeyboardInset sets the window's soft-keyboard inset (logical pixels), taking precedence over KeyboardInsetWindow, and requests a frame. Hosts that are told about keyboard changes call it instead of implementing KeyboardInsetWindow. UI thread.

func (*Runner) SetReduceMotion ​

go
func (r *Runner) SetReduceMotion(on bool)

SetReduceMotion turns the reduced-motion preference on or off (see RunnerOptions.ReduceMotion) and requests a frame.

func (*Runner) SetSafeArea ​

go
func (r *Runner) SetSafeArea(in geom.Insets)

SetSafeArea sets the window's safe-area insets (logical pixels), taking precedence over SafeAreaWindow, and requests a frame. Hosts that are told about inset changes (iOS safeAreaInsetsDidChange, Android WindowInsets listeners) call it instead of implementing SafeAreaWindow.

func (*Runner) SetTheme ​

go
func (r *Runner) SetTheme(t *theme.Theme)

SetTheme switches the theme and requests a frame.

func (*Runner) SetTouchPointerEmulation 实验性 ​

go
func (r *Runner) SetTouchPointerEmulation(on bool)

SetTouchPointerEmulation turns the pointer events synthesized from the first finger of a touch gesture on (the default) or off. Hosts that already deliver emulated mouse events for touches turn it off.

func (*Runner) SetUIScale 实验性 ​

go
func (r *Runner) SetUIScale(scale float32)

SetUIScale requests a window-wide UI scale for the next frame. A value of 1 is 100%; nonpositive and nonfinite values reset to 1, and other values are clamped to [0.25, 4]. Call on the UI thread.

func (*Runner) TitleBarActed 实验性 ​

go
func (r *Runner) TitleBarActed(p geom.Point, act WindowAction)

TitleBarActed tells the runner that the host itself performed act (WindowActionMaximize or WindowActionRestore) for a double click at p on a TitleBar's drag area (see DragRegions): the next frame's TitleBarW.Action of the bar under p reports act without performing it again. UI thread; it does not request a frame.

Experimental: used by the platform host (uihost).

func (*Runner) TrimCaches 实验性 ​

go
func (r *Runner) TrimCaches()

TrimCaches asks the runner's renderer to discard rebuildable caches and requests another frame. Call on the UI thread, between frames. It does not clear application state, editor LineCaches, current Layouts or the current presented pixels. A renderer without Trim() is left alone.

func (*Runner) UIScale 实验性 ​

go
func (r *Runner) UIScale() float32

UIScale returns the requested UI scale (1 is 100%). Call on the UI thread.

RunnerOptions ​

go
type RunnerOptions struct {
	// UIScale is the initial logical UI scale. Zero defaults to 1.
	UIScale float32
	Theme   *theme.Theme // default theme.AntDesign()
	// Renderer overrides the CPU renderer (GPU backends). When it is not a
	// *paint.CPU the runner calls Window.Present(nil) after rendering.
	Renderer paint.Renderer
	// Clock overrides time.Now (tests, deterministic screenshots).
	Clock func() time.Time
	// NoAnimations makes every transition jump to its end state.
	NoAnimations bool
	// ReduceMotion honours the user's "reduce motion" preference: every
	// transition (Anim, AnimFrom, enter/leave motion, chart growth)
	// jumps to its end value and decorative loops (skeleton shimmer,
	// badge pulse) stand still. Unlike NoAnimations it does not change
	// timers such as hover delays. Hosts that track the OS setting call
	// Runner.SetReduceMotion when it changes.
	ReduceMotion bool
	// Content says what the window mostly shows, which lets the host pick
	// a renderer suited to it (see ContentData). The host reads it once,
	// when the window is created; it is ignored when Renderer or the
	// TANGO_RENDERER environment variable selects a renderer.
	Content ContentKind
}

RunnerOptions configure a Runner.

只有部分成员是稳定的:未标「实验性」的方法和下列以外的字段受兼容性承诺约束。

实验性 实验性成员:UIScale、Renderer、Content

SafeAreaWindow 实验性 ​

go
type SafeAreaWindow interface {
	// SafeAreaInsets returns the distances, in logical pixels, from each
	// edge of the content area to the region that is fully visible and
	// free of system controls.
	SafeAreaInsets() geom.Insets
}

SafeAreaWindow is implemented by windows that know the parts of their content area covered by system UI: the status bar, a display notch or camera cut-out, rounded corners, the home indicator, on-screen navigation buttons. The Runner polls it every frame, like Size.

SchemaFormW 实验性 ​

go
type SchemaFormW struct {
	// contains filtered or unexported fields
}

SchemaFormW renders a form from a field schema in one of the form shells (Ant Design Pro BetaSchemaForm): the same []ProField drives ProForm, ModalForm, DrawerForm, StepsForm, QueryFilter or LightFilter. Nested lists are fields of ValueType ValueFormList with ProField.List.

ui.SchemaForm(c, schema).LayoutType(ui.SchemaLayoutModalForm).
	Open(&open).Title("新建规则").Values(&vals).
	OnFinish(func(v ui.ProValues, done func(error)) { go save(v, done) }).
	Show()

func SchemaForm 实验性 ​

go
func SchemaForm(c *Context, schema []ProField) *SchemaFormW

SchemaForm starts a form over schema; chain options, then Show.

ConfigProvider.Defaults("SchemaForm", ...) keys: "layoutType" (one of the SchemaLayout* names).

func (*SchemaFormW) Columns 实验性 ​

go
func (s *SchemaFormW) Columns(n int) *SchemaFormW

Columns lays the fields out in n grid columns (form shells).

func (*SchemaFormW) Finished 实验性 ​

go
func (s *SchemaFormW) Finished() bool

Finished reports a completed submit of a form shell, once.

func (*SchemaFormW) LayoutType 实验性 ​

go
func (s *SchemaFormW) LayoutType(t SchemaLayoutType) *SchemaFormW

LayoutType selects the form shell (default SchemaLayoutForm).

func (*SchemaFormW) OnFinish 实验性 ​

go
func (s *SchemaFormW) OnFinish(fn func(vals ProValues, done func(error))) *SchemaFormW

OnFinish receives the validated values of the form shells; call done (from any goroutine) when saved.

func (*SchemaFormW) Open 实验性 ​

go
func (s *SchemaFormW) Open(open *bool) *SchemaFormW

Open binds the visibility of ModalForm and DrawerForm.

func (*SchemaFormW) Params 实验性 ​

go
func (s *SchemaFormW) Params() map[string]string

Params returns the filter values as text after a QueryFilter or LightFilter Show (nil for the form shells).

func (*SchemaFormW) Readonly 实验性 ​

go
func (s *SchemaFormW) Readonly(on bool) *SchemaFormW

Readonly shows the values read-only (Form, ModalForm, DrawerForm).

func (*SchemaFormW) Searched 实验性 ​

go
func (s *SchemaFormW) Searched() bool

Searched reports a search of QueryFilter or a change of LightFilter.

func (*SchemaFormW) Show 实验性 ​

go
func (s *SchemaFormW) Show() *SchemaFormW

Show builds the shell.

func (*SchemaFormW) Title 实验性 ​

go
func (s *SchemaFormW) Title(t string) *SchemaFormW

Title sets the dialog title of ModalForm and DrawerForm.

func (*SchemaFormW) Values 实验性 ​

go
func (s *SchemaFormW) Values(v *ProValues) *SchemaFormW

Values binds the values (otherwise the shell keeps its own).

func (*SchemaFormW) Width 实验性 ​

go
func (s *SchemaFormW) Width(px float32) *SchemaFormW

Width sets the dialog / drawer width, or the StepsForm form width.

SchemaLayoutType 实验性 ​

go
type SchemaLayoutType string

SchemaLayoutType selects the form shell of a SchemaForm.

go
const (
	SchemaLayoutForm        SchemaLayoutType = "Form"        // ProForm (default)
	SchemaLayoutModalForm   SchemaLayoutType = "ModalForm"   // ProForm in a Modal (needs Open)
	SchemaLayoutDrawerForm  SchemaLayoutType = "DrawerForm"  // ProForm in a Drawer (needs Open)
	SchemaLayoutStepsForm   SchemaLayoutType = "StepsForm"   // one step per run of fields with the same Group
	SchemaLayoutQueryFilter SchemaLayoutType = "QueryFilter" // query form with search / reset
	SchemaLayoutLightFilter SchemaLayoutType = "LightFilter" // compact filter pills
)

Form shells of SchemaForm.LayoutType.

实验性

ScrollBox ​

go
type ScrollBox struct {
	*Box
	// contains filtered or unexported fields
}

ScrollBox is a scrollable container with overlay scrollbars that appear on hover; drag a thumb to scroll, click the track to jump there, wheel or trackpad anywhere inside.

func Scroll ​

go
func Scroll(c *Context, fn func(), opts ...layout.Option) *ScrollBox

Scroll creates a vertically scrolling column. Give it a bounded height (Grow inside a sized parent, or layout.H/MaxH).

func ScrollH ​

go
func ScrollH(c *Context, fn func(), opts ...layout.Option) *ScrollBox

ScrollH creates a horizontally scrolling row.

func (*ScrollBox) Always ​

go
func (s *ScrollBox) Always() *ScrollBox

Always keeps the scrollbars visible instead of showing them on hover.

func (*ScrollBox) Both ​

go
func (s *ScrollBox) Both() *ScrollBox

Both scrolls on both axes.

func (*ScrollBox) MaxOffset ​

go
func (s *ScrollBox) MaxOffset() (x, y float64)

MaxOffset returns the maximum logical offsets measured by the last paint. Subtract PaintedOffset from it to get the remaining scroll range.

func (*ScrollBox) Offset ​

go
func (s *ScrollBox) Offset() (x, y float64)

Offset returns the scroll offset: the content position at the viewport's top-left corner (top-right in RTL, where x counts from the right end).

func (*ScrollBox) PaintedOffset ​

go
func (s *ScrollBox) PaintedOffset() (x, y float64)

PaintedOffset returns the logical scroll offset used by the last paint. It stays at that position until scheduled scrolling is drawn.

func (*ScrollBox) Reveal ​

go
func (s *ScrollBox) Reveal(y, h float64) *ScrollBox

Reveal scrolls the minimum amount that makes the vertical content range [y, y+h) visible (no-op before the first paint). Use it to keep a keyboard-selected row in view.

func (*ScrollBox) ScrollTo ​

go
func (s *ScrollBox) ScrollTo(x, y float64) *ScrollBox

ScrollTo sets the scroll offset (clamped at paint). x is logical: 0 is the inline start, which is the right end in RTL.

func (*ScrollBox) ScrollToSmooth ​

go
func (s *ScrollBox) ScrollToSmooth(y float32, dur time.Duration) *ScrollBox

ScrollToSmooth animates the vertical offset to y.

SearchW ​

go
type SearchW struct {
	// contains filtered or unexported fields
}

SearchW is an input with a search button (Ant Input.Search, Element input with an append search button).

go
func Search(c *Context, val *string) *SearchW

Search adds a search box bound to *val.

func (*SearchW) A11yLabel ​

go
func (w *SearchW) A11yLabel(s string) *SearchW

A11yLabel sets the accessible name of the search box (inside a FormItem the item label is used; the placeholder is the last resort).

func (*SearchW) AllowClear ​

go
func (w *SearchW) AllowClear() *SearchW

func (*SearchW) Changed ​

go
func (w *SearchW) Changed() bool

Changed reports an edit of the text.

func (*SearchW) Disabled ​

go
func (w *SearchW) Disabled(on bool) *SearchW

func (*SearchW) EnterButton ​

go
func (w *SearchW) EnterButton(s string) *SearchW

EnterButton replaces the icon button with a primary button labelled s.

func (*SearchW) InputID ​

go
func (w *SearchW) InputID() ID

InputID returns the ID of the inner editor (focus it with c.SetFocus).

func (*SearchW) Layout ​

go
func (w *SearchW) Layout(o ...layout.Option) *SearchW

func (*SearchW) Loading ​

go
func (w *SearchW) Loading(on bool) *SearchW

Loading shows a spinner in the button.

func (*SearchW) Placeholder ​

go
func (w *SearchW) Placeholder(s string) *SearchW

func (*SearchW) Searched ​

go
func (w *SearchW) Searched() bool

Searched reports a search request (button click or Enter).

func (*SearchW) Size ​

go
func (w *SearchW) Size(s ControlSize) *SearchW

func (*SearchW) Status ​

go
func (w *SearchW) Status(s string) *SearchW

func (*SearchW) Variant ​

go
func (w *SearchW) Variant(v string) *SearchW

Variant sets the look of the field like InputW.Variant (antd Input.Search variant). ConfigProvider Defaults: "Search" "variant", falling back to "Input".

func (*SearchW) Width ​

go
func (w *SearchW) Width(px float32) *SearchW

SegmentedShape ​

go
type SegmentedShape string

SegmentedShape is the outline of a Segmented control.

go
const (
	SegmentedShapeDefault SegmentedShape = "default" // the control's corner radius
	SegmentedShapeRound   SegmentedShape = "round"   // pill-shaped track and thumb (Ant shape="round")
)

SegmentedW ​

go
type SegmentedW struct {
	// contains filtered or unexported fields
}

SegmentedW is a segmented control (Ant Segmented / Element el-segmented).

func Segmented ​

go
func Segmented(c *Context, val *string, opts []Option) *SegmentedW

Segmented adds a segmented control bound to *val.

func (*SegmentedW) A11yLabel ​

go
func (w *SegmentedW) A11yLabel(s string) *SegmentedW

A11yLabel sets the accessible name of the group (inside a FormItem the item label is used).

func (*SegmentedW) Block ​

go
func (w *SegmentedW) Block() *SegmentedW

Block stretches the control to its container, items share the width.

func (*SegmentedW) Changed ​

go
func (w *SegmentedW) Changed() bool

Changed reports a new selection this frame.

func (*SegmentedW) Disabled ​

go
func (w *SegmentedW) Disabled(on bool) *SegmentedW

Disabled disables every option.

func (*SegmentedW) Icons ​

go
func (w *SegmentedW) Icons(ics ...*icon.Icon) *SegmentedW

Icons sets an icon per option (nil entries allowed).

func (*SegmentedW) ItemRender ​

go
func (w *SegmentedW) ItemRender(fn func(o Option, selected bool)) *SegmentedW

ItemRender builds the content of every option in place of its icon and label (Element el-segmented default slot, Ant options[].label as a node): fn runs inside the segment, which centres what it adds, with the option and whether it is the selected one. The option label stays the accessible name; a hint per option is a Tooltip around the content.

ui.Segmented(c, &v, opts).ItemRender(func(o ui.Option, sel bool) {
	ui.Icon(c, icons[o.Value])
	ui.Text(c, o.Label).Size(12)
})

func (*SegmentedW) Orientation ​

go
func (w *SegmentedW) Orientation(o string) *SegmentedW

Orientation sets the direction: "horizontal" (default) or "vertical" (Ant v6 orientation, Element direction). Other values are ignored.

func (*SegmentedW) Shape ​

go
func (w *SegmentedW) Shape(s SegmentedShape) *SegmentedW

Shape sets the outline: SegmentedShapeRound makes the track and the thumb pill-shaped.

func (*SegmentedW) Size ​

go
func (w *SegmentedW) Size(s ControlSize) *SegmentedW

Size sets the control size.

func (*SegmentedW) Tooltips ​

go
func (w *SegmentedW) Tooltips(tips ...string) *SegmentedW

Tooltips shows a tooltip per option while the pointer is over it (Ant options[].tooltip); "" entries show none.

func (*SegmentedW) Vertical ​

go
func (w *SegmentedW) Vertical() *SegmentedW

Vertical stacks the options top to bottom (Ant orientation="vertical", Element direction="vertical"); they share the width of the widest one and the up / down arrow keys move the selection.

SelectW ​

go
type SelectW struct {
	// contains filtered or unexported fields
}

SelectW is a dropdown select.

只有部分成员是稳定的:未标「实验性」的方法和全部字段受兼容性承诺约束。

func Select ​

go
func Select(c *Context, val *string, opts []Option) *SelectW

Select adds a single-value select bound to *val.

func (*SelectW) A11yLabel ​

go
func (w *SelectW) A11yLabel(s string) *SelectW

A11yLabel sets the accessible name (inside a FormItem the item label is used; the placeholder is the last resort).

func (*SelectW) AllowClear ​

go
func (w *SelectW) AllowClear() *SelectW

func (*SelectW) AllowCreate ​

go
func (w *SelectW) AllowCreate() *SelectW

AllowCreate offers the typed text as a new option when no label equals it (Element allow-create); read it with Created. Implies Searchable.

func (*SelectW) Changed ​

go
func (w *SelectW) Changed() bool

Changed reports a new selection this frame.

func (*SelectW) Created ​

go
func (w *SelectW) Created() (string, bool)

Created returns the value of an entry created with AllowCreate this frame.

func (*SelectW) DataVersion ​

go
func (w *SelectW) DataVersion(v int) *SelectW

DataVersion tells the select that the option slice was modified in place (the virtual dropdown caches by slice identity and this number).

func (*SelectW) Debounce ​

go
func (w *SelectW) Debounce(d time.Duration) *SelectW

Debounce sets the delay before a Remote call.

func (*SelectW) Disabled ​

go
func (w *SelectW) Disabled(on bool) *SelectW

func (*SelectW) FilterMethod ​

go
func (w *SelectW) FilterMethod(fn func(query string, o Option) bool) *SelectW

FilterMethod replaces the case-insensitive label match of the search text with fn (same as VirtualSelect.FilterMethod); it is not used with Remote, whose results are already filtered. Implies Searchable.

func (*SelectW) Groups 实验性 ​

go
func (w *SelectW) Groups(groups []OptionGroup) *SelectW

Groups shows the options under titled groups (Ant OptGroup, Element el-option-group); the opts passed to Select are ignored. Options can also be grouped with Option.Group.

func (*SelectW) IsOpen ​

go
func (w *SelectW) IsOpen() bool

IsOpen reports whether the dropdown is shown.

func (*SelectW) LabelRender 实验性 ​

go
func (w *SelectW) LabelRender(fn func(o Option) string) *SelectW

LabelRender sets the text shown for the selected value (Ant labelRender). fn also receives values that are not among the options, as Option{Label: value, Value: value}.

func (*SelectW) Layout ​

go
func (w *SelectW) Layout(o ...layout.Option) *SelectW

func (*SelectW) ListHeight ​

go
func (w *SelectW) ListHeight(px float32) *SelectW

ListHeight sets the maximum dropdown height with or without virtual scrolling (Ant listHeight, 256).

func (*SelectW) Loading ​

go
func (w *SelectW) Loading(on bool) *SelectW

Loading shows a spinner and the loading text in the dropdown.

func (*SelectW) NotFoundContent 实验性 ​

go
func (w *SelectW) NotFoundContent(s string) *SelectW

NotFoundContent sets the text of an empty dropdown (Ant notFoundContent, Element no-data-text / no-match-text); by default the Locale's NoData.

func (*SelectW) Open ​

go
func (w *SelectW) Open() *SelectW

Open forces the dropdown open (screenshots, tests).

func (*SelectW) OpenChanged 实验性 ​

go
func (w *SelectW) OpenChanged() bool

OpenChanged reports that the dropdown opened or closed this frame (Ant onOpenChange, Element visible-change); read IsOpen for the new state.

func (*SelectW) OptionRender 实验性 ​

go
func (w *SelectW) OptionRender(fn func(o Option, s OptionState)) *SelectW

OptionRender builds each option row's content with fn (row background, highlight and selection marks stay).

func (*SelectW) Placeholder ​

go
func (w *SelectW) Placeholder(s string) *SelectW

func (*SelectW) Placement 实验性 ​

go
func (w *SelectW) Placement(p Placement) *SelectW

Placement sets where the dropdown opens: BottomStart (default), BottomEnd, TopStart or TopEnd (Ant placement bottomLeft / bottomRight / topLeft / topRight; Element placement). It flips when there is no room. ConfigProvider.Defaults("Select", "placement") takes the Ant names.

func (*SelectW) Prefix 实验性 ​

go
func (w *SelectW) Prefix(ic *icon.Icon) *SelectW

Prefix shows ic before the value (Ant prefix).

func (*SelectW) PrefixText 实验性 ​

go
func (w *SelectW) PrefixText(s string) *SelectW

PrefixText shows s before the value (Ant prefix, Element prefix slot), e.g. a field name inside the frame.

func (*SelectW) Remote ​

go
func (w *SelectW) Remote(fn func(query string)) *SelectW

Remote turns on server-side search: fn receives the typed text after Debounce (300ms by default) and should replace the options. Pair it with Loading while the request runs. Implies Searchable.

func (*SelectW) Searchable ​

go
func (w *SelectW) Searchable() *SelectW

func (*SelectW) Size ​

go
func (w *SelectW) Size(s ControlSize) *SelectW

func (*SelectW) Status ​

go
func (w *SelectW) Status(s string) *SelectW

func (*SelectW) SuffixIcon 实验性 ​

go
func (w *SelectW) SuffixIcon(ic *icon.Icon) *SelectW

SuffixIcon replaces the dropdown arrow with ic (Ant suffixIcon, Element suffix-icon); it is not rotated and also stays while searching. The clear button still takes its place on hover with AllowClear.

func (*SelectW) Variant 实验性 ​

go
func (w *SelectW) Variant(v FieldVariant) *SelectW

Variant sets the frame look (FieldOutlined by default).

func (*SelectW) Virtual ​

go
func (w *SelectW) Virtual(on bool) *SelectW

Virtual forces the virtual dropdown on or off; by default lists longer than 100 options are virtual (only the visible rows are built). With false, grouped and custom-rendered lists also build every row.

func (*SelectW) Width ​

go
func (w *SelectW) Width(px float32) *SelectW

SenderW 实验性 ​

go
type SenderW struct {
	// contains filtered or unexported fields
}

SenderW is the chat input: an auto-growing multi-line editor where Enter sends and Shift+Enter inserts a line break, with an attachment strip, @ / command suggestions, a toolbar and a send / stop button.

func Sender 实验性 ​

go
func Sender(c *Context, val *string) *SenderW

Sender adds a chat input bound to *val. Read Submitted each frame and clear *val after sending:

s := ui.Sender(c, &draft).Loading(busy).Commands(cmds)
if s.Submitted() { send(draft); draft = "" }
if s.Stopped() { cancel() }

func (*SenderW) A11yLabel 实验性 ​

go
func (w *SenderW) A11yLabel(s string) *SenderW

A11yLabel sets the accessible name of the editor (default: placeholder).

func (*SenderW) AttachButton 实验性 ​

go
func (w *SenderW) AttachButton() *SenderW

AttachButton shows a paperclip button in the toolbar (see AttachClicked; the application opens its file dialog).

func (*SenderW) AttachClicked 实验性 ​

go
func (w *SenderW) AttachClicked() bool

AttachClicked reports a click on the attach button.

func (*SenderW) Attachments 实验性 ​

go
func (w *SenderW) Attachments(files *[]ChatAttachment) *SenderW

Attachments shows *files as removable chips above the editor; a click on a chip's remove button deletes it from the slice (see Removed).

func (*SenderW) AutoSize 实验性 ​

go
func (w *SenderW) AutoSize(minRows, maxRows int) *SenderW

AutoSize sets the visible rows the editor grows between (default 1..8).

func (*SenderW) Changed 实验性 ​

go
func (w *SenderW) Changed() bool

Changed reports an edit of the text this frame.

func (*SenderW) Commands 实验性 ​

go
func (w *SenderW) Commands(opts []Option) *SenderW

Commands suggests opts after '/' (shown as "/value label").

func (*SenderW) Disabled 实验性 ​

go
func (w *SenderW) Disabled(on bool) *SenderW

Disabled disables the whole input.

func (*SenderW) Header 实验性 ​

go
func (w *SenderW) Header(fn func()) *SenderW

Header adds content at the top of the input (quoted message, context chips).

func (*SenderW) ID 实验性 ​

go
func (w *SenderW) ID() ID

ID returns the editor's ID (focus it with c.SetFocus).

func (*SenderW) Layout 实验性 ​

go
func (w *SenderW) Layout(opts ...layout.Option) *SenderW

Layout applies layout options to the outer frame.

func (*SenderW) Loading 实验性 ​

go
func (w *SenderW) Loading(on bool) *SenderW

Loading shows the stop button instead of the send button; Enter does not send and Escape (or the button) reports Stopped.

func (*SenderW) MaxLength 实验性 ​

go
func (w *SenderW) MaxLength(n int) *SenderW

MaxLength limits the number of characters.

func (*SenderW) Mentions 实验性 ​

go
func (w *SenderW) Mentions(opts []Option) *SenderW

Mentions suggests opts after '@' (filtered by what follows it).

func (*SenderW) Picked 实验性 ​

go
func (w *SenderW) Picked() (prefix string, o Option, ok bool)

Picked returns the suggestion inserted this frame and its prefix.

func (*SenderW) Placeholder 实验性 ​

go
func (w *SenderW) Placeholder(s string) *SenderW

Placeholder replaces the default placeholder.

func (*SenderW) Removed 实验性 ​

go
func (w *SenderW) Removed() (int, bool)

Removed returns the index of the attachment removed this frame.

func (*SenderW) Stopped 实验性 ​

go
func (w *SenderW) Stopped() bool

Stopped reports a click on the stop button (or Escape) while loading.

func (*SenderW) Submitted 实验性 ​

go
func (w *SenderW) Submitted() bool

Submitted reports Enter or a click on the send button with something to send (text or attachments).

func (*SenderW) Suggest 实验性 ​

go
func (w *SenderW) Suggest(prefix string, src func(query string) []Option) *SenderW

Suggest opens a suggestion list when prefix is typed at the start of the text or after a space; src returns the options for the text typed after it so far. The chosen option's Value replaces the query.

func (*SenderW) Toolbar 实验性 ​

go
func (w *SenderW) Toolbar(fn func()) *SenderW

Toolbar adds controls to the start of the bottom row (model select, mode switch …); the send button stays at the end.

SettingDrawerLocale 实验性 ​

go
type SettingDrawerLocale struct {
	Open, Title                         string // trigger (accessible name, tooltip) and drawer title
	NavTheme, Light, Dark, RealDark     string // menu style section and its choices
	PrimaryColor                        string
	Layout, Side, Top, Mix              string // navigation mode section and its choices
	ContentWidth, Fluid, Fixed          string
	FixedHeader, FixSiderbar, ColorWeak string
	Other, Compact                      string
	ColorFmt                            string // swatch name, arg: hex ("主题色 %s")
	// contains filtered or unexported fields
}

SettingDrawerLocale holds the ProLayout SettingDrawer texts.

SettingDrawerW 实验性 ​

go
type SettingDrawerW struct {
	// contains filtered or unexported fields
}

SettingDrawerW builds a SettingDrawer.

func SettingDrawer 实验性 ​

go
func SettingDrawer(c *Context, s *ProSettings) *SettingDrawerW

SettingDrawer starts the settings drawer editing *s; chain options, then Show.

ConfigProvider.Defaults("SettingDrawer", ...) keys: "hideColors", "hideLayout", "hideOther" (bool) hide those sections.

func (*SettingDrawerW) Changed 实验性 ​

go
func (w *SettingDrawerW) Changed() bool

Changed reports a settings change this frame.

func (*SettingDrawerW) Colors 实验性 ​

go
func (w *SettingDrawerW) Colors(cols []theme.Color) *SettingDrawerW

Colors replaces the preset theme colors.

func (*SettingDrawerW) NoTrigger 实验性 ​

go
func (w *SettingDrawerW) NoTrigger() *SettingDrawerW

NoTrigger hides the floating button (open it with Open).

func (*SettingDrawerW) Open 实验性 ​

go
func (w *SettingDrawerW) Open(v *bool) *SettingDrawerW

Open binds the open state (otherwise the drawer keeps its own).

func (*SettingDrawerW) Show 实验性 ​

go
func (w *SettingDrawerW) Show() *SettingDrawerW

Show builds the trigger and, when open, the drawer.

ShortcutCaptureWindow 实验性 ​

go
type ShortcutCaptureWindow interface {
	SetShortcutCapture(on bool)
}

ShortcutCaptureWindow is an optional host capability for shortcut recorders. While capture is on, window shortcuts (including those enabled in text fields) and native menu accelerators must yield to the focused canvas. This is not text input: it must not enable IME or a software keyboard. System-reserved keys and global OS hotkeys are outside this capability. The runner releases capture on completion, cancel, blur or removal. Calls are made on the UI thread, only when the requested state changes.

SiderBoxW ​

go
type SiderBoxW struct {
	*Box
	// contains filtered or unexported fields
}

SiderBoxW is the side column Sider returns; it embeds the column's Box.

func Sider ​

go
func Sider(c *Context, width float32, collapsed bool, fn func(), opts ...layout.Option) *SiderBoxW

Sider is a side column of fixed width (the theme's collapsed width when collapsed, animated). CollapsibleSider adds the collapse trigger and breakpoint collapsing.

SiderW 实验性 ​

go
type SiderW struct {
	// contains filtered or unexported fields
}

SiderW builds a collapsible Sider (Ant Layout.Sider collapsible).

ui.CollapsibleSider(c, 200, &collapsed).Breakpoint(ui.LG).Body(menu)

ConfigProvider.Defaults("Sider", ...) keys: "breakpoint" (Breakpoint), "collapsedWidth" (float32), "theme" ("light" | "dark").

func CollapsibleSider 实验性 ​

go
func CollapsibleSider(c *Context, width float32, collapsed *bool) *SiderW

CollapsibleSider starts a sider whose collapsed state lives in *collapsed: a trigger bar at the bottom toggles it and Breakpoint collapses it on narrow windows. Chain options, then Body.

func (*SiderW) Body 实验性 ​

go
func (s *SiderW) Body(fn func(), opts ...layout.Option) *Box

Body builds the sider with fn as its content.

func (*SiderW) Breakpoint 实验性 ​

go
func (s *SiderW) Breakpoint(bp Breakpoint) *SiderW

Breakpoint collapses the sider when the window becomes narrower than bp and expands it when it grows past it again (Ant breakpoint).

func (*SiderW) Broken 实验性 ​

go
func (s *SiderW) Broken() bool

Broken reports whether the window is narrower than the breakpoint.

func (*SiderW) Changed 实验性 ​

go
func (s *SiderW) Changed() bool

Changed reports a collapse change by the trigger or the breakpoint.

func (*SiderW) CollapsedWidth 实验性 ​

go
func (s *SiderW) CollapsedWidth(px float32) *SiderW

CollapsedWidth sets the width when collapsed (default the theme's).

func (*SiderW) Light 实验性 ​

go
func (s *SiderW) Light() *SiderW

Light uses the light sider colors (Ant theme="light").

func (*SiderW) NoTrigger 实验性 ​

go
func (s *SiderW) NoTrigger() *SiderW

NoTrigger hides the bottom trigger (collapse from elsewhere).

func (*SiderW) ReverseArrow 实验性 ​

go
func (s *SiderW) ReverseArrow() *SiderW

ReverseArrow flips the trigger arrow (a sider on the end side: the right, or the left in a right-to-left scope).

SkeletonW 实验性 ​

go
type SkeletonW struct {
	// contains filtered or unexported fields
}

SkeletonW is a loading placeholder: optional avatar, a title bar and paragraph lines, with an optional shimmer ("active").

func Skeleton 实验性 ​

go
func Skeleton(c *Context) *SkeletonW

Skeleton starts a skeleton with a title and paragraph rows: three rows, or two next to an avatar or without a title (antd).

ConfigProvider.Defaults("Skeleton", ...) keys: "active", "round" (bool).

func (*SkeletonW) Active 实验性 ​

go
func (s *SkeletonW) Active() *SkeletonW

Active turns on the shimmer animation.

func (*SkeletonW) Avatar 实验性 ​

go
func (s *SkeletonW) Avatar(square bool) *SkeletonW

Avatar adds a round avatar placeholder (square=true for square).

func (*SkeletonW) AvatarSize 实验性 ​

go
func (s *SkeletonW) AvatarSize(px float32) *SkeletonW

AvatarSize sets the avatar placeholder size in px (antd avatar.size; default the large control height, 40).

func (*SkeletonW) Body 实验性 ​

go
func (s *SkeletonW) Body(fn func()) *Box

Body builds the skeleton while loading, else fn.

func (*SkeletonW) Count 实验性 ​

go
func (s *SkeletonW) Count(n int) *SkeletonW

Count repeats the skeleton n times (Element count).

func (*SkeletonW) Loading 实验性 ​

go
func (s *SkeletonW) Loading(on bool) *SkeletonW

Loading switches between the skeleton (true) and the real content.

func (*SkeletonW) NoTitle 实验性 ​

go
func (s *SkeletonW) NoTitle() *SkeletonW

NoTitle hides the title bar.

func (*SkeletonW) ParagraphWidth 实验性 ​

go
func (s *SkeletonW) ParagraphWidth(w ...float32) *SkeletonW

ParagraphWidth sets the paragraph line widths (antd paragraph.width): one value sets the last line, several set the lines in order; fractions when 0 < w <= 1, else px. The default last line is 61%.

func (*SkeletonW) Round 实验性 ​

go
func (s *SkeletonW) Round() *SkeletonW

Round uses pill-shaped bars.

func (*SkeletonW) Rows 实验性 ​

go
func (s *SkeletonW) Rows(n int) *SkeletonW

Rows sets the paragraph rows (0 hides the paragraph).

func (*SkeletonW) Show 实验性 ​

go
func (s *SkeletonW) Show() *Box

Show builds the skeleton.

func (*SkeletonW) Throttle 实验性 ​

go
func (s *SkeletonW) Throttle(leading, trailing time.Duration) *SkeletonW

Throttle delays the switch (EP throttle): the skeleton appears only after Loading(true) lasted leading and goes away only after Loading(false) lasted trailing (0: at once), so quick loads do not flash. The first frame shows the content unless ThrottleInitial(true).

func (*SkeletonW) ThrottleInitial 实验性 ​

go
func (s *SkeletonW) ThrottleInitial(on bool) *SkeletonW

ThrottleInitial sets what a throttled skeleton shows before its first delay ends: true the skeleton, false (default) the content (EP throttle.initVal).

func (*SkeletonW) TitleWidth 实验性 ​

go
func (s *SkeletonW) TitleWidth(w float32) *SkeletonW

TitleWidth sets the title bar width (antd title.width): a fraction of the row when 0 < w <= 1, else px. The default is 38%, 50% next to an avatar, full width without a paragraph.

SliderLocale ​

go
type SliderLocale struct {
	Min, Max string
	// contains filtered or unexported fields
}

SliderLocale holds the accessible names of the two SliderRange handles.

SliderW ​

go
type SliderW struct {
	// contains filtered or unexported fields
}

SliderW is a slider; chain modifiers after Slider / SliderRange.

func Slider ​

go
func Slider(c *Context, val *float64, min, max float64) *SliderW

Slider adds a slider bound to *val in [min,max] (step 1).

ui.Slider(c, &v, 0, 100).Marks(map[float64]string{0: "0°C", 100: "100°C"}).Tooltip(nil)
ui.Slider(c, &v, 0, 100).Vertical(200)
ui.Slider(c, &v, 0, 10).Step(0.5).WithInput()

func SliderRange 实验性 ​

go
func SliderRange(c *Context, lo, hi *float64, min, max float64) *SliderW

SliderRange adds a two-handle slider bound to *lo and *hi (Ant range, Element range).

func (*SliderW) A11yLabel ​

go
func (w *SliderW) A11yLabel(s string) *SliderW

A11yLabel sets the accessible name (inside a FormItem the item label is used). A range names its group; the handles are "minimum" / "maximum".

func (*SliderW) AllowCross ​

go
func (w *SliderW) AllowCross(on bool) *SliderW

AllowCross sets whether a dragged range handle may pass the other one (they swap values and the dragged handle continues as the other end). Default true; false stops it at the other handle. Keyboard steps never cross.

func (*SliderW) ChangeComplete ​

go
func (w *SliderW) ChangeComplete() bool

ChangeComplete reports the end of a change (antd onChangeComplete): the frame the pointer is released after dragging changed the value, or a keyboard / number box / assistive change.

func (*SliderW) Changed ​

go
func (w *SliderW) Changed() bool

Changed reports a value change this frame.

func (*SliderW) Disabled ​

go
func (w *SliderW) Disabled(on bool) *SliderW

Disabled turns the slider off.

func (*SliderW) Dots ​

go
func (w *SliderW) Dots() *SliderW

Dots draws a dot at every step (Ant dots, Element show-stops).

func (*SliderW) Included ​

go
func (w *SliderW) Included(on bool) *SliderW

Included sets whether the part from the start to the value (a range: between the handles) is filled (antd included, default true); false leaves the rail plain, for marks that are points rather than ranges.

func (*SliderW) Keyboard ​

go
func (w *SliderW) Keyboard(on bool) *SliderW

Keyboard turns the arrow / Page / Home / End keys on (the default) or off (antd keyboard); the handles stay focusable.

func (*SliderW) Layout ​

go
func (w *SliderW) Layout(opts ...layout.Option) *SliderW

Layout applies layout options to the slider row.

func (*SliderW) Marks ​

go
func (w *SliderW) Marks(m map[float64]string) *SliderW

Marks labels values on the rail (a dot is drawn at each mark).

func (*SliderW) Pushable ​

go
func (w *SliderW) Pushable(gap float64) *SliderW

Pushable keeps range handles at least gap apart: moving one towards the other pushes it along (until it reaches the end of the slider). It turns crossing off. 0 disables.

func (*SliderW) Range ​

go
func (w *SliderW) Range(hi *float64) *SliderW

Range turns the slider into a range: *val is the start, *hi the end.

func (*SliderW) Reverse ​

go
func (w *SliderW) Reverse() *SliderW

Reverse runs the slider the other way (antd reverse): max at the inline start (at the bottom when vertical). The arrow keys follow the visual direction.

func (*SliderW) Step ​

go
func (w *SliderW) Step(s float64) *SliderW

Step sets the value granularity (0: continuous).

func (*SliderW) Tooltip ​

go
func (w *SliderW) Tooltip(format func(float64) string) *SliderW

Tooltip sets the tooltip formatter of the handle value (nil: the plain number). The tooltip shows while a handle is hovered, dragged or focused with the keyboard; TooltipOpen forces it.

func (*SliderW) TooltipOpen ​

go
func (w *SliderW) TooltipOpen(on bool) *SliderW

TooltipOpen always shows (true) or never shows (false) the tooltips.

func (*SliderW) Vertical ​

go
func (w *SliderW) Vertical(height float32) *SliderW

Vertical lays the slider out vertically with the given height (min at the bottom).

func (*SliderW) WithInput ​

go
func (w *SliderW) WithInput() *SliderW

WithInput adds InputNumbers bound to the values (Element show-input). A single horizontal slider has the box after the track; a range has the start box before the track and the end box after it. Vertically the boxes go below the track (a range: the end box above, the start box below).

SortOrder ​

go
type SortOrder uint8

SortOrder is a column sort direction.

Append-only: never reorder or insert; the zero value stays SortNone.

go
const (
	SortNone SortOrder = iota
	SortAsc
	SortDesc
)

SortState ​

go
type SortState struct {
	Column string // TableColumn.Key
	Order  SortOrder
}

SortState is a column's sort, owned by the app (controlled) or by the table (uncontrolled).

SpaceW ​

go
type SpaceW struct {
	// contains filtered or unexported fields
}

SpaceW sets the spacing between inline items (Ant Space).

func Space ​

go
func Space(c *Context) *SpaceW

Space starts a horizontal group with the Small (8px) gap and centered items; chain options, then Body. ConfigProvider's Defaults("Space", Props{...}) keys: "size" (ControlSize), "orientation" ("horizontal" | "vertical").

ui.Space(c).Body(func() { ui.Button(c, "A"); ui.Button(c, "B") })
ui.Space(c).Orientation("vertical").Size(ui.Large).Body(fn)
ui.Space(c).Separator(func() { ui.VDivider(c) }).Body(fn)

func (*SpaceW) Align ​

go
func (s *SpaceW) Align(a layout.Align) *SpaceW

Align positions items on the cross axis (default center; start when vertical).

func (*SpaceW) Body ​

go
func (s *SpaceW) Body(fn func()) *Box

Body adds the items.

func (*SpaceW) Layout ​

go
func (s *SpaceW) Layout(o ...layout.Option) *SpaceW

Layout applies extra layout options (margins, width, ...).

func (*SpaceW) Orientation ​

go
func (s *SpaceW) Orientation(o string) *SpaceW

Orientation sets the direction: "horizontal" (default) or "vertical" (Ant v6 orientation, which replaces direction; Element direction). Vertical items align to the start. Other values are ignored.

func (*SpaceW) Separator ​

go
func (s *SpaceW) Separator(fn func()) *SpaceW

Separator builds a separator between every two items (Ant v6 separator, Element spacer), e.g. ui.VDivider or a Text; it is built once per gap, never before the first item or after the last.

func (*SpaceW) Size ​

go
func (s *SpaceW) Size(sz ControlSize) *SpaceW

Size sets the gap with a size token (Small 8, Middle 16, Large 24).

func (*SpaceW) SizePx ​

go
func (s *SpaceW) SizePx(h, v float32) *SpaceW

SizePx sets horizontal and vertical gaps in pixels.

func (*SpaceW) Split ​

go
func (s *SpaceW) Split(fn func()) *SpaceW

Split builds a separator between every two items (e.g. VDivider).

Deprecated: use Separator (Ant v6 renamed split to separator).

func (*SpaceW) Vertical ​

go
func (s *SpaceW) Vertical() *SpaceW

Vertical stacks the items.

func (*SpaceW) Wrap ​

go
func (s *SpaceW) Wrap() *SpaceW

Wrap wraps items onto new lines (horizontal only).

Span 实验性 ​

go
type Span struct {
	Text      string
	Bold      bool
	Italic    bool // synthetic oblique (text.Style.Italic)
	Strike    bool
	Underline bool
	Code      bool // inline code box, monospace
	Mono      bool // monospace without the box
	Mark      bool // highlighted background
	Link      string
	Color     theme.Color // zero: default color
	Size      float32     // 0: paragraph size
}

Span is a run of styled inline text.

func ParseMarkdownInline 实验性 ​

go
func ParseMarkdownInline(s string) []Span

ParseMarkdownInline converts inline Markdown (emphasis, code, links...) into spans for RichText.

SpinW ​

go
type SpinW struct {
	// contains filtered or unexported fields
}

SpinW is a loading indicator: sizes, description, delayed show, progress percent and a nested mode (Wrap) that dims the wrapped content.

func Spin ​

go
func Spin(c *Context) *SpinW

Spin adds a loading indicator; chain options. Wrap turns it into a container that covers its content while spinning:

ui.Spin(c).Size(ui.Large).Description("加载中")
ui.Spin(c).Spinning(loading).Wrap(func() { ... })

ConfigProvider.Defaults("Spin", ...) keys: "size", "delay", "description" ("tip" before antd 6).

func (*SpinW) Delay ​

go
func (s *SpinW) Delay(d time.Duration) *SpinW

Delay shows the indicator only after spinning lasted d (avoids flashes); it hides at once when spinning stops (antd delay).

func (*SpinW) Description ​

go
func (s *SpinW) Description(t string) *SpinW

Description shows a text under the indicator (antd 6 description).

func (*SpinW) Indicator ​

go
func (s *SpinW) Indicator(ic *icon.Icon) *SpinW

Indicator replaces the indicator with a spinning icon (antd indicator, EP spinner).

func (*SpinW) IndicatorSize ​

go
func (s *SpinW) IndicatorSize(px float32) *SpinW

IndicatorSize sets a custom indicator size in px.

func (*SpinW) Percent ​

go
func (s *SpinW) Percent(p float64) *SpinW

Percent replaces the indicator with a progress ring (0..100); at 0 the indicator still spins (antd).

func (*SpinW) PercentAuto ​

go
func (s *SpinW) PercentAuto() *SpinW

PercentAuto shows a simulated progress that slows down as it nears 100 while spinning (antd percent="auto": every 200ms it advances 5% of the rest up to 30, 3% up to 70, 1% up to 96).

func (*SpinW) Size ​

go
func (s *SpinW) Size(sz ControlSize) *SpinW

Size sets small, middle (default) or large.

func (*SpinW) Spinning ​

go
func (s *SpinW) Spinning(on bool) *SpinW

Spinning toggles the indicator (default on).

func (*SpinW) Tip ​

go
func (s *SpinW) Tip(t string) *SpinW

Tip shows a text under the indicator.

Deprecated: use Description (antd 6 renamed tip to description).

func (*SpinW) Wrap ​

go
func (s *SpinW) Wrap(fn func()) *Box

Wrap builds content and, while spinning, dims it and centers the indicator above it (Ant nested Spin).

SplitterPanelW 实验性 ​

go
type SplitterPanelW struct {
	// contains filtered or unexported fields
}

SplitterPanelW is one pane of a Splitter.

func SplitterPanel 实验性 ​

go
func SplitterPanel(c *Context) *SplitterPanelW

SplitterPanel adds a pane; call it inside Splitter.Body.

func (*SplitterPanelW) AlwaysShowCollapse 实验性 ​

go
func (p *SplitterPanelW) AlwaysShowCollapse(on bool) *SplitterPanelW

AlwaysShowCollapse keeps the adjacent bar's collapse controls visible without hover, like antd's collapsible.showCollapsibleIcon=true. It applies to Collapsible and Tango's single-arrow CollapseToggle.

func (*SplitterPanelW) Body 实验性 ​

go
func (p *SplitterPanelW) Body(fn func()) *SplitterPanelW

Body sets the pane content.

func (*SplitterPanelW) CollapseOffsets 实验性 ​

go
func (p *SplitterPanelW) CollapseOffsets(expanded, collapsed float32) *SplitterPanelW

CollapseOffsets sets the toggle center's distance from the bar in logical pixels. Positive values shift it toward the expanded pane, or toward its neighbor when collapsed. Use with CollapseToggle.

func (*SplitterPanelW) CollapseToggle 实验性 ​

go
func (p *SplitterPanelW) CollapseToggle(collapseTip, expandTip string) *SplitterPanelW

CollapseToggle shows a single arrow on the adjacent bar, like an IDE side bar: it points at this pane and collapses it, then flips and restores the saved size. Hovering the arrow shows collapseTip (expandTip while collapsed); the tips also name the button for screen readers and default to the locale's Collapse / Expand. Enter on the bar toggles it.

func (*SplitterPanelW) Collapsed 实验性 ​

go
func (p *SplitterPanelW) Collapsed(on bool) *SplitterPanelW

Collapsed controls whether this pane is folded. Use Collapsible or CollapseToggle to add a bar control and OnCollapse to accept its changes.

func (*SplitterPanelW) Collapsible 实验性 ​

go
func (p *SplitterPanelW) Collapsible() *SplitterPanelW

Collapsible shows collapse arrows on the adjacent bars.

func (*SplitterPanelW) DefaultPercent 实验性 ​

go
func (p *SplitterPanelW) DefaultPercent(f float32) *SplitterPanelW

DefaultPercent sets the initial size as a fraction (0.3 = 30%).

func (*SplitterPanelW) DefaultSize 实验性 ​

go
func (p *SplitterPanelW) DefaultSize(px float32) *SplitterPanelW

DefaultSize sets the initial size in pixels.

func (*SplitterPanelW) Max 实验性 ​

go
func (p *SplitterPanelW) Max(px float32) *SplitterPanelW

Max sets the maximum size in pixels.

func (*SplitterPanelW) MaxPercent 实验性 ​

go
func (p *SplitterPanelW) MaxPercent(f float32) *SplitterPanelW

func (*SplitterPanelW) Min 实验性 ​

go
func (p *SplitterPanelW) Min(px float32) *SplitterPanelW

Min sets the minimum size in pixels.

func (*SplitterPanelW) MinPercent 实验性 ​

go
func (p *SplitterPanelW) MinPercent(f float32) *SplitterPanelW

MinPercent / MaxPercent limit the size as a fraction of the splitter (antd min / max "20%"); with Min / Max too, the tighter limit wins. A minimum above the maximum keeps the pane at the minimum.

func (*SplitterPanelW) OnCollapse 实验性 ​

go
func (p *SplitterPanelW) OnCollapse(fn func(bool)) *SplitterPanelW

OnCollapse reports whether a bar action folded or restored this pane. Programmatic changes to Collapsed do not emit this callback.

func (*SplitterPanelW) OnResize 实验性 ​

go
func (p *SplitterPanelW) OnResize(fn func(float32)) *SplitterPanelW

OnResize reports an expanded pane's new size in logical pixels when a bar is moved by the user. Lazy pointer drags report on release.

func (*SplitterPanelW) Resizable 实验性 ​

go
func (p *SplitterPanelW) Resizable(on bool) *SplitterPanelW

Resizable(false) locks the bars next to this pane.

func (*SplitterPanelW) Size 实验性 ​

go
func (p *SplitterPanelW) Size(px float32) *SplitterPanelW

Size controls the expanded pane size in logical pixels along the splitter's axis. A pane without Size shares the remaining space. Use OnResize to accept changes made with the bar.

SplitterW 实验性 ​

go
type SplitterW struct {
	// contains filtered or unexported fields
}

SplitterW lays panes side by side with draggable bars.

func Splitter 实验性 ​

go
func Splitter(c *Context) *SplitterW

Splitter starts a split view; chain options, then Body with SplitterPanel calls.

ConfigProvider.Defaults("Splitter", ...) keys: "orientation" ("vertical"; antd 6), "layout" (its deprecated name), "lazy", "withHandle" (bool).

Under shadcn/ui this is Resizable: a 1px border line, WithHandle adds the grip box of ResizableHandle withHandle.

func (*SplitterW) Body 实验性 ​

go
func (s *SplitterW) Body(fn func()) *Box

Body builds the panes.

func (*SplitterW) Changed 实验性 ​

go
func (s *SplitterW) Changed() bool

Changed reports a resize or collapse this frame.

func (*SplitterW) DragEnded 实验性 ​

go
func (s *SplitterW) DragEnded() (bar int, ok bool)

DragEnded reports the bar whose pointer drag ended this frame (released or cancelled). In Lazy mode the sizes are already committed.

func (*SplitterW) DragStarted 实验性 ​

go
func (s *SplitterW) DragStarted() (bar int, ok bool)

DragStarted reports the bar (1-based: bar i sits before pane i) whose pointer drag began this frame.

func (*SplitterW) Dragging 实验性 ​

go
func (s *SplitterW) Dragging() bool

Dragging reports whether a bar is being dragged with the pointer.

func (*SplitterW) KeyboardMinimumCap 实验性 ​

go
func (s *SplitterW) KeyboardMinimumCap(fraction float32) *SplitterW

KeyboardMinimumCap caps each pane's keyboard-only minimum to the given fraction of the adjacent pair's total size. A non-positive value uses the pane minima unchanged. Pointer dragging always uses the pane minima.

func (*SplitterW) KeyboardStep 实验性 ​

go
func (s *SplitterW) KeyboardStep(step, shiftStep float32) *SplitterW

KeyboardStep sets arrow and Shift+arrow increments as fractions of the two adjacent panes' total size. A positive step also restricts arrows to the splitter's axis. Zero restores the default 10 px step.

func (*SplitterW) KeyboardStepPixels 实验性 ​

go
func (s *SplitterW) KeyboardStepPixels(step, shiftStep float32) *SplitterW

KeyboardStepPixels sets arrow and Shift+arrow increments in logical pixels. A positive step restricts arrows to the splitter's axis.

func (*SplitterW) Lazy 实验性 ​

go
func (s *SplitterW) Lazy() *SplitterW

Lazy makes a drag show only a preview line; the panes keep their sizes until the pointer is released, then the new ratio is committed at once (Changed reports it on that frame). Keyboard resizing is unaffected.

func (*SplitterW) Orientation 实验性 ​

go
func (s *SplitterW) Orientation(o string) *SplitterW

Orientation lays the panes out "horizontal" (default, side by side) or "vertical" (antd 6 orientation; layout deprecated).

func (*SplitterW) PixelSizes 实验性 ​

go
func (s *SplitterW) PixelSizes() []float32

PixelSizes returns the effective pane sizes in logical pixels along the splitter's axis, excluding the bars. Call it after Body.

func (*SplitterW) Sizes 实验性 ​

go
func (s *SplitterW) Sizes() []float32

Sizes returns the pane sizes as fractions.

func (*SplitterW) Style 实验性 ​

go
func (s *SplitterW) Style(opts ...layout.Option) *SplitterW

Style applies layout options (give the splitter a size, e.g. layout.H(200)).

func (*SplitterW) Vertical 实验性 ​

go
func (s *SplitterW) Vertical() *SplitterW

Vertical stacks panes top to bottom.

Deprecated: use Orientation("vertical") (antd 6 orientation).

func (*SplitterW) WithHandle 实验性 ​

go
func (s *SplitterW) WithHandle() *SplitterW

WithHandle draws a grip on every resizable bar (shadcn ResizableHandle withHandle).

StatisticCardDividerW 实验性 ​

go
type StatisticCardDividerW struct {
	// contains filtered or unexported fields
}

StatisticCardDividerW is an explicit Pro statistic divider.

func StatisticCardDivider 实验性 ​

go
func StatisticCardDivider(c *Context, orientation string) *StatisticCardDividerW

StatisticCardDivider builds StatisticCard.Divider. Empty orientation reads the Defaults key "orientation" and otherwise defaults to vertical.

func (*StatisticCardDividerW) Layout 实验性 ​

go
func (w *StatisticCardDividerW) Layout(opts ...layout.Option) *StatisticCardDividerW

Layout applies layout options to the divider.

StatisticCardLocale 实验性 ​

go
type StatisticCardLocale struct {
	Up, Down string
	// contains filtered or unexported fields
}

StatisticCardLocale holds the accessible names of the trend marks.

StatisticCardOperationW 实验性 ​

go
type StatisticCardOperationW struct {
	// contains filtered or unexported fields
}

StatisticCardOperationW is an operator between statistics.

func StatisticCardOperation 实验性 ​

go
func StatisticCardOperation(c *Context, value string) *StatisticCardOperationW

StatisticCardOperation builds StatisticCard.Operation using heading-4 typography and Pro's marginLG block spacing.

func (*StatisticCardOperationW) Layout 实验性 ​

go
func (w *StatisticCardOperationW) Layout(opts ...layout.Option) *StatisticCardOperationW

Layout applies layout options to the operation.

StatisticCardW 实验性 ​

go
type StatisticCardW struct {
	// contains filtered or unexported fields
}

StatisticCardW builds a StatisticCard.

func StatisticCard 实验性 ​

go
func StatisticCard(c *Context, title string) *StatisticCardW

StatisticCard starts a statistic card titled title (the statistic's label; use CardTitle for a card header). Chain options, then Show.

func (*StatisticCardW) Bordered 实验性 ​

go
func (w *StatisticCardW) Bordered() *StatisticCardW

Bordered draws a border.

func (*StatisticCardW) Card 实验性 ​

go
func (w *StatisticCardW) Card() *ProCardW

Card returns the underlying ProCard (valid after Show for queries).

func (*StatisticCardW) CardTitle 实验性 ​

go
func (w *StatisticCardW) CardTitle(s string) *StatisticCardW

CardTitle shows a card header with title (the statistic keeps its own).

func (*StatisticCardW) Chart 实验性 ​

go
func (w *StatisticCardW) Chart(fn func()) *StatisticCardW

Chart builds the chart area (a chart.Tiny*, any chart, or content).

func (*StatisticCardW) ChartPlace 实验性 ​

go
func (w *StatisticCardW) ChartPlace(p string) *StatisticCardW

ChartPlace puts the chart below (ChartBottom, default), left or right of the statistic.

func (*StatisticCardW) Clicked 实验性 ​

go
func (w *StatisticCardW) Clicked() bool

Clicked reports a click on a hoverable card.

func (*StatisticCardW) ColSpan 实验性 ​

go
func (w *StatisticCardW) ColSpan(span int) *StatisticCardW

ColSpan sizes the card in a parent ProCard / StatisticCardGroup row.

func (*StatisticCardW) Desc 实验性 ​

go
func (w *StatisticCardW) Desc(title, value, trend string) *StatisticCardW

Desc adds an inline statistic under the value ("Week 12% ▲"); trend is "up", "down" or "".

func (*StatisticCardW) Description 实验性 ​

go
func (w *StatisticCardW) Description(fn func()) *StatisticCardW

Description builds custom content under the value.

func (*StatisticCardW) Extra 实验性 ​

go
func (w *StatisticCardW) Extra(fn func()) *StatisticCardW

Extra builds the header actions.

func (*StatisticCardW) Footer 实验性 ​

go
func (w *StatisticCardW) Footer(fn func()) *StatisticCardW

Footer builds a footer below a divider.

func (*StatisticCardW) Ghost 实验性 ​

go
func (w *StatisticCardW) Ghost() *StatisticCardW

Ghost removes the card background and outer padding.

func (*StatisticCardW) Hoverable 实验性 ​

go
func (w *StatisticCardW) Hoverable() *StatisticCardW

Hoverable lifts the card on hover.

func (*StatisticCardW) Icon 实验性 ​

go
func (w *StatisticCardW) Icon(ic *icon.Icon) *StatisticCardW

Icon shows an icon left of the statistic.

func (*StatisticCardW) Layout 实验性 ​

go
func (w *StatisticCardW) Layout(o ...layout.Option) *StatisticCardW

Layout applies layout options to the card.

func (*StatisticCardW) Loading 实验性 ​

go
func (w *StatisticCardW) Loading(on bool) *StatisticCardW

Loading shows the card's loading placeholder.

func (*StatisticCardW) Prefix 实验性 ​

go
func (w *StatisticCardW) Prefix(s string) *StatisticCardW

Prefix sets text before the value (e.g. a currency sign).

func (*StatisticCardW) Show 实验性 ​

go
func (w *StatisticCardW) Show() *StatisticCardW

Show builds the card.

func (*StatisticCardW) StatisticLayout 实验性 ​

go
func (w *StatisticCardW) StatisticLayout(mode string) *StatisticCardW

StatisticLayout sets the statistic layout: vertical (default), horizontal (title and value at opposite ends), or inline (compact, secondary value).

func (*StatisticCardW) Status 实验性 ​

go
func (w *StatisticCardW) Status(s string) *StatisticCardW

Status shows a colored dot before the title ("success", "processing", "warning", "error", "default").

func (*StatisticCardW) Suffix 实验性 ​

go
func (w *StatisticCardW) Suffix(s string) *StatisticCardW

Suffix sets text after the value (e.g. a unit).

func (*StatisticCardW) Tooltip 实验性 ​

go
func (w *StatisticCardW) Tooltip(tip string) *StatisticCardW

Tooltip adds a question icon after the title showing tip on hover.

func (*StatisticCardW) Trend 实验性 ​

go
func (w *StatisticCardW) Trend(dir string) *StatisticCardW

Trend marks the value as rising ("up") or falling ("down").

func (*StatisticCardW) TrendColors 实验性 ​

go
func (w *StatisticCardW) TrendColors(up, down theme.Color) *StatisticCardW

TrendColors overrides the rising / falling colors (default: error red for up, success green for down, as in Pro).

func (*StatisticCardW) Value 实验性 ​

go
func (w *StatisticCardW) Value(v float64, precision int) *StatisticCardW

Value sets a number formatted with thousands separators.

func (*StatisticCardW) ValueColor 实验性 ​

go
func (w *StatisticCardW) ValueColor(col theme.Color) *StatisticCardW

ValueColor colors the value.

func (*StatisticCardW) ValueText 实验性 ​

go
func (w *StatisticCardW) ValueText(s string) *StatisticCardW

ValueText sets the value as preformatted text.

StatisticW ​

go
type StatisticW struct {
	// contains filtered or unexported fields
}

StatisticW shows a labelled number.

func Statistic ​

go
func Statistic(c *Context, title string, value float64, precision int) *StatisticW

Statistic adds a statistic display. The value is shown with precision decimals, cut (not rounded) like antd and Element Plus; a negative precision shows the decimals the value has. NaN and ±Inf are shown as "NaN" and "Infinity".

ConfigProvider.Defaults("Statistic", ...) keys: "groupSeparator", "decimalSeparator" (string).

func (*StatisticW) Color ​

go
func (s *StatisticW) Color(col theme.Color) *StatisticW

func (*StatisticW) CountUp ​

go
func (s *StatisticW) CountUp(v float64, precision int) *StatisticW

CountUp animates the displayed value from 0 to v (precision digits) over the slow duration ×4 the first time the statistic appears.

func (*StatisticW) DecimalSeparator ​

go
func (s *StatisticW) DecimalSeparator(sep string) *StatisticW

DecimalSeparator sets the decimal point (default ".").

func (*StatisticW) Formatter ​

go
func (s *StatisticW) Formatter(fn func(v float64) string) *StatisticW

Formatter formats the value with fn instead (antd / Element formatter).

func (*StatisticW) GroupSeparator ​

go
func (s *StatisticW) GroupSeparator(sep string) *StatisticW

GroupSeparator sets the thousands separator (default ",").

func (*StatisticW) Layout ​

go
func (s *StatisticW) Layout(o ...layout.Option) *StatisticW

Layout applies layout options.

func (*StatisticW) Loading ​

go
func (s *StatisticW) Loading(on bool) *StatisticW

Loading replaces the value with a skeleton bar.

func (*StatisticW) Prefix ​

go
func (s *StatisticW) Prefix(p string) *StatisticW

func (*StatisticW) PrefixIcon ​

go
func (s *StatisticW) PrefixIcon(ic *icon.Icon) *StatisticW

func (*StatisticW) Suffix ​

go
func (s *StatisticW) Suffix(p string) *StatisticW

func (*StatisticW) Value ​

go
func (s *StatisticW) Value(v string) *StatisticW

func (*StatisticW) ValueSize ​

go
func (s *StatisticW) ValueSize(px float32) *StatisticW

ValueSize sets the value font size (line height follows).

StatusBarItemW 实验性 ​

go
type StatusBarItemW struct {
	// contains filtered or unexported fields
}

StatusBarItemW is one entry of a StatusBar: an icon, text, a count badge and a progress bar, in that order, any of them optional.

func StatusBarItem 实验性 ​

go
func StatusBarItem(c *Context, label string) *StatusBarItemW

StatusBarItem adds an entry to the StatusBar being built (outside a bar it draws the same, at the bar's height). label is the visible text and the accessible name; an icon-only item ("" label) is named by its Tooltip or A11yLabel.

Items are buttons by default: hover highlight, Tab stop, Enter / Space or a click report Clicked. Static makes a plain read-out.

func (*StatusBarItemW) A11yLabel 实验性 ​

go
func (w *StatusBarItemW) A11yLabel(s string) *StatusBarItemW

A11yLabel replaces the accessible name.

func (*StatusBarItemW) Badge 实验性 ​

go
func (w *StatusBarItemW) Badge(n int) *StatusBarItemW

Badge shows a count after the text (0 hides it; above 99 shows "99+").

func (*StatusBarItemW) BadgeText 实验性 ​

go
func (w *StatusBarItemW) BadgeText(s string) *StatusBarItemW

BadgeText shows s in the badge ("" hides it).

func (*StatusBarItemW) Clicked 实验性 ​

go
func (w *StatusBarItemW) Clicked() bool

Clicked reports a click (or Enter / Space) on the item.

func (*StatusBarItemW) Disabled 实验性 ​

go
func (w *StatusBarItemW) Disabled(on bool) *StatusBarItemW

Disabled dims the item and stops it from reacting.

func (*StatusBarItemW) Hovered 实验性 ​

go
func (w *StatusBarItemW) Hovered() bool

Hovered reports whether the pointer is over the item.

func (*StatusBarItemW) ID 实验性 ​

go
func (w *StatusBarItemW) ID() ID

ID returns the item's ID.

func (*StatusBarItemW) Icon 实验性 ​

go
func (w *StatusBarItemW) Icon(ic *icon.Icon) *StatusBarItemW

Icon shows ic before the text.

func (*StatusBarItemW) Loading 实验性 ​

go
func (w *StatusBarItemW) Loading(on bool) *StatusBarItemW

Loading spins the icon (icon.Loading when the item has none): a task is running.

func (*StatusBarItemW) Progress 实验性 ​

go
func (w *StatusBarItemW) Progress(p float64) *StatusBarItemW

Progress shows a small determinate progress bar after the text; p runs from 0 to 1 (a negative p hides it). Use Loading for work of unknown length.

func (*StatusBarItemW) Static 实验性 ​

go
func (w *StatusBarItemW) Static() *StatusBarItemW

Static makes the item a plain read-out: no hover highlight, not a Tab stop, never Clicked (a Tooltip still shows on hover).

func (*StatusBarItemW) Status 实验性 ​

go
func (w *StatusBarItemW) Status(s string) *StatusBarItemW

Status fills the item with a status color ("warning", "error", "success", "info", "primary"), as VS Code marks problems or a remote connection.

func (*StatusBarItemW) Tooltip 实验性 ​

go
func (w *StatusBarItemW) Tooltip(tip string) *StatusBarItemW

Tooltip shows tip above the item while the pointer rests on it or while it has keyboard focus; screen readers get it as the description (as the name of an icon-only item).

StatusBarLocale 实验性 ​

go
type StatusBarLocale struct {
	Label string // accessible name of the bar ("状态栏")
	// contains filtered or unexported fields
}

StatusBarLocale holds the StatusBar texts.

StatusBarW 实验性 ​

go
type StatusBarW struct {
	// contains filtered or unexported fields
}

StatusBarW is the strip at the bottom of a workbench window (VS Code / JetBrains status bar): items at its start (Left) and end (Right).

func StatusBar 实验性 ​

go
func StatusBar(c *Context) *StatusBarW

StatusBar adds a status bar; fill its two sides with StatusBarItem:

ui.StatusBar(c).
	Left(func() {
		if ui.StatusBarItem(c, "main").Icon(icon.Branch).Tooltip("切换分支").Clicked() { ... }
		ui.StatusBarItem(c, "").Icon(icon.Sync).Loading(true)
	}).
	Right(func() {
		ui.StatusBarItem(c, "Ln 12, Col 5")
		ui.StatusBarItem(c, "UTF-8").Static()
	})

Left and right are logical: in RTL the sides swap. The bar stretches across its parent column; the left side clips when the items do not fit.

func (*StatusBarW) A11yLabel 实验性 ​

go
func (s *StatusBarW) A11yLabel(name string) *StatusBarW

A11yLabel replaces the accessible name (Locale.StatusBar.Label).

func (*StatusBarW) ID 实验性 ​

go
func (s *StatusBarW) ID() ID

ID returns the bar's ID.

func (*StatusBarW) Layout 实验性 ​

go
func (s *StatusBarW) Layout(o ...layout.Option) *StatusBarW

Layout adds layout options to the bar (margins, width).

func (*StatusBarW) Left 实验性 ​

go
func (s *StatusBarW) Left(fn func()) *StatusBarW

Left builds the items at the bar's start.

func (*StatusBarW) Right 实验性 ​

go
func (s *StatusBarW) Right(fn func()) *StatusBarW

Right builds the items at the bar's end.

func (*StatusBarW) Status 实验性 ​

go
func (s *StatusBarW) Status(st string) *StatusBarW

Status fills the whole bar with a status color ("primary", "success", "warning", "error", "info"; "" the default neutral bar), as VS Code colors it while debugging or without a folder. Item text switches to the matching on-solid color.

StepDot ​

go
type StepDot struct {
	Index  int         // 0-based step index
	Status string      // "wait", "process", "finish", "error" or the finish status ("success")
	Title  string      // the step's title
	Rect   geom.Rect   // the area of the default dot; draw around its center
	Color  theme.Color // the default dot color for Status
	// Default draws the standard dot, so a renderer can decorate it.
	Default func()
	// contains filtered or unexported fields
}

StepDot describes one dot to a custom dot renderer (DotRender).

StepItem ​

go
type StepItem struct {
	Title    string
	SubTitle string
	// Description is the text under the title.
	//
	// Deprecated: use Content (antd 6 items[].content).
	Description string
	Content     string     // text under the title (antd 6 content); wins over Description
	Icon        *icon.Icon // custom icon replaces the numbered circle
	Status      string     // override: "wait", "process", "finish", "error"
	Disabled    bool       // not clickable
	// contains filtered or unexported fields
}

StepItem is one entry of Steps.

StepsFormStep 实验性 ​

go
type StepsFormStep struct {
	Title, Description string
	Fields             []ProField
	Columns            int
	// Children builds extra items after the fields (FormList ...).
	Children func(f *FormW)
}

StepsFormStep is one step of a StepsForm.

StepsFormW 实验性 ​

go
type StepsFormW struct {
	// contains filtered or unexported fields
}

StepsFormW splits a form into steps (Ant Design Pro StepsForm): the current step's fields validate before moving on; the last step submits the values of all steps.

func StepsForm 实验性 ​

go
func StepsForm(c *Context, steps []StepsFormStep) *StepsFormW

StepsForm starts a step form; chain options, then Show.

func (*StepsFormW) Current 实验性 ​

go
func (s *StepsFormW) Current() int

Current returns the 0-based current step (valid after Show).

func (*StepsFormW) Finished 实验性 ​

go
func (s *StepsFormW) Finished() bool

Finished reports a completed submit of the last step, once.

func (*StepsFormW) OnFinish 实验性 ​

go
func (s *StepsFormW) OnFinish(fn func(vals ProValues, done func(error))) *StepsFormW

OnFinish receives the values after the last step validated; call done (from any goroutine) when saved.

func (*StepsFormW) SetCurrent 实验性 ​

go
func (s *StepsFormW) SetCurrent(i int) *StepsFormW

SetCurrent jumps to step i (no validation).

func (*StepsFormW) Show 实验性 ​

go
func (s *StepsFormW) Show() *StepsFormW

Show builds the steps and the current step's form.

func (*StepsFormW) Values 实验性 ​

go
func (s *StepsFormW) Values(v *ProValues) *StepsFormW

Values binds the values of all steps.

func (*StepsFormW) Width 实验性 ​

go
func (s *StepsFormW) Width(px float32) *StepsFormW

Width sets the form width under the steps (default 600).

StepsW ​

go
type StepsW struct {
	// contains filtered or unexported fields
}

StepsW shows progress through a sequence: horizontal / vertical, dot style, small size, label placement, custom icons and clickable steps.

func Steps ​

go
func Steps(c *Context, items []StepItem) *StepsW

Steps starts a step bar; chain options, then Show:

ui.Steps(c, items).Current(1).Status("error").Show()

ConfigProvider.Defaults("Steps", ...) keys: "type" ("default" | "navigation" | "inline" | "panel" | "dot"), "size" (ControlSize or "small"), "orientation" / "direction" ("vertical"), "titlePlacement" / "labelPlacement" ("vertical"), "variant" ("filled" | "outlined"), "progressDot" (bool), "maxCount" (int). The antd 6 names (orientation, titlePlacement, type "dot", items[].content) win over the deprecated ones.

Out-of-range Current values are kept: below 0 every step waits, past the last one every step is finished (antd).

func (*StepsW) Changed ​

go
func (s *StepsW) Changed() bool

Changed reports a click on another step.

func (*StepsW) Clickable ​

go
func (s *StepsW) Clickable(cur *int) *StepsW

Clickable binds the current step and lets the user click any step.

func (*StepsW) Current ​

go
func (s *StepsW) Current(i int) *StepsW

Current sets the 0-based current step.

func (*StepsW) Dot ​

go
func (s *StepsW) Dot() *StepsW

Dot uses the dot style (labels under the dots).

Deprecated: use Type("dot") (antd 6 type="dot", progressDot deprecated).

func (*StepsW) DotRender ​

go
func (s *StepsW) DotRender(fn func(l *paint.List, d StepDot)) *StepsW

DotRender uses the dot style with dots drawn by fn (Ant progressDot as a function). fn gets the step index and status with the dot's rectangle, and may call d.Default to draw the standard dot first. It also draws the dots of the inline type.

ui.Steps(c, items).Current(1).DotRender(func(l *paint.List, d ui.StepDot) {
	d.Default()
	if d.Status == "process" {
		p := d.Rect.Center()
		l.StrokePath(paint.NewPath().Circle(p.X, p.Y, 8), paint.StrokeStyle{Width: 1}, d.Color)
	}
})

func (*StepsW) FinishStatus ​

go
func (s *StepsW) FinishStatus(st string) *StepsW

FinishStatus sets the status shown by finished steps ("success" paints them green, Element finish-status).

func (*StepsW) Initial ​

go
func (s *StepsW) Initial(n int) *StepsW

Initial numbers the steps from initial+1; Current, Clickable and the bound value count from it too (antd initial).

func (*StepsW) Inline ​

go
func (s *StepsW) Inline() *StepsW

Inline uses the inline type (Ant type="inline"): a compact row of small dots on a line with the titles under them, sized to its content so it fits inside list rows and cards. Descriptions are not drawn; they stay in the accessible description.

func (*StepsW) LabelVertical ​

go
func (s *StepsW) LabelVertical() *StepsW

LabelVertical puts titles under the icons.

Deprecated: use TitlePlacement("vertical").

func (*StepsW) MaxCount ​

go
func (s *StepsW) MaxCount(n int) *StepsW

MaxCount shows at most n steps (n >= 3; antd 6.7 maxCount): the first, the last and the current step stay, the nearest ones fill the other slots and each hidden range becomes a disabled ellipsis step whose status sums it up (error if any hidden step failed, finish if all are done).

func (*StepsW) Orientation ​

go
func (s *StepsW) Orientation(o string) *StepsW

Orientation lays the steps out "horizontal" (default) or "vertical" (antd 6 orientation; direction is its deprecated name).

func (*StepsW) Panel ​

go
func (s *StepsW) Panel() *StepsW

Panel uses the panel type (Ant type="panel"): every step is an arrow-shaped panel sharing the row, the current one highlighted.

func (*StepsW) Percent ​

go
func (s *StepsW) Percent(p float64) *StepsW

Percent shows the progress (0..100) of the current step as a ring around its icon (Ant percent).

func (*StepsW) Show ​

go
func (s *StepsW) Show() *StepsW

Show builds the steps.

func (*StepsW) Size ​

go
func (s *StepsW) Size(sz ControlSize) *StepsW

Size sets the size (Small or Middle).

func (*StepsW) Small ​

go
func (s *StepsW) Small() *StepsW

Small uses the small size.

func (*StepsW) Status ​

go
func (s *StepsW) Status(st string) *StepsW

Status sets the status of the current step ("process", "error", "finish", "wait").

func (*StepsW) TitlePlacement ​

go
func (s *StepsW) TitlePlacement(p string) *StepsW

TitlePlacement puts the titles beside the icons ("horizontal", default) or under them ("vertical"; antd 6 titlePlacement, labelPlacement deprecated). Dot steps always put them under.

func (*StepsW) Type ​

go
func (s *StepsW) Type(t string) *StepsW

Type selects "default", "navigation" (Ant type="navigation": steps as tabs with chevrons, the current one underlined; Element's simple steps look the same way in the Element theme; "simple" is accepted too), "inline" (see Inline) or "panel" (see Panel).

func (*StepsW) Variant ​

go
func (s *StepsW) Variant(v string) *StepsW

Variant picks "filled" (default) or "outlined" icons (antd 6 variant: outlined icons are rings in the status color on the container background, the current one on a light primary fill).

func (*StepsW) Vertical ​

go
func (s *StepsW) Vertical() *StepsW

Vertical stacks the steps.

Deprecated: use Orientation("vertical") (antd 6 orientation).

SwitchW ​

go
type SwitchW struct {
	// contains filtered or unexported fields
}

SwitchW is a toggle switch.

func Switch ​

go
func Switch(c *Context, val *bool) *SwitchW

Switch adds a switch bound to *val.

func SwitchValue 实验性 ​

go
func SwitchValue[T comparable](c *Context, val *T, on, off T) *SwitchW

SwitchValue adds a switch bound to an arbitrary value (Element active-value / inactive-value): it is on while *val == on, and toggling writes on or off into *val. Any other value shows the switch off.

func (*SwitchW) A11yLabel ​

go
func (w *SwitchW) A11yLabel(s string) *SwitchW

A11yLabel sets the accessible name (a switch has no visible label; inside a FormItem the item label is used).

func (*SwitchW) ActionIcons ​

go
func (w *SwitchW) ActionIcons(on, off *icon.Icon) *SwitchW

ActionIcons shows an icon on the thumb (Element active-action-icon / inactive-action-icon), in the track color of the state. Either may be nil.

func (*SwitchW) BeforeChange ​

go
func (w *SwitchW) BeforeChange(fn func(next bool) bool) *SwitchW

BeforeChange is asked before every toggle with the value the switch would take; returning false keeps the current value.

func (*SwitchW) BeforeChangeAsync ​

go
func (w *SwitchW) BeforeChangeAsync(fn func(next bool, done func(ok bool))) *SwitchW

BeforeChangeAsync asks fn before every toggle; the switch shows loading and ignores clicks until fn calls done (from any goroutine, once): with true the switch takes next, with false it stays. done wakes the window.

func (*SwitchW) Changed ​

go
func (w *SwitchW) Changed() bool

func (*SwitchW) Disabled ​

go
func (w *SwitchW) Disabled(on bool) *SwitchW

func (*SwitchW) Icons ​

go
func (w *SwitchW) Icons(on, off *icon.Icon) *SwitchW

Icons shows on / off icons inside the track (Element inline-prompt with active-icon / inactive-icon). Either may be nil.

func (*SwitchW) Large ​

go
func (w *SwitchW) Large() *SwitchW

Large selects the large switch.

func (*SwitchW) Loading ​

go
func (w *SwitchW) Loading(on bool) *SwitchW

func (*SwitchW) OuterTexts ​

go
func (w *SwitchW) OuterTexts(on, off string) *SwitchW

OuterTexts shows labels beside the track (Element active-text / inactive-text): off before it, on after it; the label of the current state takes the brand color. Clicking a label toggles the switch.

func (*SwitchW) Size ​

go
func (w *SwitchW) Size(s ControlSize) *SwitchW

Size sets the switch size (Small, Middle or Large).

func (*SwitchW) Small ​

go
func (w *SwitchW) Small() *SwitchW

func (*SwitchW) Texts ​

go
func (w *SwitchW) Texts(on, off string) *SwitchW

Texts shows on / off text inside the track (Ant checkedChildren, Element inline-prompt).

func (*SwitchW) Width ​

go
func (w *SwitchW) Width(px float32) *SwitchW

Width sets the track width in px (Element width); by default the track has the theme's minimum width and grows to fit the inline texts.

TabItem ​

go
type TabItem struct {
	Key, Label string
	Icon       *icon.Icon
	Disabled   bool
	NoClose    bool // no close button on this tab of a Closable bar
	// contains filtered or unexported fields
}

TabItem is a tab.

TableColumn ​

go
type TableColumn struct {
	Key   string
	Title string
	// Width fixes the width; 0 shares the remaining space by Grow (default
	// 1), never below MinWidth (default 80).
	Width    float32
	Grow     float32
	MinWidth float32
	// Align aligns the cell and header text: AlignLeft / AlignRight
	// (AlignStart / AlignEnd) follow the direction, so an end-aligned
	// numeric column lines up on the left in RTL; AlignPhysicalLeft /
	// AlignPhysicalRight never flip.
	Align TextAlign
	// Fixed pins the column ("left" | "right": start | end, see FixedLeft)
	// while scrolling sideways.
	Fixed string
	// Ellipsis shows the full text in a tooltip when a truncated cell is
	// hovered (text cells stay on one line).
	Ellipsis bool
	// Wrap lets the cell text wrap onto several lines; rows grow to fit
	// their tallest cell (measured, also under virtual scrolling). Render
	// cells of a Wrap column wrap their widgets and are measured after
	// layout. Wrap and Ellipsis are exclusive: Wrap wins.
	Wrap bool
	// Hidden hides the column until it is enabled in the column settings.
	Hidden bool

	// Sortable shows the sorter. With Compare the table sorts locally;
	// without it the app sorts (server-side) using the reported SortState.
	Sortable bool
	Compare  func(a, b int) int
	// SortMultiple > 0 lets this column take part in multi-column sorting;
	// a higher value has a higher priority.
	SortMultiple int
	// DefaultSort is the initial order when the table owns its sort state.
	DefaultSort SortOrder
	// SortDirections lists the orders a sorter click cycles through
	// (Ant Design sortDirections, Element Plus sort-orders); after the
	// last one the column returns to unsorted. Empty: the table's
	// SortDirections, by default ascending, descending.
	SortDirections []SortOrder

	// Filters lists the values of the filter dropdown. OnFilter filters
	// locally (a row passes if it matches any selected value); without it
	// the app filters using the reported filter state.
	Filters      []Option
	FilterSearch bool // search box above the options
	FilterSingle bool // radio instead of checkboxes
	OnFilter     func(row int, value string) bool
	// FilterPanel replaces the option list with a custom panel.
	FilterPanel func(p *TableFilterPanel)
	// DefaultFilter is the initial filter of the column when the table
	// owns its filter state, or when the bound Filters map has no entry
	// for the column on the first frame (Ant Design defaultFilteredValue).
	DefaultFilter []string
	// FilterResetToDefault makes the filter's reset button restore
	// DefaultFilter instead of clearing it (Ant Design
	// filterResetToDefaultFilteredValue).
	FilterResetToDefault bool

	// Text returns the cell text; Render, if set, builds custom content
	// (any widget: tags, badges, buttons, progress, avatars).
	Text   func(row int) string
	Render func(row int)

	// Children makes this a header group (multi-level header).
	Children []TableColumn

	// Editor makes the cells editable.
	Editor *TableEditor
}

TableColumn describes one column. Only Key/Title and one of Text/Render are needed; everything else is optional.

只有部分成员是稳定的:未标「实验性」的方法和下列以外的字段受兼容性承诺约束。

实验性 实验性成员:SortMultiple、SortDirections、FilterSearch、FilterSingle、FilterPanel、DefaultFilter、FilterResetToDefault、Editor

TableColumnState 实验性 ​

go
type TableColumnState struct {
	Order  []string
	Hidden map[string]bool
	Widths map[string]float32
	// Fixed overrides a top-level column's Fixed side: FixedLeft,
	// FixedRight or "none" (unpinned).
	Fixed map[string]string
}

TableColumnState is the user-adjustable column layout: order, visibility and resized widths. ProTable's column settings edit it.

TableDropdownW 实验性 ​

go
type TableDropdownW struct {
	// contains filtered or unexported fields
}

TableDropdownW is a row-action dropdown backed by DropdownW. Menu keys, disabled items, focus navigation and dismissal use the same menu model.

func TableDropdown 实验性 ​

go
func TableDropdown(c *Context, items []MenuItem) *TableDropdownW

TableDropdown starts a table-row action menu. Show uses an ellipsis trigger with a localized accessible name. Button selects the ordinary button variant (not a split button). ConfigProvider.Defaults keys: "disabled" (false), "trigger" (TriggerHover), "placement" (BottomStart).

func (*TableDropdownW) Button 实验性 ​

go
func (w *TableDropdownW) Button(label string) *TableDropdownW

Button uses an ordinary button with a down arrow, as TableDropdown.Button.

func (*TableDropdownW) Clicked 实验性 ​

go
func (w *TableDropdownW) Clicked() string

Clicked returns the menu key selected this frame, or an empty string.

func (*TableDropdownW) Disabled 实验性 ​

go
func (w *TableDropdownW) Disabled(on bool) *TableDropdownW

Disabled disables the trigger and menu.

func (*TableDropdownW) ID 实验性 ​

go
func (w *TableDropdownW) ID() ID

ID returns the trigger wrapper ID after Show.

func (*TableDropdownW) IsOpen 实验性 ​

go
func (w *TableDropdownW) IsOpen() bool

IsOpen reports whether the menu is expanded.

func (*TableDropdownW) Label 实验性 ​

go
func (w *TableDropdownW) Label(s string) *TableDropdownW

Label replaces the ellipsis with text.

func (*TableDropdownW) OnSelect 实验性 ​

go
func (w *TableDropdownW) OnSelect(fn func(string)) *TableDropdownW

OnSelect receives the selected menu key.

func (*TableDropdownW) Open 实验性 ​

go
func (w *TableDropdownW) Open(on *bool) *TableDropdownW

Open binds the expanded state.

func (*TableDropdownW) Show 实验性 ​

go
func (w *TableDropdownW) Show() *TableDropdownW

Show builds the trigger and menu.

func (*TableDropdownW) Trigger 实验性 ​

go
func (w *TableDropdownW) Trigger(t Trigger) *TableDropdownW

Trigger chooses hover, click or context menu activation.

TableEditor 实验性 ​

go
type TableEditor struct {
	Kind      string // "text" (default) | "number" | "select" | "date"
	Options   []Option
	Precision int
	Value     func(row int) string    // current value (default: column Text)
	Set       func(row int, v string) // commit
	// Validate returns an error message for an invalid value.
	Validate func(v string) string
	// Render builds a custom editor for row-edit mode (EditableRows) in
	// place of Kind, bound to the app's own draft; Error returns the
	// message shown in a tip under it ("" when valid). EditableProTable
	// uses it for ProField controls. Without Set the cell is not
	// click-to-edit.
	Render func(row int)
	Error  func(row int) string
}

TableEditor makes a column's cells editable in place.

TableFilterPanel 实验性 ​

go
type TableFilterPanel struct {
	Values *[]string // draft values; Confirm applies them
	// contains filtered or unexported fields
}

TableFilterPanel is passed to custom filter panels.

func (*TableFilterPanel) Close 实验性 ​

go
func (p *TableFilterPanel) Close()

Close closes the panel without applying.

func (*TableFilterPanel) Confirm 实验性 ​

go
func (p *TableFilterPanel) Confirm()

Confirm applies the draft values and closes the panel.

func (*TableFilterPanel) Context 实验性 ​

go
func (p *TableFilterPanel) Context() *Context

Context returns the build context.

func (*TableFilterPanel) Reset 实验性 ​

go
func (p *TableFilterPanel) Reset()

Reset clears the filter and closes the panel.

TableLocale ​

go
type TableLocale struct {
	FilterSearch string // search box placeholder
	FilterAll    string // "all" entry of single-choice filters
	Filter       string // Element's apply button ("筛选")

	// Column settings: group titles and pin actions.
	FixedLeft, NoFixed, FixedRight, PinLeft, PinRight, Unpin string

	// SelectRowFmt names a row's selection checkbox, arg: row number
	// ("选择第 %d 行").
	SelectRowFmt string

	// Selection dropdown next to the header checkbox: its accessible name
	// and the built-in SelectionPage / SelectionNone items.
	Selections, SelectPage, SelectNone string

	// SumText is the first cell of ShowSummary's row (Element Plus
	// sum-text, "合计").
	SumText string
	// contains filtered or unexported fields
}

TableLocale holds the Table filter dropdown texts not covered by the common Filter* fields.

TableSelection 实验性 ​

go
type TableSelection struct {
	Key      string
	Text     string
	OnSelect func(pageRows []int)
}

TableSelection is an item of the header selection menu (Ant Design rowSelection.selections). Key is one of the Selection* constants or a custom key; custom items need Text and OnSelect, which receives the displayed data rows of the current page (change the selection there).

TableSpan 实验性 ​

go
type TableSpan struct {
	Row, Pos, Col int
	Key           string // column key
}

TableSpan identifies a body cell for Span: Row is the data index, Pos the position among the displayed rows, Col the index of the leaf data column.

TableW ​

go
type TableW struct {
	// contains filtered or unexported fields
}

TableW is a data table (Ant Design Table / Element Plus Table + Table V2).

ui.Table(c, cols, len(data)).Selection(&sel).Sort(&sort).ScrollY(400).Show()

Rows are addressed by data index 0..rows-1 (or the ids given to Tree); column callbacks receive that index, so local sorting and filtering never change what a callback sees.

只有部分成员是稳定的:未标「实验性」的方法和全部字段受兼容性承诺约束。

func Table ​

go
func Table(c *Context, cols []TableColumn, rows int) *TableW

Table starts a table over rows data rows; chain modifiers, then Show.

func (*TableW) A11yLabel ​

go
func (t *TableW) A11yLabel(s string) *TableW

A11yLabel names the table (grid) for screen readers, e.g. the title of the card it sits in.

func (*TableW) Bordered ​

go
func (t *TableW) Bordered() *TableW

Bordered draws borders around every cell.

func (*TableW) Cancel 实验性 ​

go
func (t *TableW) Cancel(row int)

Cancel leaves row-edit mode without saving.

func (*TableW) CheckLinked 实验性 ​

go
func (t *TableW) CheckLinked() *TableW

CheckLinked turns on the parent/child linkage of tree selection (Ant Design rowSelection.checkStrictly false, Element Plus' default tree-props checkStrictly false): checking a row checks its descendants, a parent is checked once all its children are and shows a half state when only some are. By default (Ant Design checkStrictly true) rows are checked independently.

func (*TableW) CheckStrictly 实验性 ​

go
func (t *TableW) CheckStrictly() *TableW

CheckStrictly checks tree rows independently, without parent/child linkage. It is the default (Ant Design rowSelection.checkStrictly true); it overrides a ConfigProvider default of false. See CheckLinked.

func (*TableW) ColumnState 实验性 ​

go
func (t *TableW) ColumnState(s *TableColumnState) *TableW

ColumnState binds column order, visibility and widths.

func (*TableW) CurrentChanged 实验性 ​

go
func (t *TableW) CurrentChanged() bool

CurrentChanged reports that the current row moved in the last Show (Element Plus current-change).

func (*TableW) CurrentRowKey 实验性 ​

go
func (t *TableW) CurrentRowKey(key *string) *TableW

CurrentRowKey binds the highlighted current row by key (Element Plus current-row-key / setCurrentRow); "" means none. It turns on HighlightCurrentRow; CurrentChanged reports clicks that moved it.

func (*TableW) DefaultExpandAllRows 实验性 ​

go
func (t *TableW) DefaultExpandAllRows() *TableW

DefaultExpandAllRows expands every expandable row and tree node on the first frame when the table owns the expansion state (Ant Design expandable.defaultExpandAllRows, Element Plus default-expand-all). Rows of TreeLazy whose children are not loaded stay closed.

func (*TableW) DisplayedRows ​

go
func (t *TableW) DisplayedRows() []int

DisplayedRows returns the data rows shown on the current page, in order (valid after Show).

func (*TableW) DragSort 实验性 ​

go
func (t *TableW) DragSort(fn func(from, to int)) *TableW

DragSort adds a drag handle column; fn(from, to) moves data row from to the position of data row to.

func (*TableW) Edit 实验性 ​

go
func (t *TableW) Edit(row int)

Edit puts row into row-edit mode.

func (*TableW) EditableRows 实验性 ​

go
func (t *TableW) EditableRows(keys *[]string) *TableW

EditableRows binds the keys of rows in row-edit mode (every column with an Editor shows an input; use Save/Cancel from an action column).

func (*TableW) Edited 实验性 ​

go
func (t *TableW) Edited() bool

Edited reports a committed cell or row edit in the last Show.

func (*TableW) EmptyText ​

go
func (t *TableW) EmptyText(s string) *TableW

EmptyText sets the empty-state description.

func (*TableW) ExpandChanged ​

go
func (t *TableW) ExpandChanged() bool

ExpandChanged reports an expand or tree toggle in the last Show.

func (*TableW) ExpandRowByClick 实验性 ​

go
func (t *TableW) ExpandRowByClick() *TableW

ExpandRowByClick toggles a row's detail panel (Expandable) or tree children when the row is clicked (Ant Design expandable.expandRowByClick).

func (*TableW) Expandable ​

go
func (t *TableW) Expandable(render func(row int)) *TableW

Expandable adds an expand column; render builds a row's detail panel.

func (*TableW) ExpandedKeys ​

go
func (t *TableW) ExpandedKeys(keys *[]string) *TableW

ExpandedKeys binds the expanded rows (controlled).

func (*TableW) FilterChanged ​

go
func (t *TableW) FilterChanged() bool

FilterChanged reports a confirmed or reset filter in the last Show.

func (*TableW) Filters ​

go
func (t *TableW) Filters(f *map[string][]string) *TableW

Filters binds the filter state: column key → selected values.

func (*TableW) Footer 实验性 ​

go
func (t *TableW) Footer(fn func()) *TableW

Footer builds a bar below the table body (Ant Design footer).

func (*TableW) HeaderHeight 实验性 ​

go
func (t *TableW) HeaderHeight(px float32) *TableW

HeaderHeight overrides the height of a header row (Element Plus Table V2 header-height); 0 keeps the height derived from the size.

func (*TableW) HideExpandColumn 实验性 ​

go
func (t *TableW) HideExpandColumn() *TableW

HideExpandColumn hides the expand column of Expandable (Ant Design expandable.showExpandColumn false); rows then expand by ExpandRowByClick, Enter or the bound ExpandedKeys.

func (*TableW) HideHeader 实验性 ​

go
func (t *TableW) HideHeader() *TableW

HideHeader hides the header row (Ant Design / Element Plus showHeader false). Sorting and filters stay bound but have no controls.

func (*TableW) HideSelectAll ​

go
func (t *TableW) HideSelectAll() *TableW

HideSelectAll hides the header checkbox.

func (*TableW) HighlightCurrentRow ​

go
func (t *TableW) HighlightCurrentRow() *TableW

HighlightCurrentRow keeps the clicked row highlighted (Element Plus).

func (*TableW) ID ​

go
func (t *TableW) ID() ID

ID returns the table's widget ID (valid after Show).

func (*TableW) Indent 实验性 ​

go
func (t *TableW) Indent(px float32) *TableW

Indent sets the per-level tree indent (default TableToken.IndentSize: 15, Element Plus 16).

func (*TableW) IsEditing 实验性 ​

go
func (t *TableW) IsEditing(row int) bool

IsEditing reports whether row is in row-edit mode.

func (*TableW) Loading ​

go
func (t *TableW) Loading(on bool) *TableW

Loading shows a translucent mask with a spinner.

func (*TableW) Moved 实验性 ​

go
func (t *TableW) Moved() bool

Moved reports a drag-sort drop in the last Show.

func (*TableW) MultiSort ​

go
func (t *TableW) MultiSort(s *[]SortState) *TableW

MultiSort binds multi-column sorting (columns with SortMultiple > 0).

func (*TableW) NoHover ​

go
func (t *TableW) NoHover() *TableW

NoHover disables the row hover highlight.

func (*TableW) PageChanged ​

go
func (t *TableW) PageChanged() bool

PageChanged reports a page or page-size change in the last Show.

func (*TableW) PageSizes ​

go
func (t *TableW) PageSizes(sizes ...int) *TableW

PageSizes sets the page-size options of the pager.

func (*TableW) Pagination ​

go
func (t *TableW) Pagination(page, pageSize *int) *TableW

Pagination paginates locally: rows are all data; page is 1-based.

func (*TableW) PaginationConfig 实验性 ​

go
func (t *TableW) PaginationConfig(fn func(p *PaginationW)) *TableW

PaginationConfig customizes the pager after the table set it up (Ant Design's pagination object): fn receives it before Show, e.g. p.ShowTotal().ShowQuickJumper(). Like Ant Design, the table's pager shows no total by default and is small for Small and Middle tables.

func (*TableW) PaginationPlacement 实验性 ​

go
func (t *TableW) PaginationPlacement(p ...string) *TableW

PaginationPlacement places the pager: one top and/or one bottom placement (PageTopStart … PageBottomEnd); PageNone hides it while paging still applies. The default is PageBottomEnd.

func (*TableW) PreserveSelectedRowKeys 实验性 ​

go
func (t *TableW) PreserveSelectedRowKeys() *TableW

PreserveSelectedRowKeys keeps selected keys whose rows are no longer in the data (Ant Design preserveSelectedRowKeys, Element Plus reserve-selection). By default a selection change drops them, so with ServerPagination the selection covers the current page only.

func (*TableW) Resizable 实验性 ​

go
func (t *TableW) Resizable() *TableW

Resizable lets the user drag header edges to resize columns.

func (*TableW) Resized 实验性 ​

go
func (t *TableW) Resized() bool

Resized reports a column resize in the last Show.

func (*TableW) Revision 实验性 ​

go
func (t *TableW) Revision(v uint64) *TableW

Revision tells the table its data changed, so cached local sorting and filtering is recomputed (bump it whenever rows change in place).

func (*TableW) RowClass 实验性 ​

go
func (t *TableW) RowClass(fn func(i int) RowStyle) *TableW

RowClass styles rows: fn returns the style of data row i (background, status tint, text color, weight). It is the Ant rowClassName / Element row-class-name hook without CSS.

func (*TableW) RowClicked ​

go
func (t *TableW) RowClicked() int

RowClicked returns the clicked data row or -1.

func (*TableW) RowDoubleClicked ​

go
func (t *TableW) RowDoubleClicked() int

RowDoubleClicked returns the double-clicked data row or -1.

func (*TableW) RowExpandable ​

go
func (t *TableW) RowExpandable(f func(row int) bool) *TableW

RowExpandable limits which rows can expand.

func (*TableW) RowHeight ​

go
func (t *TableW) RowHeight(h float32) *TableW

RowHeight overrides the row height derived from the size.

func (*TableW) RowKey ​

go
func (t *TableW) RowKey(f func(int) string) *TableW

RowKey gives rows stable keys (selection, expansion, editing).

func (*TableW) Save 实验性 ​

go
func (t *TableW) Save(row int) bool

Save validates the row's editors and commits them; it returns false and shows the errors when a value is invalid.

func (*TableW) ScrollToFirstRowOnChange 实验性 ​

go
func (t *TableW) ScrollToFirstRowOnChange(on bool) *TableW

ScrollToFirstRowOnChange sets whether a page, sort or filter change scrolls a bounded body back to the first row (Ant Design scroll.scrollToFirstRowOnChange, default true).

func (*TableW) ScrollX ​

go
func (t *TableW) ScrollX(totalW float32) *TableW

ScrollX sets the scrollable content width (Ant's scroll.x).

func (*TableW) ScrollY ​

go
func (t *TableW) ScrollY(maxH float32) *TableW

ScrollY bounds the body height; the header (and a fixed summary) stay in place and only the visible rows are built, so huge tables stay fast.

func (*TableW) SelectDisabled ​

go
func (t *TableW) SelectDisabled(f func(row int) bool) *TableW

SelectDisabled disables the selection box of some rows.

func (*TableW) SelectedKeys ​

go
func (t *TableW) SelectedKeys(keys *[]string) *TableW

SelectedKeys binds the selection to row keys (RowKey). Keys survive paging, sorting and server-side data replacement.

func (*TableW) Selection ​

go
func (t *TableW) Selection(sel *[]int) *TableW

Selection binds a multi-select column to data indices.

func (*TableW) SelectionChanged ​

go
func (t *TableW) SelectionChanged() bool

SelectionChanged reports a selection change in the last Show.

func (*TableW) SelectionColumnWidth 实验性 ​

go
func (t *TableW) SelectionColumnWidth(px float32) *TableW

SelectionColumnWidth sets the width of the selection column (Ant Design rowSelection.columnWidth).

func (*TableW) SelectionFixed 实验性 ​

go
func (t *TableW) SelectionFixed() *TableW

SelectionFixed pins the selection column (and the expand column) to the start side (Ant Design rowSelection.fixed). Without it they are pinned when the first data column is.

func (*TableW) Selections 实验性 ​

go
func (t *TableW) Selections(items ...TableSelection) *TableW

Selections adds a menu next to the header checkbox (Ant Design rowSelection.selections). Without items it offers select all, select current page (when paginated), invert current page and clear.

func (*TableW) ServerPagination ​

go
func (t *TableW) ServerPagination(page, pageSize *int, total int) *TableW

ServerPagination shows a pager for server data: rows are the current page's rows and total is the count of all rows.

func (*TableW) Show ​

go
func (t *TableW) Show() *TableW

Show builds the table.

func (*TableW) ShowOverflowTooltip 实验性 ​

go
func (t *TableW) ShowOverflowTooltip() *TableW

ShowOverflowTooltip makes every text column ellipsis with a tooltip (Element Plus' table-level show-overflow-tooltip).

func (*TableW) ShowSorterTooltip 实验性 ​

go
func (t *TableW) ShowSorterTooltip(on bool) *TableW

ShowSorterTooltip shows or hides the "click to sort" tooltip of sortable headers (Ant Design showSorterTooltip, default true). A theme whose TableToken.SorterTooltip is false (Element Plus) shows none.

func (*TableW) ShowSummary 实验性 ​

go
func (t *TableW) ShowSummary() *TableW

ShowSummary adds Element Plus' default summary row (show-summary): the first data column shows Locale().Table.SumText, columns whose displayed texts are numbers show their sum, others stay empty. Use Summary for a custom summary-method.

func (*TableW) SingleSelect ​

go
func (t *TableW) SingleSelect() *TableW

SingleSelect turns the selection column into radios.

func (*TableW) Size ​

go
func (t *TableW) Size(s ControlSize) *TableW

Size picks the density: Large (default), Middle or Small (Element: default, Large, Small).

func (*TableW) Sort ​

go
func (t *TableW) Sort(s *SortState) *TableW

Sort binds single-column sorting (controlled).

func (*TableW) SortChanged ​

go
func (t *TableW) SortChanged() bool

SortChanged reports a sorter click in the last Show.

func (*TableW) SortDirections 实验性 ​

go
func (t *TableW) SortDirections(dirs ...SortOrder) *TableW

SortDirections sets the orders a sorter click cycles through for every column without its own TableColumn.SortDirections (Ant Design sortDirections, Element Plus sort-orders). The default is SortAsc, SortDesc; after the last order the column returns to unsorted. SortDesc, SortAsc starts with descending; a single order toggles between it and unsorted.

func (*TableW) Span 实验性 ​

go
func (t *TableW) Span(f func(s TableSpan) (rowSpan, colSpan int)) *TableW

Span merges body cells: return (rowSpan, colSpan); 0 hides a cell that a neighbour covers, (1,1) is a normal cell.

func (*TableW) Sticky 实验性 ​

go
func (t *TableW) Sticky(offsetTop float32) *TableW

Sticky pins the header to the top of the scroll container the table scrolls in (the nearest ancestor Scroll, or StickyContainer), offset px below its top edge (Ant Design sticky.offsetHeader).

func (*TableW) StickyContainer 实验性 ​

go
func (t *TableW) StickyContainer(id ID) *TableW

StickyContainer names the scroll container (a ScrollBox ID) Sticky and StickySummary measure against (default: the nearest scrolling ancestor).

func (*TableW) StickySummary 实验性 ​

go
func (t *TableW) StickySummary(offsetBottom float32) *TableW

StickySummary pins the summary rows to the bottom of the scroll container, offset px above its bottom edge, while the table extends below it (Ant Design summary fixed + sticky.offsetSummary).

func (*TableW) Striped ​

go
func (t *TableW) Striped() *TableW

Striped tints every other row.

func (*TableW) Summary 实验性 ​

go
func (t *TableW) Summary(fn func(col string, rows []int) string) *TableW

Summary adds a summary (totals) row; fn returns the text of each column for the displayed rows. Call it again for more rows.

func (*TableW) SummaryFixed 实验性 ​

go
func (t *TableW) SummaryFixed() *TableW

SummaryFixed keeps the summary visible under a scrolling body.

func (*TableW) Title 实验性 ​

go
func (t *TableW) Title(fn func()) *TableW

Title builds a bar above the table (Ant Design title).

func (*TableW) Transposed 实验性 ​

go
func (t *TableW) Transposed() *TableW

Transposed swaps the axes for comparing records side by side: every TableColumn becomes a row and every record a column. The data model is unchanged (cols are the fields, rows the record count, callbacks get the record index).

The first column is the header column: it shows each field's Title in header style (Table HeaderBg / HeaderColor / HeaderFontWeight tokens), is a row header for assistive technology and is pinned to the inline start (the right edge in RTL) unless TransposedHeaderFixed(false). Each record column is at least TransposedColumnWidth wide (default 160; record columns share the width of a wider table equally) and shows the field's Text or Render for that record, aligned by the field's Align. The header row shows TransposedHeader's titles; without TransposedHeader there is no header row. Hidden fields are skipped and header groups (Children) are flattened to their leaves.

Transposition turns off, without error, every feature that addresses records as rows or fields as columns: sorting and filtering (Sort, MultiSort, Filters, column Sortable / Filters), row selection (Selection, SelectedKeys, Selections), expandable rows, Tree, Span, DragSort, editing (column Editor, EditableRows), Resizable, ColumnState, Summary, Pagination / ServerPagination, RowClass, HighlightCurrentRow, Sticky / StickySummary and the Wrap of field columns (cells stay one line; Ellipsis still works). The change queries (SortChanged, ...) report false. RowClicked / RowDoubleClicked return the record whose column was clicked (or -1 on the header column) and DisplayedRows lists every record.

ScrollX scrolls many records sideways (the header column stays pinned); ScrollY bounds the body height. Virtual is ignored: there are as many rows as fields (usually few) and record columns are not virtualized.

func (*TableW) TransposedColumnWidth 实验性 ​

go
func (t *TableW) TransposedColumnWidth(px float32) *TableW

TransposedColumnWidth sets the width of every record column of a Transposed table (default 160). It is a minimum: in a wider table the record columns share the free width equally (the header column keeps its width); when they do not fit, the body scrolls sideways.

func (*TableW) TransposedHeader 实验性 ​

go
func (t *TableW) TransposedHeader(title func(row int) string) *TableW

TransposedHeader titles the record columns of a Transposed table: title returns the column title of record row. Without it the transposed table has no header row.

func (*TableW) TransposedHeaderFixed 实验性 ​

go
func (t *TableW) TransposedHeaderFixed(on bool) *TableW

TransposedHeaderFixed pins the header column of a Transposed table to the inline start while the records scroll sideways (default on; the right edge in RTL).

func (*TableW) TransposedHeaderWidth 实验性 ​

go
func (t *TableW) TransposedHeaderWidth(px float32) *TableW

TransposedHeaderWidth sets the width of the header column of a Transposed table (default: the widest field title plus cell padding, at least 80).

func (*TableW) Tree 实验性 ​

go
func (t *TableW) Tree(roots []int, children func(row int) []int) *TableW

Tree shows hierarchical data: roots are the top-level row ids and children lists a row's child rows.

func (*TableW) TreeLazy 实验性 ​

go
func (t *TableW) TreeLazy(has func(row int) bool, load func(row int)) *TableW

TreeLazy loads children on demand: has reports rows that have children not loaded yet; load is called once when such a row is expanded (the app fetches, appends children and calls Invalidate). A spinner shows meanwhile.

func (*TableW) TreeOpenKeys 实验性 ​

go
func (t *TableW) TreeOpenKeys(keys *[]string) *TableW

TreeOpenKeys binds the expanded tree nodes (controlled).

func (*TableW) Virtual 实验性 ​

go
func (t *TableW) Virtual() *TableW

Virtual is Table V2 mode: a bounded body (ScrollY) where only visible rows and columns are built. Rows are fixed-height unless a column wraps (Wrap): then visible rows are measured, the rest estimated, and the heights cached. With ScrollY the table always virtualizes; Virtual documents the intent.

TabsLocale ​

go
type TabsLocale struct {
	More, Add string
	// contains filtered or unexported fields
}

TabsLocale holds the accessible names of the Tabs overflow and add buttons.

TabsW ​

go
type TabsW struct {
	// contains filtered or unexported fields
}

TabsW is a tab bar: line or card style, editable cards (close and add buttons), top / bottom / left / right placement, centered tabs and a scrolling tab list with a "more" dropdown for the tabs that do not fit.

func Tabs ​

go
func Tabs(c *Context, active *string, items []TabItem) *TabsW

Tabs adds a tab bar bound to the active key; render the panel yourself based on *active (or with Panel). Call Show after options.

ConfigProvider.Defaults("Tabs", ...) keys: "type" ("line" | "card" | "editable-card" | "border-card"), "size" (ControlSize), "centered" (bool), "tabPlacement" (Placement or Ant v6 "top" | "bottom" | "start" | "end"; the deprecated keys "placement" and "tabPosition" take "top" | "bottom" | "left" | "right" too), "stretch" (bool), "tabBarGutter" (px), "variant" ("default" | "line", the shadcn TabsList variant).

active may be nil (the Tabs keep the key themselves). When *active is not a key of items, the tab at the last active index (clamped; the first tab at first) becomes active, like Ant's Tabs when the active key goes away; Changed does not report that fallback.

Under shadcn/ui every combination is drawn as the segmented TabsList (muted track, background pill with shadow-sm): vertical placements stack the triggers, Closable adds a small x to each trigger, OnAdd a ghost + button after the list, Card switches to an outline track and BorderCard puts the list and panel in a bordered card.

func (*TabsW) ActiveTabFontWeight ​

go
func (t *TabsW) ActiveTabFontWeight(weight int) *TabsW

ActiveTabFontWeight sets the active tab label's font weight (100–900). Zero restores the theme weight.

func (*TabsW) AddIcon ​

go
func (t *TabsW) AddIcon(ic *icon.Icon) *TabsW

AddIcon replaces the + of the add button (Ant addIcon).

func (*TabsW) Added ​

go
func (t *TabsW) Added() bool

Added reports a click on the add button this frame.

func (*TabsW) BeforeLeave ​

go
func (t *TabsW) BeforeLeave(fn func(newKey, oldKey string) bool) *TabsW

BeforeLeave is asked before the active tab changes (Element before-leave): returning false keeps the current tab.

func (*TabsW) BorderCard ​

go
func (t *TabsW) BorderCard() *TabsW

BorderCard puts the bar and the panel built by Panel in a bordered card whose header strip holds the tabs (Element type="border-card").

func (*TabsW) Card ​

go
func (t *TabsW) Card() *TabsW

func (*TabsW) Centered ​

go
func (t *TabsW) Centered() *TabsW

Centered centers the tabs in the bar.

func (*TabsW) Changed ​

go
func (t *TabsW) Changed() bool

func (*TabsW) Closable ​

go
func (t *TabsW) Closable() *TabsW

Closable makes an editable card bar (Ant type="editable-card", Element closable): every tab without NoClose gets a close button; read Closed. Delete or Backspace on a focused tab closes it too.

func (*TabsW) Closed ​

go
func (t *TabsW) Closed() string

Closed returns the key of the tab closed this frame ("" when none). The app removes it from the items (and picks a new active key).

func (*TabsW) Draggable ​

go
func (t *TabsW) Draggable() *TabsW

Draggable lets the user reorder the tabs by dragging them (the moved tab becomes active); read the new order with Reordered. With the keyboard, Shift plus the shortcut modifier (Ctrl, Cmd on macOS) and the arrow keys move the focused tab.

func (*TabsW) Extra ​

go
func (t *TabsW) Extra(fn func()) *TabsW

func (*TabsW) ExtraLeft ​

go
func (t *TabsW) ExtraLeft(fn func()) *TabsW

ExtraLeft builds content at the start of the bar, before the tabs (Ant tabBarExtraContent.left); Extra is the right one.

func (*TabsW) Height ​

go
func (t *TabsW) Height(px float32) *TabsW

Height fixes the height of a Left / Right Tabs (bar and panel); tabs that do not fit scroll and are listed in the more menu.

func (*TabsW) Indicator ​

go
func (t *TabsW) Indicator(size float32, align string) *TabsW

Indicator sets the ink bar of line tabs (Ant v6 indicator): size is its length in px (0: the tab's extent; Element: the label's), align places it along the tab: "start", "center" (default) or "end".

func (*TabsW) IndicatorThickness ​

go
func (t *TabsW) IndicatorThickness(px float32) *TabsW

IndicatorThickness sets the cross-axis thickness of a line-tab indicator in logical pixels. A non-positive value restores the theme thickness.

func (*TabsW) MoreIcon ​

go
func (t *TabsW) MoreIcon(ic *icon.Icon) *TabsW

MoreIcon replaces the icon of the more button (Ant more.icon).

func (*TabsW) NoMargin ​

go
func (t *TabsW) NoMargin() *TabsW

NoMargin drops the gap between the bar and the content (for a bar that sits at the bottom edge of a header, as in PageContainer).

func (*TabsW) OnAdd ​

go
func (t *TabsW) OnAdd(fn func()) *TabsW

OnAdd shows the add button of an editable card bar; fn runs when it is clicked (Added reports it as well).

func (*TabsW) OnTearOff ​

go
func (t *TabsW) OnTearOff(fn func(key string, pos geom.Point)) *TabsW

OnTearOff makes the tabs draggable and lets a tab be dragged out of the window: released outside, fn runs with its key and the release point, and TornOff reports them. pos is in the window's logical coordinates, so it lies outside the window's bounds (negative, or past its size); package ui does not know where the window is on the screen, so add the window's position (for a uihost window, tango.Surface.Bounds) to place a new window under the pointer. The bar does not remove the tab: the application opens it in a new window and removes it from the items.

func (*TabsW) Panel ​

go
func (t *TabsW) Panel(fn func()) *Box

Panel builds the content of the active tab in a tab panel (exposed to screen readers as the tabpanel labelled by the active tab). Call it after Show; rendering the panel without it works too. With Bottom, Left or Right placement the panel is placed next to the bar.

func (*TabsW) Placement ​

go
func (t *TabsW) Placement(p Placement) *TabsW

Placement puts the bar at the Top (default), Bottom, Left or Right of the panel built by Panel. Left and Right are logical: in a right-to-left scope a Left bar sits on the right (the start side), as the layout mirrors the row of bar and panel. This is Ant v6 tabPlacement (TabPlacement takes its string names; Left = "start", Right = "end").

func (*TabsW) RemoveIcon ​

go
func (t *TabsW) RemoveIcon(ic *icon.Icon) *TabsW

RemoveIcon replaces the x of the close buttons (Ant removeIcon).

func (*TabsW) Reordered ​

go
func (t *TabsW) Reordered() []TabItem

Reordered returns the items in their new order after a drag or keyboard move this frame (nil when none). Assign it to the slice the bar is built from.

func (*TabsW) Show ​

go
func (t *TabsW) Show() *TabsW

Show builds the tab bar.

func (*TabsW) Size ​

go
func (t *TabsW) Size(s ControlSize) *TabsW

func (*TabsW) Stretch ​

go
func (t *TabsW) Stretch() *TabsW

Stretch makes the tabs of a horizontal bar share its width (Element stretch); the bar no longer scrolls.

func (*TabsW) TabBarGutter ​

go
func (t *TabsW) TabBarGutter(px float32) *TabsW

TabBarGutter sets the space between two tabs (Ant tabBarGutter; the default comes from the theme: Ant 32 for line tabs, 2 for cards).

func (*TabsW) TabBarStyle ​

go
func (t *TabsW) TabBarStyle(opts ...layout.Option) *TabsW

TabBarStyle applies layout options to the bar (padding, margin ...; Ant tabBarStyle). They apply after the theme's defaults.

func (*TabsW) TabClicked ​

go
func (t *TabsW) TabClicked() string

TabClicked returns the key of the tab clicked this frame, also when it is already active ("" when none; Ant onTabClick, Element tab-click).

func (*TabsW) TabItemHeight ​

go
func (t *TabsW) TabItemHeight(px float32) *TabsW

TabItemHeight sets the height of horizontal tabs in logical pixels. A non-positive value restores the theme height.

func (*TabsW) TabPlacement ​

go
func (t *TabsW) TabPlacement(p string) *TabsW

TabPlacement puts the bar by Ant v6 name: "top" (default), "bottom", "start" or "end" (logical sides: mirrored in RTL); "left" and "right" are accepted as their deprecated aliases. Same as Placement.

func (*TabsW) TornOff ​

go
func (t *TabsW) TornOff() (key string, pos geom.Point, ok bool)

TornOff reports the tab torn off this frame and its release point (see OnTearOff).

func (*TabsW) Variant ​

go
func (t *TabsW) Variant(v string) *TabsW

Variant picks the list look in every theme: "default" or "line" (line tabs: a transparent list with an underline under the active tab). Where the default bar is a segmented track (TabsToken.SegmentedList: the shadcn TabsList) "line" switches to line tabs; where the default is line tabs already (Ant, Element) it is the same look. Card and BorderCard pick their own types.

TagW ​

go
type TagW struct {
	// contains filtered or unexported fields
}

TagW is a small label.

func Tag ​

go
func Tag(c *Context, label string) *TagW

Tag adds a tag. color may be "success", "processing", "error", "warning", "default", an Ant preset ("blue", "magenta" ...; with the suffix "-inverse", e.g. "blue-inverse", the preset solid unless a Variant is set, like antd), a shadcn Badge variant ("primary", "secondary", "destructive", "outline", "ghost", "link") or a hex color.

ConfigProvider.Defaults("Tag", ...) keys: "size" (ControlSize), "effect", "variant", "color" (string), "bordered" (bool; deprecated, false = variant "filled"), "disabled" (bool).

func (*TagW) Borderless ​

go
func (t *TagW) Borderless() *TagW

Borderless draws the tag without its border.

Deprecated: use Variant("filled") (antd 6 replaced bordered={false}).

func (*TagW) Closable ​

go
func (t *TagW) Closable() *TagW

Closable shows a close icon. The tag becomes a "remove" button for the keyboard: Enter, Space, Delete or Backspace close it.

func (*TagW) CloseIcon ​

go
func (t *TagW) CloseIcon(ic *icon.Icon) *TagW

CloseIcon replaces the close icon (antd closeIcon); it also makes the tag closable.

func (*TagW) Closed ​

go
func (t *TagW) Closed() bool

Closed reports a click on the close icon (or a keyboard close); always false while disabled.

func (*TagW) Color ​

go
func (t *TagW) Color(col string) *TagW

func (*TagW) Disabled ​

go
func (t *TagW) Disabled(on bool) *TagW

Disabled greys the tag out (antd 6 disabled); a disabled closable tag does not close. ConfigProvider.ComponentDisabled applies too.

func (*TagW) Effect ​

go
func (t *TagW) Effect(e string) *TagW

Effect sets the Element theme of the tag: "light" (tinted with a border; = Variant("outlined")), "dark" (solid color, white text; = Variant("solid")) or "plain" (container background, colored border and text). Variant wins when both are set.

func (*TagW) Icon ​

go
func (t *TagW) Icon(ic *icon.Icon) *TagW

func (*TagW) Round ​

go
func (t *TagW) Round() *TagW

Round draws a pill-shaped tag (Element round).

func (*TagW) Size ​

go
func (t *TagW) Size(sz ControlSize) *TagW

Size sets small (20px), middle (default) or large (Element 32px) tags.

func (*TagW) Variant ​

go
func (t *TagW) Variant(v string) *TagW

Variant sets the antd 6 variant: "filled" (tinted, no border; the default outside Element), "solid" (saturated color, light text) or "outlined" (tinted with a border; Element's default light effect).

TextAlign ​

go
type TextAlign uint8

TextAlign aligns text inside its box. Start and End are logical: they resolve per line, so a right-to-left line (Arabic, Hebrew, or any line of an RTL scope) starts at the right edge.

Append-only: never reorder or insert; the zero value stays AlignStart.

go
const (
	// AlignStart aligns each line to its start edge: left for LTR lines,
	// right for RTL lines. It is the zero value.
	AlignStart TextAlign = iota
	// AlignCenter centers each line.
	AlignCenter
	// AlignEnd aligns each line to its end edge: right for LTR lines, left
	// for RTL lines.
	AlignEnd
	// AlignPhysicalLeft always aligns to the left edge.
	AlignPhysicalLeft
	// AlignPhysicalRight always aligns to the right edge.
	AlignPhysicalRight
)

TextAreaW ​

go
type TextAreaW struct {
	// contains filtered or unexported fields
}

TextAreaW is a multi-line input with character count, auto-size, clear button and wheel scrolling (Ant Input.TextArea, Element type=textarea).

func TextArea ​

go
func TextArea(c *Context, val *string) *TextAreaW

TextArea adds a multi-line input bound to *val.

func (*TextAreaW) A11yLabel ​

go
func (w *TextAreaW) A11yLabel(s string) *TextAreaW

A11yLabel sets the accessible name. Inside a FormItem the item label is used; otherwise the placeholder is the last resort.

func (*TextAreaW) AllowClear ​

go
func (w *TextAreaW) AllowClear() *TextAreaW

func (*TextAreaW) AutoSize ​

go
func (w *TextAreaW) AutoSize(minRows, maxRows int) *TextAreaW

AutoSize grows the box with its content between minRows and maxRows (maxRows <= 0: unbounded); beyond maxRows the content scrolls.

func (*TextAreaW) Changed ​

go
func (w *TextAreaW) Changed() bool

Changed reports an edit this frame.

func (*TextAreaW) Disabled ​

go
func (w *TextAreaW) Disabled(on bool) *TextAreaW

func (*TextAreaW) Exceed ​

go
func (w *TextAreaW) Exceed() *TextAreaW

Exceed lets the text grow beyond MaxLength and marks it as an error instead of truncating.

func (*TextAreaW) Focused ​

go
func (w *TextAreaW) Focused() bool

Focused reports keyboard focus.

func (*TextAreaW) ID ​

go
func (w *TextAreaW) ID() ID

ID returns the editor ID.

func (*TextAreaW) Layout ​

go
func (w *TextAreaW) Layout(o ...layout.Option) *TextAreaW

func (*TextAreaW) MaxLength ​

go
func (w *TextAreaW) MaxLength(n int) *TextAreaW

MaxLength limits the number of characters (see Exceed).

func (*TextAreaW) Placeholder ​

go
func (w *TextAreaW) Placeholder(s string) *TextAreaW

func (*TextAreaW) ReadOnly ​

go
func (w *TextAreaW) ReadOnly() *TextAreaW

ReadOnly prevents edits but allows selection and scrolling (antd / Element readonly).

func (*TextAreaW) Rows ​

go
func (w *TextAreaW) Rows(n int) *TextAreaW

Rows sets the fixed number of visible rows (default 2, like antd's native textarea and Element's rows).

func (*TextAreaW) ShowCount ​

go
func (w *TextAreaW) ShowCount() *TextAreaW

ShowCount shows "count / max".

func (*TextAreaW) Status ​

go
func (w *TextAreaW) Status(s string) *TextAreaW

func (*TextAreaW) Variant ​

go
func (w *TextAreaW) Variant(v string) *TextAreaW

Variant sets the frame look like InputW.Variant: "outlined" (default), "filled", "borderless" or "underlined" (antd TextArea variant).

func (*TextAreaW) Width ​

go
func (w *TextAreaW) Width(px float32) *TextAreaW

TextInputStateWindow 实验性 ​

go
type TextInputStateWindow interface {
	SetTextInputState(st input.TextInputState)
}

TextInputStateWindow is implemented by windows whose input method can use the text around the caret. SetTextInputState is called after SetTextInput(true, …) whenever the focused field's state changes. When focus moves to a text widget without a state, the Runner turns text input off and on again so the platform forgets the old state.

ThoughtChainW 实验性 ​

go
type ThoughtChainW struct {
	// contains filtered or unexported fields
}

ThoughtChainW is a vertical chain of steps with status icons, durations and collapsible details, optionally under a collapsible title.

func ThoughtChain 实验性 ​

go
func ThoughtChain(c *Context, items []ChainItem) *ThoughtChainW

ThoughtChain adds a chain of steps.

ui.ThoughtChain(c, steps).Title("思考过程").Card()

func (*ThoughtChainW) Card 实验性 ​

go
func (w *ThoughtChainW) Card() *ThoughtChainW

Card draws the chain inside a bordered card.

func (*ThoughtChainW) DefaultCollapsed 实验性 ​

go
func (w *ThoughtChainW) DefaultCollapsed() *ThoughtChainW

DefaultCollapsed starts with the steps hidden (needs Title).

func (*ThoughtChainW) Expanded 实验性 ​

go
func (w *ThoughtChainW) Expanded() bool

Expanded reports whether the steps are shown.

func (*ThoughtChainW) ItemToggled 实验性 ​

go
func (w *ThoughtChainW) ItemToggled() (string, bool)

ItemToggled returns the key of the step whose detail was opened or closed this frame.

func (*ThoughtChainW) Layout 实验性 ​

go
func (w *ThoughtChainW) Layout(opts ...layout.Option) *ThoughtChainW

Layout applies layout options to the chain.

func (*ThoughtChainW) Title 实验性 ​

go
func (w *ThoughtChainW) Title(s string) *ThoughtChainW

Title adds a header that collapses the chain and shows its progress.

func (*ThoughtChainW) Toggled 实验性 ​

go
func (w *ThoughtChainW) Toggled() bool

Toggled reports a click on the title this frame.

TimePanelW 实验性 ​

go
type TimePanelW struct {
	// contains filtered or unexported fields
}

TimePanelW is a standalone set of hour/minute/second columns.

func TimePanel 实验性 ​

go
func TimePanel(c *Context, val *time.Time) *TimePanelW

TimePanel adds hour/minute(/second) scroll columns bound to *val. It is focusable: Up/Down change the active column, Left/Right switch columns.

ConfigProvider.Defaults("TimePicker", ...) keys "format", "use12Hours", "hourStep", "minuteStep", "secondStep" and "hideDisabledOptions" apply.

func (*TimePanelW) A11yLabel 实验性 ​

go
func (w *TimePanelW) A11yLabel(s string) *TimePanelW

A11yLabel sets the accessible name (default: the Locale's SelectTime).

func (*TimePanelW) Changed 实验性 ​

go
func (w *TimePanelW) Changed() bool

Changed reports a new value this frame.

func (*TimePanelW) DisabledHours 实验性 ​

go
func (w *TimePanelW) DisabledHours(fn func(h int) bool) *TimePanelW

DisabledHours marks hours (0-23) that cannot be picked.

func (*TimePanelW) DisabledMinutes 实验性 ​

go
func (w *TimePanelW) DisabledMinutes(fn func(h, m int) bool) *TimePanelW

DisabledMinutes marks minutes of hour h that cannot be picked.

func (*TimePanelW) DisabledSeconds 实验性 ​

go
func (w *TimePanelW) DisabledSeconds(fn func(h, m, s int) bool) *TimePanelW

DisabledSeconds marks seconds of h:m that cannot be picked.

func (*TimePanelW) Format 实验性 ​

go
func (w *TimePanelW) Format(f string) *TimePanelW

Format sets the Go layout that decides the columns ("15:04" or "15:04:05").

func (*TimePanelW) Height 实验性 ​

go
func (w *TimePanelW) Height(px float32) *TimePanelW

Height sets the column height.

func (*TimePanelW) HideDisabledOptions 实验性 ​

go
func (w *TimePanelW) HideDisabledOptions(on bool) *TimePanelW

HideDisabledOptions leaves disabled options out of the columns.

func (*TimePanelW) Steps 实验性 ​

go
func (w *TimePanelW) Steps(h, m, s int) *TimePanelW

Steps sets the hour, minute and second steps.

func (*TimePanelW) Use12Hours 实验性 ​

go
func (w *TimePanelW) Use12Hours() *TimePanelW

Use12Hours shows a 12-hour clock with an AM / PM column.

TimePickerLocale ​

go
type TimePickerLocale struct {
	StartTime, EndTime string // range placeholders
	AM, PM             string // 12-hour clock words
	Meridiem           string // accessible name of the AM / PM column
	// contains filtered or unexported fields
}

TimePickerLocale holds the TimePicker / TimeRangePicker texts.

TimePickerW ​

go
type TimePickerW struct {
	// contains filtered or unexported fields
}

TimePickerW is an input with a dropdown of time columns.

func TimePicker ​

go
func TimePicker(c *Context, val *time.Time) *TimePickerW

TimePicker adds a time input bound to *val (zero = empty). The date part of a new value is today's date.

ConfigProvider.Defaults("TimePicker", ...) keys: "format", "placeholder", "use12Hours", "hourStep", "minuteStep", "secondStep", "allowClear", "width", "size", "variant", "hideDisabledOptions", "placement", "showNow", "needConfirm".

func (*TimePickerW) A11yLabel ​

go
func (w *TimePickerW) A11yLabel(s string) *TimePickerW

A11yLabel sets the accessible name (inside a FormItem the item label is used; the placeholder is the last resort).

func (*TimePickerW) AllowClear ​

go
func (w *TimePickerW) AllowClear(on bool) *TimePickerW

AllowClear toggles the clear button (on by default).

func (*TimePickerW) Changed ​

go
func (w *TimePickerW) Changed() bool

Changed reports a committed value this frame.

func (*TimePickerW) Disabled ​

go
func (w *TimePickerW) Disabled(on bool) *TimePickerW

Disabled disables the picker.

func (*TimePickerW) DisabledHours ​

go
func (w *TimePickerW) DisabledHours(fn func(h int) bool) *TimePickerW

DisabledHours marks hours (0-23) that cannot be picked or typed.

func (*TimePickerW) DisabledMinutes ​

go
func (w *TimePickerW) DisabledMinutes(fn func(h, m int) bool) *TimePickerW

DisabledMinutes marks minutes of hour h that cannot be picked or typed.

func (*TimePickerW) DisabledSeconds ​

go
func (w *TimePickerW) DisabledSeconds(fn func(h, m, s int) bool) *TimePickerW

DisabledSeconds marks seconds of h:m that cannot be picked or typed.

func (*TimePickerW) Format ​

go
func (w *TimePickerW) Format(f string) *TimePickerW

Format sets the Go time layout, e.g. "15:04:05" (default), "15:04" or with Use12Hours "03:04 PM" (AM / PM are shown with the Locale words).

func (*TimePickerW) HideDisabledOptions ​

go
func (w *TimePickerW) HideDisabledOptions(on bool) *TimePickerW

HideDisabledOptions leaves disabled hours, minutes and seconds out of the columns instead of greying them (Ant hideDisabledOptions).

func (*TimePickerW) HourStep ​

go
func (w *TimePickerW) HourStep(n int) *TimePickerW

func (*TimePickerW) IsOpen ​

go
func (w *TimePickerW) IsOpen() bool

IsOpen reports whether the dropdown is shown.

func (*TimePickerW) Layout ​

go
func (w *TimePickerW) Layout(o ...layout.Option) *TimePickerW

Layout applies layout options to the input frame.

func (*TimePickerW) MinuteStep ​

go
func (w *TimePickerW) MinuteStep(n int) *TimePickerW

func (*TimePickerW) NeedConfirm ​

go
func (w *TimePickerW) NeedConfirm(on bool) *TimePickerW

NeedConfirm keeps column picks as a draft until OK or Enter (Ant needConfirm; on by default for time pickers). With NeedConfirm(false) every pick in the columns (or arrow key step) sets the value at once, the panel stays open and the OK button is left out.

func (*TimePickerW) Open ​

go
func (w *TimePickerW) Open() *TimePickerW

Open forces the dropdown open (screenshots, tests).

func (*TimePickerW) Placeholder ​

go
func (w *TimePickerW) Placeholder(s string) *TimePickerW

func (*TimePickerW) Placement ​

go
func (w *TimePickerW) Placement(p Placement) *TimePickerW

Placement sets where the columns open: BottomStart (default), BottomEnd, TopStart or TopEnd (Ant placement); they flip when there is no room.

func (*TimePickerW) SecondStep ​

go
func (w *TimePickerW) SecondStep(n int) *TimePickerW

func (*TimePickerW) ShowNow ​

go
func (w *TimePickerW) ShowNow(on bool) *TimePickerW

ShowNow toggles the Now link in the footer (Ant showNow, on by default).

func (*TimePickerW) Size ​

go
func (w *TimePickerW) Size(s ControlSize) *TimePickerW

func (*TimePickerW) Status ​

go
func (w *TimePickerW) Status(s string) *TimePickerW

func (*TimePickerW) Steps ​

go
func (w *TimePickerW) Steps(h, m, s int) *TimePickerW

Steps sets the hour, minute and second steps at once.

func (*TimePickerW) Use12Hours ​

go
func (w *TimePickerW) Use12Hours() *TimePickerW

Use12Hours shows a 12-hour clock: hours 12, 01 … 11 and an AM / PM column; the default format becomes "03:04:05 PM".

func (*TimePickerW) Variant ​

go
func (w *TimePickerW) Variant(v string) *TimePickerW

Variant sets the frame look: "outlined" (default), "filled", "borderless" or "underlined".

func (*TimePickerW) Width ​

go
func (w *TimePickerW) Width(px float32) *TimePickerW

TimeRangePickerW 实验性 ​

go
type TimeRangePickerW struct {
	// contains filtered or unexported fields
}

TimeRangePickerW selects a start and an end time.

func TimeRangePicker 实验性 ​

go
func TimeRangePicker(c *Context, val *[2]time.Time) *TimeRangePickerW

TimeRangePicker adds a time range input bound to *val ([start, end], zero = empty). Both ends are edited in side-by-side columns and committed with OK (or Enter); the result is ordered by clock (see Order). Each end can also be typed: printable keys edit the active end, Enter applies valid text (and commits once both ends are set), invalid or disabled text is dropped.

ui.TimeRangePicker(c, &span).Format("15:04").MinuteStep(15)

ConfigProvider.Defaults("TimeRangePicker", ...) keys: "format", "separator", "use12Hours", "hourStep", "minuteStep", "secondStep", "allowClear", "width", "size", "variant", "hideDisabledOptions", "placeholder" ([2]string), "placement", "order".

func (*TimeRangePickerW) A11yLabel 实验性 ​

go
func (w *TimeRangePickerW) A11yLabel(s string) *TimeRangePickerW

A11yLabel sets the accessible name (inside a FormItem the item label is used; otherwise the two placeholders).

func (*TimeRangePickerW) AllowClear 实验性 ​

go
func (w *TimeRangePickerW) AllowClear(on bool) *TimeRangePickerW

func (*TimeRangePickerW) Changed 实验性 ​

go
func (w *TimeRangePickerW) Changed() bool

Changed reports a committed range this frame.

func (*TimeRangePickerW) Disabled 实验性 ​

go
func (w *TimeRangePickerW) Disabled(on bool) *TimeRangePickerW

Disabled disables the picker.

func (*TimeRangePickerW) DisabledHours 实验性 ​

go
func (w *TimeRangePickerW) DisabledHours(fn func(h int) bool) *TimeRangePickerW

DisabledHours marks hours (0-23) that cannot be picked.

func (*TimeRangePickerW) DisabledMinutes 实验性 ​

go
func (w *TimeRangePickerW) DisabledMinutes(fn func(h, m int) bool) *TimeRangePickerW

DisabledMinutes marks minutes of hour h that cannot be picked.

func (*TimeRangePickerW) DisabledSeconds 实验性 ​

go
func (w *TimeRangePickerW) DisabledSeconds(fn func(h, m, s int) bool) *TimeRangePickerW

DisabledSeconds marks seconds of h:m that cannot be picked.

func (*TimeRangePickerW) Format 实验性 ​

go
func (w *TimeRangePickerW) Format(f string) *TimeRangePickerW

Format sets the Go time layout ("15:04:05" default, "15:04", or with Use12Hours "03:04 PM").

func (*TimeRangePickerW) HideDisabledOptions 实验性 ​

go
func (w *TimeRangePickerW) HideDisabledOptions(on bool) *TimeRangePickerW

HideDisabledOptions leaves disabled hours, minutes and seconds out of the columns instead of greying them (Ant hideDisabledOptions).

func (*TimeRangePickerW) HourStep 实验性 ​

go
func (w *TimeRangePickerW) HourStep(n int) *TimeRangePickerW

func (*TimeRangePickerW) IsOpen 实验性 ​

go
func (w *TimeRangePickerW) IsOpen() bool

IsOpen reports whether the dropdown is shown.

func (*TimeRangePickerW) Layout 实验性 ​

go
func (w *TimeRangePickerW) Layout(o ...layout.Option) *TimeRangePickerW

func (*TimeRangePickerW) MinuteStep 实验性 ​

go
func (w *TimeRangePickerW) MinuteStep(n int) *TimeRangePickerW

func (*TimeRangePickerW) Open 实验性 ​

go
func (w *TimeRangePickerW) Open() *TimeRangePickerW

Open forces the dropdown open (screenshots, tests).

func (*TimeRangePickerW) Order 实验性 ​

go
func (w *TimeRangePickerW) Order(on bool) *TimeRangePickerW

Order toggles sorting the two ends by clock (Ant order, on by default). Order(false) keeps an end earlier than the start, e.g. an overnight shift 22:00 – 06:00.

func (*TimeRangePickerW) Placeholder 实验性 ​

go
func (w *TimeRangePickerW) Placeholder(start, end string) *TimeRangePickerW

func (*TimeRangePickerW) Placement 实验性 ​

go
func (w *TimeRangePickerW) Placement(p Placement) *TimeRangePickerW

Placement sets where the columns open: BottomStart (default), BottomEnd, TopStart or TopEnd (Ant placement); they flip when there is no room.

func (*TimeRangePickerW) SecondStep 实验性 ​

go
func (w *TimeRangePickerW) SecondStep(n int) *TimeRangePickerW

func (*TimeRangePickerW) Separator 实验性 ​

go
func (w *TimeRangePickerW) Separator(s string) *TimeRangePickerW

Separator sets the text between the two ends (Ant separator, Element range-separator; default the Locale's RangeSeparator).

func (*TimeRangePickerW) Size 实验性 ​

go
func (w *TimeRangePickerW) Size(s ControlSize) *TimeRangePickerW

func (*TimeRangePickerW) Status 实验性 ​

go
func (w *TimeRangePickerW) Status(s string) *TimeRangePickerW

func (*TimeRangePickerW) Use12Hours 实验性 ​

go
func (w *TimeRangePickerW) Use12Hours() *TimeRangePickerW

Use12Hours shows 12-hour columns with AM / PM.

func (*TimeRangePickerW) Variant 实验性 ​

go
func (w *TimeRangePickerW) Variant(v string) *TimeRangePickerW

Variant sets the frame look: "outlined" (default), "filled", "borderless" or "underlined".

func (*TimeRangePickerW) Width 实验性 ​

go
func (w *TimeRangePickerW) Width(px float32) *TimeRangePickerW

TimeSelectW 实验性 ​

go
type TimeSelectW struct {
	// contains filtered or unexported fields
}

TimeSelectW picks a "HH:MM" time from a fixed list generated by Start/End/Step.

func TimeSelect 实验性 ​

go
func TimeSelect(c *Context, val *string) *TimeSelectW

TimeSelect adds a time select bound to *val ("HH:MM", "" = empty). Defaults follow Element: 09:00–18:00 every 00:30.

ConfigProvider.Defaults("TimeSelect", ...) keys: "start", "end", "step", "placeholder", "clearable" (Element) / "allowClear", "size", "width", "variant".

func (*TimeSelectW) A11yLabel 实验性 ​

go
func (w *TimeSelectW) A11yLabel(s string) *TimeSelectW

A11yLabel sets the accessible name (inside a FormItem the item label is used; the placeholder is the last resort).

func (*TimeSelectW) Changed 实验性 ​

go
func (w *TimeSelectW) Changed() bool

Changed reports a new value this frame.

func (*TimeSelectW) Clearable 实验性 ​

go
func (w *TimeSelectW) Clearable(on bool) *TimeSelectW

Clearable shows the clear icon on hover (default on).

func (*TimeSelectW) Disabled 实验性 ​

go
func (w *TimeSelectW) Disabled(on bool) *TimeSelectW

func (*TimeSelectW) End 实验性 ​

go
func (w *TimeSelectW) End(s string) *TimeSelectW

func (*TimeSelectW) IncludeEndTime 实验性 ​

go
func (w *TimeSelectW) IncludeEndTime(on bool) *TimeSelectW

IncludeEndTime adds End as the last option when the steps skip it, e.g. 09:00–17:45 every 00:30 ends with 17:45 (Element include-end-time).

func (*TimeSelectW) IsOpen 实验性 ​

go
func (w *TimeSelectW) IsOpen() bool

IsOpen reports whether the dropdown is shown.

func (*TimeSelectW) Layout 实验性 ​

go
func (w *TimeSelectW) Layout(o ...layout.Option) *TimeSelectW

func (*TimeSelectW) MaxTime 实验性 ​

go
func (w *TimeSelectW) MaxTime(s string) *TimeSelectW

func (*TimeSelectW) MinTime 实验性 ​

go
func (w *TimeSelectW) MinTime(s string) *TimeSelectW

MinTime disables times at or before s; MaxTime disables times at or after s (Element semantics).

func (*TimeSelectW) Open 实验性 ​

go
func (w *TimeSelectW) Open() *TimeSelectW

Open forces the dropdown open (screenshots, tests).

func (*TimeSelectW) Options 实验性 ​

go
func (w *TimeSelectW) Options() []Option

Options returns the generated items (Disabled marks MinTime/MaxTime).

func (*TimeSelectW) Placeholder 实验性 ​

go
func (w *TimeSelectW) Placeholder(s string) *TimeSelectW

func (*TimeSelectW) Placement 实验性 ​

go
func (w *TimeSelectW) Placement(p Placement) *TimeSelectW

Placement sets where the list opens: BottomStart (default), BottomEnd, TopStart or TopEnd (Element placement); it flips when there is no room.

func (*TimeSelectW) Size 实验性 ​

go
func (w *TimeSelectW) Size(s ControlSize) *TimeSelectW

func (*TimeSelectW) Start 实验性 ​

go
func (w *TimeSelectW) Start(s string) *TimeSelectW

Start / End / Step set the generated range ("HH:MM"; End is inclusive).

func (*TimeSelectW) Status 实验性 ​

go
func (w *TimeSelectW) Status(s string) *TimeSelectW

func (*TimeSelectW) Step 实验性 ​

go
func (w *TimeSelectW) Step(s string) *TimeSelectW

func (*TimeSelectW) Variant 实验性 ​

go
func (w *TimeSelectW) Variant(v string) *TimeSelectW

Variant sets the frame look: "outlined" (default), "filled", "borderless" or "underlined".

func (*TimeSelectW) Width 实验性 ​

go
func (w *TimeSelectW) Width(px float32) *TimeSelectW

TimelineItem 实验性 ​

go
type TimelineItem struct {
	Content string // main text (Ant v6 content)
	Body    func() // custom content (replaces Content)
	// Title is the text on the opposite side of the axis (Ant v6 title);
	// any item with a Title centers the axis of a vertical timeline.
	Title string
	// Deprecated: use Title.
	Label   string
	Time    string // Element: timestamp under (or above) the content
	TimeTop bool   // put Time above the content
	// Color is a status ("primary", "success", "warning", "error", "info",
	// "gray") or a hex color; empty uses the theme default.
	Color   string
	DotIcon *icon.Icon // icon instead of the circle
	Dot     func()     // fully custom dot node
	Hollow  bool       // Element: hollow dot
	Large   bool       // Element: larger dot
	// Placement puts this item's content at the "start" or "end" side,
	// overriding the Mode (Ant v6 items[].placement).
	Placement string
	// Loading shows a spinning dot (Ant v6 items[].loading); the axis
	// entering it (leaving it under Reverse) is dotted where the theme's
	// TimelineToken.BusyTailDashed says so.
	Loading bool
	// Center centers the dot vertically on the item (Element center).
	Center bool
}

TimelineItem is one event of a Timeline.

TimelineW 实验性 ​

go
type TimelineW struct {
	// contains filtered or unexported fields
}

TimelineW shows events along a vertical axis.

func Timeline 实验性 ​

go
func Timeline(c *Context, items []TimelineItem) *TimelineW

Timeline starts a timeline; finish with Show.

ConfigProvider.Defaults("Timeline", ...) keys: "mode" ("start" | "end" | "alternate" | "alternate-reverse"; "left" / "right" are the deprecated names of start / end), "reverse" (bool), "orientation" ("vertical" | "horizontal"), "variant" ("outlined" | "filled").

func (*TimelineW) Horizontal 实验性 ​

go
func (w *TimelineW) Horizontal() *TimelineW

Horizontal lays the events out along a horizontal axis (Ant v6 orientation="horizontal"): every event takes an equal share of the width with its dot on the axis. Mode keeps its meaning with the axis turned: "left" / "start" puts the content under the axis, "right" / "end" above it, "alternate" alternates (first under); a Label goes to the opposite side. In RTL the events run from the right.

func (*TimelineW) Layout 实验性 ​

go
func (w *TimelineW) Layout(o ...layout.Option) *TimelineW

Layout applies layout options to the timeline (call after Show).

func (*TimelineW) Mode 实验性 ​

go
func (w *TimelineW) Mode(m string) *TimelineW

Mode places the content: "start" (axis at the inline start, content after it; default), "end" (axis at the inline end), "alternate" (content alternates around a centered axis, the first item after it) or "alternate-reverse" (Element: the first item before it). "left" and "right" are the deprecated Ant names of "start" and "end". Items with a Title also center the axis. The sides are logical: in RTL "start" puts the axis at the right.

func (*TimelineW) Orientation 实验性 ​

go
func (w *TimelineW) Orientation(o string) *TimelineW

Orientation lays the events out "vertical" (default) or "horizontal" (Ant v6 orientation; same as Horizontal).

func (*TimelineW) Pending 实验性 ​

go
func (w *TimelineW) Pending(label string) *TimelineW

Pending appends a "still in progress" item with a spinning dot.

func (*TimelineW) Reverse 实验性 ​

go
func (w *TimelineW) Reverse() *TimelineW

Reverse lists the items in reverse order.

func (*TimelineW) Show 实验性 ​

go
func (w *TimelineW) Show() *TimelineW

Show builds the timeline.

func (*TimelineW) TitleSpan 实验性 ​

go
func (w *TimelineW) TitleSpan(span float32) *TimelineW

TitleSpan sets the share of the width, in 24ths, taken by the titles of a vertical timeline whose items have a Title (Ant titleSpan; default 12, the axis in the middle). Ignored with Mode("alternate").

func (*TimelineW) Variant 实验性 ​

go
func (w *TimelineW) Variant(v string) *TimelineW

Variant sets the dots: "outlined" (a ring, Ant's default) or "filled" (a solid dot, the Element and shadcn default). Empty keeps the theme's (TimelineToken.DotOutlined).

TimerType 实验性 ​

go
type TimerType string

TimerType selects the direction of a StatisticTimer.

go
const (
	// TimerCountdown counts down to the given deadline (as Countdown).
	TimerCountdown TimerType = "countdown"
	// TimerCountup counts up from the given start time.
	TimerCountup TimerType = "countup"
)

实验性

TitleBarLocale 实验性 ​

go
type TitleBarLocale struct {
	Minimize, Maximize, Restore string
	WindowControls              string // accessible name of the button group
	// contains filtered or unexported fields
}

TitleBarLocale holds the window button names of TitleBar and WindowControls (Close is Locale.Close, the full-screen pair Locale.Fullscreen / Locale.ExitFullscreen).

TitleBarW 实验性 ​

go
type TitleBarW struct {
	// contains filtered or unexported fields
}

TitleBarW is the self-drawn title bar TitleBar returns.

func TitleBar 实验性 ​

go
func TitleBar(c *Context) *TitleBarW

TitleBar adds the title bar of a frameless window (SurfaceOptions Appearance.TitleBar = TitleBarNone, or TitleBarHidden on macOS):

ui.TitleBar(c).Icon(icon.Code).Title("Tango — main.go").
	Menu(func() { ui.Menubar(c, menus) }).
	Center(func() { ui.Search(c, &q) }).
	Tools(func() { ui.IconButton(c, icon.Setting, "设置") })

Pressing the bar's empty parts moves the window and a double click maximizes or restores it; the window buttons follow the platform (see WindowControlsStyle). Everything acts on Context.Window when it implements WindowFrame (uihost windows do); without a frame the bar still draws and reports Action.

func (*TitleBarW) Action 实验性 ​

go
func (t *TitleBarW) Action() WindowAction

Action reports the window action the user asked for this frame (a window button, or a double click on the bar), "" for none. A host that handles double clicks on the bar itself (uihost windows with their own UI thread) has already performed the action when Action reports it, one frame later.

func (*TitleBarW) Center 实验性 ​

go
func (t *TitleBarW) Center(fn func()) *TitleBarW

Center builds content in the middle of the bar (a command search box). Without it the title is centered on macOS and follows the menu elsewhere.

func (*TitleBarW) Controls 实验性 ​

go
func (t *TitleBarW) Controls(s WindowControlsStyle) *TitleBarW

Controls picks the window button style (WindowControlsAuto by default).

func (*TitleBarW) Frame 实验性 ​

go
func (t *TitleBarW) Frame(f WindowFrame) *TitleBarW

Frame sets the window the bar drives, in place of Context.Window.

func (*TitleBarW) ID 实验性 ​

go
func (t *TitleBarW) ID() ID

ID returns the bar's ID.

func (*TitleBarW) Icon 实验性 ​

go
func (t *TitleBarW) Icon(ic *icon.Icon) *TitleBarW

Icon shows the app icon at the bar's start.

func (*TitleBarW) Layout 实验性 ​

go
func (t *TitleBarW) Layout(o ...layout.Option) *TitleBarW

Layout adds layout options to the bar.

func (*TitleBarW) Manual 实验性 ​

go
func (t *TitleBarW) Manual() *TitleBarW

Manual only reports window actions (Action) and leaves the window alone; dragging still moves it.

func (*TitleBarW) Menu 实验性 ​

go
func (t *TitleBarW) Menu(fn func()) *TitleBarW

Menu builds content after the icon (a Menubar, a project switcher).

func (*TitleBarW) Title 实验性 ​

go
func (t *TitleBarW) Title(s string) *TitleBarW

Title sets the window title shown in the bar.

func (*TitleBarW) Tools 实验性 ​

go
func (t *TitleBarW) Tools(fn func()) *TitleBarW

Tools builds content before the window buttons (layout toggles, notifications, the account menu).

ToggleGroupW 实验性 ​

go
type ToggleGroupW struct {
	// contains filtered or unexported fields
}

ToggleGroupW is a set of toggles (shadcn/ui ToggleGroup).

func ToggleGroup 实验性 ​

go
func ToggleGroup(c *Context, selected *[]string, opts []Option) *ToggleGroupW

ToggleGroup adds one toggle per option bound to the selected values (multiple selection; Single keeps at most one). The toggles touch, with only the outer corners rounded, unless Spacing separates them.

ConfigProvider.Defaults("ToggleGroup", ...) keys: "size", "variant" ("default" | "outline"), "spacing" (int).

func (*ToggleGroupW) A11yLabel 实验性 ​

go
func (g *ToggleGroupW) A11yLabel(s string) *ToggleGroupW

A11yLabel sets the accessible name of the group.

func (*ToggleGroupW) Changed 实验性 ​

go
func (g *ToggleGroupW) Changed() bool

Changed reports a selection change this frame.

func (*ToggleGroupW) Icons 实验性 ​

go
func (g *ToggleGroupW) Icons(m map[string]*icon.Icon) *ToggleGroupW

Icons draws icon-only toggles; the option labels stay their names.

func (*ToggleGroupW) Outline 实验性 ​

go
func (g *ToggleGroupW) Outline() *ToggleGroupW

Outline joins the toggles into one bordered strip.

func (*ToggleGroupW) Single 实验性 ​

go
func (g *ToggleGroupW) Single() *ToggleGroupW

Single makes the group behave like radio buttons that can be cleared.

func (*ToggleGroupW) Size 实验性 ​

go
func (g *ToggleGroupW) Size(s ControlSize) *ToggleGroupW

Size sets the size of every toggle.

func (*ToggleGroupW) Spacing 实验性 ​

go
func (g *ToggleGroupW) Spacing(n int) *ToggleGroupW

Spacing sets the gap between the toggles in Tailwind spacing units of 4px (shadcn toggle-group spacing, default 0). With 0 the toggles touch and only the group's outer corners are rounded; otherwise every toggle is rounded (and bordered when outlined) on its own. Negative values are treated as 0.

func (*ToggleGroupW) Variant 实验性 ​

go
func (g *ToggleGroupW) Variant(v string) *ToggleGroupW

Variant sets the variant of every toggle: "default" or "outline". Other values are ignored.

ToggleW 实验性 ​

go
type ToggleW struct {
	// contains filtered or unexported fields
}

ToggleW is a two-state button (shadcn/ui Toggle): transparent when off, accent-filled when on.

func Toggle 实验性 ​

go
func Toggle(c *Context, label string, on *bool) *ToggleW

Toggle adds a toggle button bound to *on. label may be "" for an icon-only toggle (it still names the control for tests).

func (*ToggleW) A11yLabel 实验性 ​

go
func (w *ToggleW) A11yLabel(s string) *ToggleW

A11yLabel sets the accessible name (icon-only toggles built with an empty label).

func (*ToggleW) Changed 实验性 ​

go
func (w *ToggleW) Changed() bool

Changed reports a flip this frame.

func (*ToggleW) Disabled 实验性 ​

go
func (w *ToggleW) Disabled(on bool) *ToggleW

Disabled disables the toggle when on.

func (*ToggleW) ID 实验性 ​

go
func (w *ToggleW) ID() ID

ID returns the widget ID.

func (*ToggleW) Icon 实验性 ​

go
func (w *ToggleW) Icon(ic *icon.Icon) *ToggleW

Icon puts an icon before the label (or alone when the label is shown only to tests: use IconOnly).

func (*ToggleW) IconOnly 实验性 ​

go
func (w *ToggleW) IconOnly(ic *icon.Icon) *ToggleW

IconOnly draws just the icon; the label stays the accessible name.

func (*ToggleW) Outline 实验性 ​

go
func (w *ToggleW) Outline() *ToggleW

Outline adds the input border and shadow (shadcn variant="outline").

func (*ToggleW) Size 实验性 ​

go
func (w *ToggleW) Size(s ControlSize) *ToggleW

Size sets the control size.

func (*ToggleW) Variant 实验性 ​

go
func (w *ToggleW) Variant(v string) *ToggleW

Variant sets the shadcn variant: "default" (transparent) or "outline". Other values are ignored.

ToolCallW 实验性 ​

go
type ToolCallW struct {
	// contains filtered or unexported fields
}

ToolCallW is a collapsible card for one tool invocation: name, summary, status and duration in the header; arguments and result in the body.

func ToolCall 实验性 ​

go
func ToolCall(c *Context, name string) *ToolCallW

ToolCall adds a tool call card for tool name.

ui.ToolCall(c, "read_file").Summary("src/main.go").Status(ui.ChainSuccess).
	Duration(320*time.Millisecond).Args(`{"path":"src/main.go"}`).Result(out)

func (*ToolCallW) Args 实验性 ​

go
func (w *ToolCallW) Args(s string) *ToolCallW

Args sets the arguments shown in the body (JSON by default, see Lang).

func (*ToolCallW) Body 实验性 ​

go
func (w *ToolCallW) Body(fn func()) *ToolCallW

Body adds custom content at the end of the expanded body (a diff, an image, an Approval).

func (*ToolCallW) DefaultOpen 实验性 ​

go
func (w *ToolCallW) DefaultOpen() *ToolCallW

DefaultOpen starts expanded.

func (*ToolCallW) Duration 实验性 ​

go
func (w *ToolCallW) Duration(d time.Duration) *ToolCallW

Duration shows how long the call took.

func (*ToolCallW) Icon 实验性 ​

go
func (w *ToolCallW) Icon(ic *icon.Icon) *ToolCallW

Icon replaces the tool icon.

func (*ToolCallW) Lang 实验性 ​

go
func (w *ToolCallW) Lang(args, result string) *ToolCallW

Lang sets the code languages of the arguments and the result (default "json" and none).

func (*ToolCallW) Layout 实验性 ​

go
func (w *ToolCallW) Layout(opts ...layout.Option) *ToolCallW

Layout applies layout options to the card.

func (*ToolCallW) Open 实验性 ​

go
func (w *ToolCallW) Open() bool

Open reports whether the body is shown.

func (*ToolCallW) Result 实验性 ​

go
func (w *ToolCallW) Result(s string) *ToolCallW

Result sets the output shown in the body.

func (*ToolCallW) Started 实验性 ​

go
func (w *ToolCallW) Started(t time.Time) *ToolCallW

Started shows the live elapsed time while the call is running.

func (*ToolCallW) Status 实验性 ​

go
func (w *ToolCallW) Status(s ChainStatus) *ToolCallW

Status sets the call's state (default ChainPending).

func (*ToolCallW) Summary 实验性 ​

go
func (w *ToolCallW) Summary(s string) *ToolCallW

Summary shows a short description after the name (a path, a query).

func (*ToolCallW) Toggled 实验性 ​

go
func (w *ToolCallW) Toggled() bool

Toggled reports a click on the header this frame.

TooltipW ​

go
type TooltipW struct {
	*Box
	// contains filtered or unexported fields
}

TooltipW is a tooltip wrapped around trigger content. It embeds the anchor *Box, so code that used the box Tooltip returned keeps working. Options apply when the build finishes (or at IsOpen).

ConfigProvider.Defaults("Tooltip", ...) keys: "placement", "trigger", "color", "effect" (string), "arrow" (bool), "mouseEnterDelay", "mouseLeaveDelay" (time.Duration).

func Tooltip ​

go
func Tooltip(c *Context, tip string, fn func()) *TooltipW

Tooltip wraps fn's content and shows tip above it while hovered (or while keyboard focus is inside). The hover delays default to the theme (antd 0.1 s / 0.1 s, Element 0 / 0.2 s, shadcn 0 / 0).

func (*TooltipW) Arrow ​

go
func (t *TooltipW) Arrow(on bool) *TooltipW

Arrow shows or hides the arrow (default on).

func (*TooltipW) Color ​

go
func (t *TooltipW) Color(s string) *TooltipW

Color sets the bubble color: a status ("success", "error" ...), an Ant preset name ("blue", "magenta" ...) or "#rrggbb".

func (*TooltipW) Content ​

go
func (t *TooltipW) Content(fn func()) *TooltipW

Content replaces the text with rich content built by fn (the tip text still describes the trigger to screen readers).

func (*TooltipW) Disabled ​

go
func (t *TooltipW) Disabled(on bool) *TooltipW

Disabled stops the tooltip from showing (Element disabled).

func (*TooltipW) Effect ​

go
func (t *TooltipW) Effect(s string) *TooltipW

Effect "light" draws a light bubble with a border (Element effect); "dark" is the default.

func (*TooltipW) IsOpen ​

go
func (t *TooltipW) IsOpen() bool

IsOpen reports whether the tooltip is shown this frame.

func (*TooltipW) MouseEnterDelay ​

go
func (t *TooltipW) MouseEnterDelay(d time.Duration) *TooltipW

MouseEnterDelay waits d before showing on hover (Element show-after; default: the theme's TooltipToken.MouseEnterDelay).

func (*TooltipW) MouseLeaveDelay ​

go
func (t *TooltipW) MouseLeaveDelay(d time.Duration) *TooltipW

MouseLeaveDelay keeps the tooltip for d after the pointer left (Element hide-after; default: TooltipToken.MouseLeaveDelay).

func (*TooltipW) Open ​

go
func (t *TooltipW) Open(v *bool) *TooltipW

Open binds the open state (antd open / onOpenChange): *v decides whether the tooltip shows, and the trigger writes its wish (hover, focus, click) into *v when it changes. OpenChanged reports such a write.

func (*TooltipW) OpenChanged ​

go
func (t *TooltipW) OpenChanged() bool

OpenChanged reports that the trigger changed the Open state this frame.

func (*TooltipW) Placement ​

go
func (t *TooltipW) Placement(s string) *TooltipW

Placement: top (default), topLeft, topRight, bottom, bottomLeft, bottomRight, left, leftTop, leftBottom, right, rightTop, rightBottom. Left and right are logical (start / end): mirrored in RTL.

func (*TooltipW) Trigger ​

go
func (t *TooltipW) Trigger(s string) *TooltipW

Trigger: "hover" (default; keyboard focus shows it too), "click" or "focus".

TopNavHeaderW 实验性 ​

go
type TopNavHeaderW struct {
	// contains filtered or unexported fields
}

TopNavHeaderW exposes ProLayout's horizontal header as a reusable entry. The desktop top menu is always expanded; overflow is handled by Menu, not by an additional sidebar collapse button (matching Pro v3).

func TopNavHeader 实验性 ​

go
func TopNavHeader(c *Context, menu []MenuItem, selected *string) *TopNavHeaderW

TopNavHeader starts a top navigation header; chain options, then Show. ConfigProvider.Defaults("TopNavHeader", ...): "title", "contentWidth", "userName" (string). Navigation selection is owned by selected.

func (*TopNavHeaderW) Actions 实验性 ​

go
func (w *TopNavHeaderW) Actions(fn func()) *TopNavHeaderW

Actions builds the trailing actions before the avatar.

func (*TopNavHeaderW) ContentWidth 实验性 ​

go
func (w *TopNavHeaderW) ContentWidth(s string) *TopNavHeaderW

ContentWidth selects Fluid or Fixed (1152px, centred).

go
func (w *TopNavHeaderW) Logo(ic *icon.Icon) *TopNavHeaderW

Logo replaces the default logo mark.

func (*TopNavHeaderW) OnMenuHeaderClick 实验性 ​

go
func (w *TopNavHeaderW) OnMenuHeaderClick(fn func()) *TopNavHeaderW

OnMenuHeaderClick makes the logo/title area a keyboard-accessible button.

func (*TopNavHeaderW) Show 实验性 ​

go
func (w *TopNavHeaderW) Show() *TopNavHeaderW

Show builds the header using ProLayout's existing header implementation.

func (*TopNavHeaderW) Title 实验性 ​

go
func (w *TopNavHeaderW) Title(s string) *TopNavHeaderW

Title sets the logo area's title.

func (*TopNavHeaderW) UserName 实验性 ​

go
func (w *TopNavHeaderW) UserName(s string) *TopNavHeaderW

UserName adds the user avatar and name in the trailing action area.

TourActions 实验性 ​

go
type TourActions struct {
	Current int // 0-based index of the shown step
	Total   int
	// contains filtered or unexported fields
}

TourActions is what an ActionsRender function gets: the step position and the operations of the default buttons.

func (*TourActions) Close 实验性 ​

go
func (a *TourActions) Close()

Close dismisses the tour (Closed reports it).

func (*TourActions) Default 实验性 ​

go
func (a *TourActions) Default()

Default builds the default buttons (previous, next / finish) in place.

func (*TourActions) GoTo 实验性 ​

go
func (a *TourActions) GoTo(i int)

GoTo moves to step i (clamped).

func (*TourActions) Next 实验性 ​

go
func (a *TourActions) Next()

Next moves to the next step, or finishes the tour on the last one.

func (*TourActions) Prev 实验性 ​

go
func (a *TourActions) Prev()

Prev moves to the previous step.

TourLocale 实验性 ​

go
type TourLocale struct {
	Close, Prev, Next, Finish string
	// contains filtered or unexported fields
}

TourLocale holds the Tour buttons.

TourMask 实验性 ​

go
type TourMask uint8

TourMask overrides the tour's mask for one step.

go
const (
	TourMaskInherit TourMask = iota // the tour's setting (NoMask)
	TourMaskOn                      // dim the page around the target
	TourMaskOff                     // no mask on this step
)

实验性

TourStep 实验性 ​

go
type TourStep struct {
	Target      ID // widget to highlight (0: centred panel, no hole)
	Title       string
	Description string
	Cover       func() // optional picture above the title
	Placement   string // as Popover.Placement; default "bottom"

	// Per-step overrides of the tour's options.
	Mask     TourMask // TourMaskOn / TourMaskOff; zero: the tour's setting
	Type     TourType // TourTypeDefault / TourTypePrimary; "": the tour's setting
	PrevText string   // label of the previous button ("": Locale)
	NextText string   // label of the next / finish button ("": Locale)
	HidePrev bool     // no previous button on this step
	HideNext bool     // no next / finish button on this step
	// HideArrow hides the panel arrow on this step (antd steps[].arrow
	// false).
	HideArrow bool
}

TourStep is one step of a Tour.

TourType 实验性 ​

go
type TourType string

TourType is the panel style of a tour step.

go
const (
	TourTypeDefault TourType = "default" // the container-colored panel
	TourTypePrimary TourType = "primary" // the brand-colored panel
)

实验性

TourW 实验性 ​

go
type TourW struct {
	// contains filtered or unexported fields
}

TourW is a guided tour: a mask with a hole around the current target and a panel with step indicators and prev/next buttons.

func Tour 实验性 ​

go
func Tour(c *Context, open *bool, current *int, steps []TourStep) *TourW

Tour starts a tour bound to *open and *current; call Show.

func (*TourW) ActionsRender 实验性 ​

go
func (t *TourW) ActionsRender(fn func(a *TourActions)) *TourW

ActionsRender replaces the previous / next buttons with the content fn builds (Ant actionsRender); a.Default() builds the default buttons and a.Prev / Next / GoTo / Close drive the tour.

func (*TourW) Changed 实验性 ​

go
func (t *TourW) Changed() bool

Changed reports a step change.

func (*TourW) Closable 实验性 ​

go
func (t *TourW) Closable(on bool) *TourW

Closable shows or hides the close button; without it Escape does not close the tour either (antd closable null; default shown).

func (*TourW) Closed 实验性 ​

go
func (t *TourW) Closed() bool

Closed reports the tour was dismissed (close button or Escape).

func (*TourW) DisabledInteraction 实验性 ​

go
func (t *TourW) DisabledInteraction(on bool) *TourW

DisabledInteraction keeps the highlighted target from being clicked (antd disabledInteraction; by default the target stays interactive, Element target-area-clickable).

func (*TourW) Finished 实验性 ​

go
func (t *TourW) Finished() bool

Finished reports a click on the last step's finish button.

func (*TourW) Gap 实验性 ​

go
func (t *TourW) Gap(px float32) *TourW

Gap sets the hole padding around the target (antd / Element gap.offset, default 6).

func (*TourW) GapRadius 实验性 ​

go
func (t *TourW) GapRadius(px float32) *TourW

GapRadius sets the corner radius of the hole around the target (antd / Element gap.radius, default 2).

func (*TourW) IndicatorsRender 实验性 ​

go
func (t *TourW) IndicatorsRender(fn func(current, total int)) *TourW

IndicatorsRender replaces the step indicators (dots; Element: "1 / 3") with the content fn builds (Ant indicatorsRender). current is 0-based.

func (*TourW) Keyboard 实验性 ​

go
func (t *TourW) Keyboard(on bool) *TourW

Keyboard sets whether Escape closes the tour and ←/→ move between steps (default true; antd keyboard, Element close-on-press-escape).

func (*TourW) MaskColor 实验性 ​

go
func (t *TourW) MaskColor(col theme.Color) *TourW

MaskColor sets the mask color (antd mask.color; default the theme's). A transparent color keeps the mask's pointer blocking without dimming.

func (*TourW) NoArrow 实验性 ​

go
func (t *TourW) NoArrow() *TourW

NoArrow hides the panel arrow.

func (*TourW) NoMask 实验性 ​

go
func (t *TourW) NoMask() *TourW

NoMask hides the dimming mask.

func (*TourW) Placement 实验性 ​

go
func (t *TourW) Placement(s string) *TourW

Placement sets the default panel placement of the steps, as Popover.Placement (default "bottom"); TourStep.Placement overrides it.

func (*TourW) Primary 实验性 ​

go
func (t *TourW) Primary() *TourW

Primary uses the brand-coloured panel.

func (*TourW) ScrollIntoView 实验性 ​

go
func (t *TourW) ScrollIntoView(on bool) *TourW

ScrollIntoView sets whether each step scrolls its target into the view of the scroll container holding it when the step is shown (default on, Ant scrollIntoViewOptions).

func (*TourW) Show 实验性 ​

go
func (t *TourW) Show() *TourW

Show builds the tour layers when open.

TransferItem 实验性 ​

go
type TransferItem struct {
	Key, Title string
	Disabled   bool
	// contains filtered or unexported fields
}

TransferItem is an entry of a Transfer.

TransferLocale 实验性 ​

go
type TransferLocale struct {
	Source, Target, SearchPlaceholder string
	// contains filtered or unexported fields
}

TransferLocale holds the Transfer defaults.

TransferW 实验性 ​

go
type TransferW struct {
	// contains filtered or unexported fields
}

TransferW is a two-list shuttle: items move between the source (left) and the target (right) list.

func Transfer 实验性 ​

go
func Transfer(c *Context, items []TransferItem, target *[]string) *TransferW

Transfer adds a transfer bound to the keys of the right-hand list.

func (*TransferW) Actions 实验性 ​

go
func (w *TransferW) Actions(toRight, toLeft string) *TransferW

Actions labels the move buttons (Ant 6 actions, Element button-texts; default: icons only).

func (*TransferW) Changed 实验性 ​

go
func (w *TransferW) Changed() bool

Changed reports items moved this frame.

func (*TransferW) Checked 实验性 ​

go
func (w *TransferW) Checked(side int) []string

Checked returns the checked keys of a side (0 left, 1 right).

func (*TransferW) DefaultChecked 实验性 ​

go
func (w *TransferW) DefaultChecked(keys ...string) *TransferW

DefaultChecked checks keys when the widget is first shown.

func (*TransferW) Disabled 实验性 ​

go
func (w *TransferW) Disabled(on bool) *TransferW

Disabled disables the whole transfer.

func (*TransferW) ListSize 实验性 ​

go
func (w *TransferW) ListSize(wd, ht float32) *TransferW

ListSize sets the size of each list box.

func (*TransferW) OneWay 实验性 ​

go
func (w *TransferW) OneWay() *TransferW

OneWay makes the transfer one-directional (Ant oneWay): only the move to the right remains, and right-hand items have a remove button.

func (*TransferW) Operations 实验性 ​

go
func (w *TransferW) Operations(toRight, toLeft string) *TransferW

Operations labels the move buttons.

Deprecated: use Actions (Ant 6 renamed operations to actions).

func (*TransferW) Pagination 实验性 ​

go
func (w *TransferW) Pagination(pageSize int) *TransferW

Pagination shows pageSize items per page with a pager under each list (Ant pagination).

func (*TransferW) Render 实验性 ​

go
func (w *TransferW) Render(fn func(o Option)) *TransferW

Render builds each row's content with fn instead of the title (the row background and checkbox stay). The option carries the item's Title as Label, Key as Value and Disabled.

ui.Transfer(c, items, &keys).Render(func(o ui.Option) {
	ui.Row(c, func() { ui.Icon(c, icon.User); ui.Text(c, o.Label) }, layout.Gap(6))
})

func (*TransferW) Searchable 实验性 ​

go
func (w *TransferW) Searchable() *TransferW

Searchable adds a filter input to each list.

func (*TransferW) ShowSelectAll 实验性 ​

go
func (w *TransferW) ShowSelectAll(on bool) *TransferW

ShowSelectAll shows or hides the select-all checkbox in the list headers (Ant showSelectAll, default true).

func (*TransferW) Status 实验性 ​

go
func (w *TransferW) Status(s string) *TransferW

Status sets the validation status ("error", "warning").

func (*TransferW) TargetOrder 实验性 ​

go
func (w *TransferW) TargetOrder(s string) *TransferW

TargetOrder sets where moved keys go in the bound target slice and the order of the right list (Element target-order): "unshift" (default, as Ant: new keys first, the list follows the slice), "push" (new keys last, the list follows the slice) or "original" (the slice and the list follow the item order). ConfigProvider.Defaults("Transfer", "targetOrder") sets it for a subtree.

func (*TransferW) Titles 实验性 ​

go
func (w *TransferW) Titles(left, right string) *TransferW

Titles sets the list titles.

func (*TransferW) TreeSource 实验性 ​

go
func (w *TransferW) TreeSource(nodes []TreeNode) *TransferW

TreeSource shows nodes as a checkable tree on the left (Ant tree transfer). Leaves are the transferable items (their Key / Title); leaves already on the right are shown checked and disabled. The items passed to Transfer are ignored.

func (*TransferW) Virtual 实验性 ​

go
func (w *TransferW) Virtual(on bool) *TransferW

Virtual forces virtual lists on or off (default: more than 100 items on a page).

TreeNode ​

go
type TreeNode struct {
	Key             string
	Title           string
	Children        []TreeNode
	IsLeaf          bool // never expandable (relevant with LoadData)
	Disabled        bool
	DisableCheckbox bool
	Icon            *icon.Icon // shown with ShowIcon; nil uses folder/file
}

TreeNode is one node of a Tree. Keys must be unique in the whole tree.

func TreeMove 实验性 ​

go
func TreeMove(nodes []TreeNode, drag, drop string, pos int) []TreeNode

TreeMove returns a copy of nodes with the node drag moved before, inside (as first child) or after the node drop. Moving a node into its own subtree is ignored.

TreeSelectNode 实验性 ​

go
type TreeSelectNode struct {
	Label, Value string
	Disabled     bool
	Children     []TreeSelectNode
	IsLeaf       bool // never expandable (relevant with LoadData)
}

TreeSelectNode is a node of a TreeSelect tree. Values must be unique. With LoadData, a node without Children that is not IsLeaf loads its children when expanded.

TreeSelectW 实验性 ​

go
type TreeSelectW struct {
	// contains filtered or unexported fields
}

TreeSelectW is a select whose options form a tree.

func TreeSelect 实验性 ​

go
func TreeSelect(c *Context, val *string, nodes []TreeSelectNode) *TreeSelectW

TreeSelect adds a tree select bound to *val (single selection). Use Multiple / Checkable for multiple values.

func (*TreeSelectW) A11yLabel 实验性 ​

go
func (w *TreeSelectW) A11yLabel(s string) *TreeSelectW

A11yLabel sets the accessible name (inside a FormItem the item label is used; the placeholder is the last resort).

func (*TreeSelectW) AllowClear 实验性 ​

go
func (w *TreeSelectW) AllowClear() *TreeSelectW

func (*TreeSelectW) Changed 实验性 ​

go
func (w *TreeSelectW) Changed() bool

Changed reports a selection change this frame.

func (*TreeSelectW) CheckStrictly 实验性 ​

go
func (w *TreeSelectW) CheckStrictly() *TreeSelectW

CheckStrictly unlinks parents and children in Checkable mode (Ant treeCheckStrictly, Element check-strictly; implies Checkable): every node, parent or leaf, is checked on its own, the value holds exactly the checked nodes and each one is a tag. ShowCheckedStrategy and StrategyValue do not apply.

func (*TreeSelectW) Checkable 实验性 ​

go
func (w *TreeSelectW) Checkable() *TreeSelectW

Checkable shows checkboxes with parent/child linkage (implies Multiple; the value holds the checked leaves).

func (*TreeSelectW) Checked 实验性 ​

go
func (w *TreeSelectW) Checked() []string

Checked returns the selected values; in Checkable mode they follow the checked strategy (the values shown as tags).

func (*TreeSelectW) DefaultExpandAll 实验性 ​

go
func (w *TreeSelectW) DefaultExpandAll() *TreeSelectW

func (*TreeSelectW) Disabled 实验性 ​

go
func (w *TreeSelectW) Disabled(on bool) *TreeSelectW

Disabled disables the control.

func (*TreeSelectW) ExpandChanged 实验性 ​

go
func (w *TreeSelectW) ExpandChanged() bool

ExpandChanged reports that the bound ExpandedKeys changed this frame.

func (*TreeSelectW) ExpandedKeys 实验性 ​

go
func (w *TreeSelectW) ExpandedKeys(keys *[]string) *TreeSelectW

ExpandedKeys binds the expanded nodes of the dropdown to *keys (controlled treeExpandedKeys): the tree shows exactly these nodes open, and expanding or collapsing (pointer, keyboard, opening on the current value, search) writes the new list back in tree order. DefaultExpandAll only seeds an empty list at the first frame.

func (*TreeSelectW) FilterTreeNode 实验性 ​

go
func (w *TreeSelectW) FilterTreeNode(fn func(query string, node TreeSelectNode) bool) *TreeSelectW

FilterTreeNode replaces the search match (by default the label containing the typed text, case-insensitively) with fn, which receives the typed text and a node (Ant filterTreeNode, Element filter-node-method). Matching nodes are shown with their ancestors; the typed text is still highlighted where it appears in a label. Implies Searchable.

func (*TreeSelectW) IsOpen 实验性 ​

go
func (w *TreeSelectW) IsOpen() bool

IsOpen reports whether the dropdown is shown.

func (*TreeSelectW) Layout 实验性 ​

go
func (w *TreeSelectW) Layout(o ...layout.Option) *TreeSelectW

func (*TreeSelectW) ListHeight 实验性 ​

go
func (w *TreeSelectW) ListHeight(px float32) *TreeSelectW

ListHeight sets the maximum dropdown height with or without virtual scrolling (Ant listHeight, 256).

func (*TreeSelectW) LoadData 实验性 ​

go
func (w *TreeSelectW) LoadData(fn func(value string) bool) *TreeSelectW

LoadData enables lazy loading with Tree's contract: expanding a node that has no Children and is not IsLeaf calls fn(value) every frame until it returns false (true = still loading); the application appends the children to its node slice meanwhile. A spinner replaces the switcher.

func (*TreeSelectW) MaxTagCount 实验性 ​

go
func (w *TreeSelectW) MaxTagCount(n int) *TreeSelectW

func (*TreeSelectW) MaxTagPlaceholder 实验性 ​

go
func (w *TreeSelectW) MaxTagPlaceholder(fn func(omitted []string) string) *TreeSelectW

MaxTagPlaceholder builds the text of the collapsed tag from the hidden labels (Ant maxTagPlaceholder; default "+ N ...").

func (*TreeSelectW) Multiple 实验性 ​

go
func (w *TreeSelectW) Multiple(vals *[]string) *TreeSelectW

Multiple binds the selection to *vals instead (each click toggles a node).

func (*TreeSelectW) NotFoundContent 实验性 ​

go
func (w *TreeSelectW) NotFoundContent(s string) *TreeSelectW

NotFoundContent sets the text of an empty dropdown (Ant notFoundContent, Element no-data-text).

func (*TreeSelectW) Open 实验性 ​

go
func (w *TreeSelectW) Open() *TreeSelectW

Open forces the dropdown open (screenshots, tests).

func (*TreeSelectW) Placeholder 实验性 ​

go
func (w *TreeSelectW) Placeholder(s string) *TreeSelectW

func (*TreeSelectW) Placement 实验性 ​

go
func (w *TreeSelectW) Placement(p Placement) *TreeSelectW

Placement sets where the dropdown opens: BottomStart (default), BottomEnd, TopStart or TopEnd (Ant placement, Element placement); it flips when there is no room. ConfigProvider.Defaults("TreeSelect", "placement") takes the Ant names.

func (*TreeSelectW) Searchable 实验性 ​

go
func (w *TreeSelectW) Searchable() *TreeSelectW

func (*TreeSelectW) ShowCheckedStrategy 实验性 ​

go
func (w *TreeSelectW) ShowCheckedStrategy(s CheckedStrategy) *TreeSelectW

ShowCheckedStrategy chooses the tags of Checkable mode (default ShowChild: checked leaves; ShowParent: a fully checked parent replaces its children; ShowAll: every checked node). By default the bound value holds the checked leaves and Checked returns the strategy's values; with StrategyValue(true) the bound value itself follows the strategy (Ant).

func (*TreeSelectW) Size 实验性 ​

go
func (w *TreeSelectW) Size(s ControlSize) *TreeSelectW

func (*TreeSelectW) Status 实验性 ​

go
func (w *TreeSelectW) Status(s string) *TreeSelectW

func (*TreeSelectW) StrategyValue 实验性 ​

go
func (w *TreeSelectW) StrategyValue(on bool) *TreeSelectW

StrategyValue makes the bound value of Checkable mode follow the checked strategy, as Ant's value does: with ShowParent a fully checked parent is stored instead of its leaves, with ShowAll parents and leaves are both stored. Values written by the application are read the same way (a parent value checks its whole subtree). Default false: the value holds the checked leaves whatever the strategy (lossless with lazy loading and disabled nodes, and what earlier versions stored).

func (*TreeSelectW) Variant 实验性 ​

go
func (w *TreeSelectW) Variant(v FieldVariant) *TreeSelectW

Variant sets the frame look (FieldOutlined by default).

func (*TreeSelectW) Virtual 实验性 ​

go
func (w *TreeSelectW) Virtual(on bool) *TreeSelectW

Virtual forces the virtual dropdown on or off (default: more than 100 visible rows).

func (*TreeSelectW) Width 实验性 ​

go
func (w *TreeSelectW) Width(px float32) *TreeSelectW

TreeW ​

go
type TreeW struct {
	// contains filtered or unexported fields
}

TreeW is a hierarchical list with expand, select, check, drag and search.

func Tree ​

go
func Tree(c *Context, nodes []TreeNode) *TreeW

Tree starts a tree over nodes; configure with modifiers and call Show.

The tree is one Tab stop. Keyboard: Up/Down move the focused row, Home/End jump to the first/last row, Right expands (or enters the first child), Left collapses (or returns to the parent), Enter selects, Space checks when Checkable and selects otherwise.

func (*TreeW) A11yLabel ​

go
func (w *TreeW) A11yLabel(s string) *TreeW

A11yLabel sets the tree's accessible name (inside a FormItem the item label is used).

func (*TreeW) Accordion ​

go
func (w *TreeW) Accordion() *TreeW

Accordion keeps one node expanded per level: expanding a node collapses its expanded siblings (Element accordion).

func (*TreeW) AllowDrag ​

go
func (w *TreeW) AllowDrag(fn func(key string) bool) *TreeW

AllowDrag decides which nodes can be dragged (antd draggable.nodeDraggable, Element allow-drag).

func (*TreeW) AllowDrop ​

go
func (w *TreeW) AllowDrop(fn func(drag, drop string, pos int) bool) *TreeW

AllowDrop decides where a dragged node may land (antd allowDrop, Element allow-drop); pos is TreeDropBefore / Inside / After.

func (*TreeW) BlockNode ​

go
func (w *TreeW) BlockNode() *TreeW

BlockNode stretches titles to the full row width.

func (*TreeW) Built ​

go
func (w *TreeW) Built() int

Built returns how many rows the last Show built. With virtual scrolling it counts the viewport rows and overscan.

func (*TreeW) CheckChanged ​

go
func (w *TreeW) CheckChanged() bool

func (*TreeW) CheckOnClick ​

go
func (w *TreeW) CheckOnClick(on bool) *TreeW

CheckOnClick toggles the checkbox when a checkable node's title is clicked (Element check-on-click-node).

func (*TreeW) CheckOnClickLeaf ​

go
func (w *TreeW) CheckOnClickLeaf(on bool) *TreeW

CheckOnClickLeaf toggles the checkbox when a checkable leaf's title is clicked (Element check-on-click-leaf, on by default there; antd selects instead, so it is off by default here: turn it on per tree or with Defaults("Tree", Props{"checkOnClickLeaf": true})).

func (*TreeW) CheckStrictly ​

go
func (w *TreeW) CheckStrictly() *TreeW

CheckStrictly disables parent/child check cascading.

func (*TreeW) Checkable ​

go
func (w *TreeW) Checkable(checked *[]string) *TreeW

Checkable shows checkboxes bound to checked keys.

func (*TreeW) DataVersion ​

go
func (w *TreeW) DataVersion(v int) *TreeW

DataVersion turns on the cache for a virtual scrolling tree and tells it that its nodes were modified in place. The tree keeps the parent map, Filter visibility, flattened visible rows and check states between frames while the top-level nodes slice (identity and length), v, the expanded keys, the search keyword and the checked keys stay the same, so a frame costs O(rows in view) instead of O(nodes). Titles and the other node fields are read live; a structural change made in place (children added, removed or replaced, keys changed, a title edit that changes a Filter match) shows only after v changes (or with a new slice). The check states, parents' checked and half-checked marks included, are cached too: a child's Disabled or DisableCheckbox changed in place (which changes how checks cascade) also needs a change of v. Without DataVersion the tree rebuilds all of this every frame, as before.

func (*TreeW) DefaultExpandAll ​

go
func (w *TreeW) DefaultExpandAll() *TreeW

DefaultExpandAll expands every parent node the first time the tree is shown (antd defaultExpandAll, Element default-expand-all).

func (*TreeW) Disabled ​

go
func (w *TreeW) Disabled(on bool) *TreeW

Disabled disables the whole tree (antd disabled): no selection, expansion, checking, dragging or keyboard focus.

func (*TreeW) Draggable ​

go
func (w *TreeW) Draggable() *TreeW

Draggable enables drag-to-reorder; read the result with Dropped.

func (*TreeW) Dropped ​

go
func (w *TreeW) Dropped() (drag, drop string, pos int, ok bool)

Dropped reports a completed drag in the last Show: the dragged key, the key it was dropped on and the position (TreeDropBefore/Inside/After).

func (*TreeW) EmptyText ​

go
func (w *TreeW) EmptyText(s string) *TreeW

EmptyText shows s when the tree has no rows to show (Element empty-text; antd shows nothing). The Element theme shows Locale.NoData by default (TreeToken.ShowEmptyText).

func (*TreeW) ExpandChanged ​

go
func (w *TreeW) ExpandChanged() bool

func (*TreeW) ExpandOnClick ​

go
func (w *TreeW) ExpandOnClick(on bool) *TreeW

ExpandOnClick toggles expansion when the title is clicked (Element's expand-on-click-node, on by default with the Element theme).

func (*TreeW) Expanded ​

go
func (w *TreeW) Expanded(keys *[]string) *TreeW

Expanded binds the expanded keys to the app.

func (*TreeW) Filter ​

go
func (w *TreeW) Filter() *TreeW

Filter hides nodes that neither match the search keyword nor contain a match (Element's filter-node-method).

func (*TreeW) FilterMethod ​

go
func (w *TreeW) FilterMethod(fn func(keyword string, n *TreeNode) bool) *TreeW

FilterMethod replaces the title-contains match used by Search and Filter (antd filterTreeNode, Element filter-node-method).

func (*TreeW) HalfChecked ​

go
func (w *TreeW) HalfChecked() []string

HalfChecked returns the keys drawn half-checked after the last Show.

func (*TreeW) Height ​

go
func (w *TreeW) Height(px float32) *TreeW

Height turns the tree into a scrolling viewport of px. By default it builds only the rows in view (Ant height / virtual) and expands or collapses without a height animation. Set virtual: false in ConfigProvider.Defaults("Tree", ...) to build every expanded branch inside the scroll area. The virtual tree walks and flattens the nodes each frame unless DataVersion is set, which caches that work. VirtualTree also supports custom row renderers and Range.

func (*TreeW) Layout ​

go
func (w *TreeW) Layout(o ...layout.Option) *TreeW

Layout applies layout options to the tree (after Show).

func (*TreeW) LoadData ​

go
func (w *TreeW) LoadData(fn func(key string) bool) *TreeW

LoadData enables lazy loading: expanding a non-leaf node without children calls fn(key) every frame until it returns false (still loading = true); a spinner replaces the switcher meanwhile.

func (*TreeW) Multiple ​

go
func (w *TreeW) Multiple() *TreeW

Multiple allows selecting several nodes.

func (*TreeW) Search ​

go
func (w *TreeW) Search(keyword string) *TreeW

Search highlights titles containing keyword and, when the keyword changes, expands the parents of every match.

func (*TreeW) SelectChanged ​

go
func (w *TreeW) SelectChanged() bool

SelectChanged / CheckChanged / ExpandChanged report changes in the last Show.

func (*TreeW) Selectable ​

go
func (w *TreeW) Selectable(on bool) *TreeW

Selectable turns selection on or off (antd selectable, default true). An unselectable tree still expands, checks and drags.

func (*TreeW) Selected ​

go
func (w *TreeW) Selected(keys *[]string) *TreeW

Selected binds the selected keys to the app.

func (*TreeW) Show ​

go
func (w *TreeW) Show() *TreeW

Show builds the tree.

func (*TreeW) ShowIcon ​

go
func (w *TreeW) ShowIcon() *TreeW

ShowIcon draws node icons before titles.

func (*TreeW) ShowLine ​

go
func (w *TreeW) ShowLine() *TreeW

ShowLine draws connecting lines (Ant).

func (*TreeW) SwitcherIcon ​

go
func (w *TreeW) SwitcherIcon(ic *icon.Icon) *TreeW

SwitcherIcon replaces the expand switcher (antd switcherIcon, Element icon). Draw it pointing down: it turns -90° while collapsed.

Trigger ​

go
type Trigger uint8

Trigger selects how a popup opens.

Append-only: never reorder or insert; the zero value stays TriggerHover.

go
const (
	TriggerHover       Trigger = iota // pointer rests on the trigger (default)
	TriggerClick                      // click toggles
	TriggerContextMenu                // secondary click / long press, opens at the pointer
)

UIPoster 实验性 ​

go
type UIPoster interface{ PostUI(fn func()) }

UIPoster is implemented by hosts whose UI thread is the main thread. PostUI runs fn on that thread later, never inline; any goroutine may call it. Runner.Post uses it when no thread is bound. Experimental.

UploadFile 实验性 ​

go
type UploadFile struct {
	Name    string
	Size    int64
	Status  string
	Percent float64
	Thumb   image.Image

	// Set for files the Upload added itself (Picker, dropped files):
	Path     string // local path of the file
	UID      int64  // identifies the file while it uploads (0 = none)
	Err      string // why the upload failed
	Response []byte // body of the server's reply to Action
}

UploadFile is an entry of an Upload list. Status is "uploading", "done" or "error"; Percent (0..100) is shown while uploading. Files the Upload adds without Action / CustomRequest are "done" (accepted locally, see CustomRequest).

UploadListType 实验性 ​

go
type UploadListType string

UploadListType selects how an Upload lists its files (Ant listType).

go
const (
	// UploadListText lists file names under a button (the default).
	UploadListText UploadListType = "text"
	// UploadListPicture lists bordered rows with a thumbnail, the name
	// and the upload progress under a button.
	UploadListPicture UploadListType = "picture"
	// UploadListPictureCard shows thumbnail cards with a "+" card
	// trigger (PictureCard).
	UploadListPictureCard UploadListType = "picture-card"
)

实验性

UploadLocale 实验性 ​

go
type UploadLocale struct {
	Trigger    string // picture-card add tile ("上传")
	Uploading  string // progress text of a file ("文件上传中")
	Remove     string // remove action of a file
	Preview    string // preview action of a file
	Button     string // select button / Element dragger link ("点击上传")
	DragTitle  string // Ant dragger title
	DropPrefix string // Element dragger text before the link ("将文件拖到此处,或")

	// Announcements and rejection messages of dropped / picked files.
	DoneFmt     string // upload finished, arg: file name ("%s 上传成功")
	FailedFmt   string // upload failed, arg: file name ("%s 上传失败")
	TooManyFmt  string // list full, arg: file name
	BadTypeFmt  string // type not accepted, arg: file name
	TooLargeFmt string // over the size limit, args: file name, limit ("%s 超过 %s")
	IsDirFmt    string // a folder was dropped, arg: folder name
	// contains filtered or unexported fields
}

UploadLocale holds the Upload texts. The dragger has no default hint line; set one with DragText.

UploadW 实验性 ​

go
type UploadW struct {
	// contains filtered or unexported fields
}

UploadW shows an upload trigger and the file list. The UI layer never opens a file dialog itself: OnPick (or Picked) tells the host to show one (e.g. with the dialog package) and append the chosen files to the list.

func Upload 实验性 ​

go
func Upload(c *Context, files *[]UploadFile) *UploadW

Upload adds an upload area bound to *files.

func (*UploadW) Accept 实验性 ​

go
func (w *UploadW) Accept(s string) *UploadW

Accept limits the files Picker offers and the files accepted from the picker or a drop: comma-separated extensions and MIME types (".png,.jpg,image/*", like the HTML accept attribute). Other files are rejected with a message.

func (*UploadW) Action 实验性 ​

go
func (w *UploadW) Action(url string) *UploadW

Action uploads every added file to url (multipart/form-data POST, field "file"), showing its progress; Headers, Data, FieldName, Method, Retries and Client tune the request. A reply with status >= 400 or a network error marks the file "error" with a retry button.

func (*UploadW) Added 实验性 ​

go
func (w *UploadW) Added() []UploadFile

Added returns the files the Upload added this frame (picked or dropped, after the checks).

func (*UploadW) AutoUpload 实验性 ​

go
func (w *UploadW) AutoUpload(on bool) *UploadW

AutoUpload(false) holds the files added with Action or CustomRequest in the list with Status "ready" instead of uploading them at once (Element auto-upload=false, Ant beforeUpload returning false); Submit uploads them. Without Action / CustomRequest files are accepted locally either way.

func (*UploadW) BeforeUpload 实验性 ​

go
func (w *UploadW) BeforeUpload(fn func(f UploadFile) error) *UploadW

BeforeUpload runs for every file about to be added (after Accept and MaxSize); a non-nil error rejects it and is shown as the message.

func (*UploadW) ButtonText 实验性 ​

go
func (w *UploadW) ButtonText(s string) *UploadW

ButtonText sets the text of the default button trigger.

func (*UploadW) Changed 实验性 ​

go
func (w *UploadW) Changed() bool

Changed reports a removal this frame.

func (*UploadW) Client 实验性 ​

go
func (w *UploadW) Client(cl *http.Client) *UploadW

Client sets the HTTP client of Action (default http.DefaultClient).

func (*UploadW) CustomRequest 实验性 ​

go
func (w *UploadW) CustomRequest(fn func(ctx context.Context, f UploadFile, progress func(pct float64)) ([]byte, error)) *UploadW

CustomRequest uploads every added file with fn instead of the built-in HTTP request (Ant customRequest): fn runs on its own goroutine, reports progress (0..100) and returns the reply body or an error. The file shows "uploading", then "done" or "error" with a retry button, like Action; Retries also applies. ctx is cancelled when the file is removed.

Without Action and CustomRequest the Upload only collects files: they are added with Status "done" (meaning accepted locally) and handed to the application through Added; an application that uploads them itself sets Status / Percent / Err on the bound list.

func (*UploadW) Data 实验性 ​

go
func (w *UploadW) Data(d map[string]string) *UploadW

Data adds form fields to the Action request.

func (*UploadW) Directory 实验性 ​

go
func (w *UploadW) Directory() *UploadW

Directory picks (and accepts dropped) folders and adds every file in them, named by their path inside the folder (Ant directory). The picker must support choosing folders (uihost.FilePicker does).

func (*UploadW) Disabled 实验性 ​

go
func (w *UploadW) Disabled(on bool) *UploadW

Disabled disables picking and removing.

func (*UploadW) DragOver 实验性 ​

go
func (w *UploadW) DragOver(on bool) *UploadW

DragOver highlights the dragger while the host reports a file drag over the window.

func (*UploadW) DragText 实验性 ​

go
func (w *UploadW) DragText(title, hint string) *UploadW

DragText sets the main text and hint of the dragger.

func (*UploadW) Dragger 实验性 ​

go
func (w *UploadW) Dragger() *UploadW

Dragger shows a large dashed drop area as the trigger.

func (*UploadW) FieldName 实验性 ​

go
func (w *UploadW) FieldName(s string) *UploadW

FieldName sets the form field of the file (default "file").

func (*UploadW) Headers 实验性 ​

go
func (w *UploadW) Headers(h map[string]string) *UploadW

Headers sets request headers of Action.

func (*UploadW) ListType 实验性 ​

go
func (w *UploadW) ListType(t UploadListType) *UploadW

ListType selects the file list: UploadListText (default), UploadListPicture (PictureList) or UploadListPictureCard (PictureCard).

func (*UploadW) MaxCount 实验性 ​

go
func (w *UploadW) MaxCount(n int) *UploadW

MaxCount limits the number of files; the trigger is disabled (cards: hidden) once reached and further files are rejected (see Rejections; Element limit / on-exceed). MaxCount(1) replaces the current file with the new one instead, like antd maxCount={1}: the trigger stays enabled.

func (*UploadW) MaxSize 实验性 ​

go
func (w *UploadW) MaxSize(n int64) *UploadW

MaxSize rejects files larger than n bytes with a message (0 = no limit).

func (*UploadW) Method 实验性 ​

go
func (w *UploadW) Method(m string) *UploadW

Method sets the request method (default POST).

func (*UploadW) Multiple 实验性 ​

go
func (w *UploadW) Multiple() *UploadW

Multiple lets the picker choose several files.

func (*UploadW) OnPick 实验性 ​

go
func (w *UploadW) OnPick(fn func()) *UploadW

OnPick sets the callback run when the user activates the trigger.

func (*UploadW) Picked 实验性 ​

go
func (w *UploadW) Picked() bool

Picked reports that the trigger was activated this frame.

func (*UploadW) Picker 实验性 ​

go
func (w *UploadW) Picker(fn func(accept string, multiple, dir bool) ([]string, error)) *UploadW

Picker sets the file chooser the trigger opens (uihost.FilePicker for the native dialog). It runs on its own goroutine and returns the chosen paths (nil, nil when cancelled); accept is Accept, multiple is Multiple, dir is Directory. The files are then checked and added to the list (and uploaded with Action). OnPick still runs, for hosts that add files themselves.

func (*UploadW) PictureCard 实验性 ​

go
func (w *UploadW) PictureCard() *UploadW

PictureCard shows files as thumbnail cards with a "+" card trigger.

func (*UploadW) PictureList 实验性 ​

go
func (w *UploadW) PictureList() *UploadW

PictureList lists the files as bordered rows with a thumbnail (the file's Thumb, else a picture glyph), the name and the progress bar, under the button trigger (Ant listType="picture", Element list-type="picture"). Clicking a thumbnail reports it through Previewed.

func (*UploadW) Previewed 实验性 ​

go
func (w *UploadW) Previewed() int

Previewed returns the index of the card whose preview icon was clicked, or -1.

func (*UploadW) Rejections 实验性 ​

go
func (w *UploadW) Rejections() []string

Rejections returns the messages about files that were not added (wrong type, too large, BeforeUpload errors), shown under the trigger until the next pick or drop.

func (*UploadW) Removed 实验性 ​

go
func (w *UploadW) Removed() int

Removed returns the index of the file removed this frame, or -1.

func (*UploadW) Retries 实验性 ​

go
func (w *UploadW) Retries(n int) *UploadW

Retries retries a failed request up to n more times before showing the error.

func (*UploadW) ShowUploadList 实验性 ​

go
func (w *UploadW) ShowUploadList(on bool) *UploadW

ShowUploadList shows (true, the default) or hides the file list (antd showUploadList, Element show-file-list); the trigger, tip and rejections stay.

func (*UploadW) Submit 实验性 ​

go
func (w *UploadW) Submit() int

Submit uploads every "ready" file of the list (see AutoUpload) with Action or CustomRequest, e.g. when a separate "upload" button is clicked. It returns how many uploads it started.

func (*UploadW) Tip 实验性 ​

go
func (w *UploadW) Tip(s string) *UploadW

Tip shows a help line under the trigger.

func (*UploadW) Width 实验性 ​

go
func (w *UploadW) Width(px float32) *UploadW

Width fixes the width (text list and dragger).

ValueCopier 实验性 ​

go
type ValueCopier interface {
	CopyValue(n *ValueNode) string
}

ValueCopier is implemented by sources whose nodes show a shortened value: CopyValue returns the full value for "copy value".

ValueKind 实验性 ​

go
type ValueKind uint8

ValueKind is the type of a value tree node.

go
const (
	ValueNull ValueKind = iota
	ValueBool
	ValueNumber
	ValueString
	ValueObject
	ValueArray
	ValueOther
)

The value kinds. ValueOther is anything else a source wants to show with a summary (a function, a channel, a debugger's opaque value).

实验性

ValueNode 实验性 ​

go
type ValueNode struct {
	// Name is the object key or variable name; for array elements the
	// index (with Index set). The single root of a JSON document has
	// none.
	Name  string
	Index bool
	Kind  ValueKind
	// Value is the display text: scalars as written (strings without
	// quotes, possibly shortened), a summary for ValueOther; empty for
	// objects and arrays (the view shows their size).
	Value string
	// Type is an optional type label shown after the value (debuggers).
	Type string
	// Count is the number of children of an object or array; -1 when
	// unknown until they are loaded. A node with Count 0 has no children.
	Count int
	// Ref is the source's own handle of the node, passed back to
	// Children.
	Ref any
}

ValueNode is one node of a value tree.

ValueSource 实验性 ​

go
type ValueSource interface {
	// Roots returns the top-level nodes.
	Roots() []ValueNode
	// Children returns the children [from, to) of parent (to = -1: all).
	Children(parent *ValueNode, from, to int) (kids []ValueNode, ok bool)
}

ValueSource supplies a value tree lazily: JSONView asks for children only when a node is expanded, and only for the expanded range of a large array or object (groups of 100). Sources may load asynchronously: Children returns ok=false while loading and the view asks again (call Context.Invalidator's function when the data arrives to repaint at once).

func GoValueSource 实验性 ​

go
func GoValueSource(v any) ValueSource

GoValueSource returns a ValueSource over a Go value: structs (exported fields, named by their json tag when present), maps (sorted keys), slices, arrays, pointers and interfaces are expanded; values with a String or Error method that are not containers show that text.

func JSONSource 实验性 ​

go
func JSONSource(data []byte) (ValueSource, error)

JSONSource returns a ValueSource over a JSON document, or an error when it is not valid JSON. The document is scanned lazily: expanding a node reads only that container, so multi-megabyte documents open at once. data must not change while the source is in use.

VirtualListW 实验性 ​

go
type VirtualListW struct {
	// contains filtered or unexported fields
}

VirtualListW is a vertically scrolling list of n fixed-height rows that only builds the rows inside the viewport (plus a small overscan), so it stays cheap for hundreds of thousands of items.

func VirtualList 实验性 ​

go
func VirtualList(c *Context, n int, itemHeight float32, fn func(i int), opts ...layout.Option) *VirtualListW

VirtualList adds a virtual list of n rows of itemHeight px; fn(i) builds row i (it runs inside a fixed-height row and its own identity scope, so row widgets keep their state while scrolling).

ui.VirtualList(c, len(rows), 32, func(i int) { ui.Text(c, rows[i]) }).Height(400)

func (*VirtualListW) A11yLabel 实验性 ​

go
func (w *VirtualListW) A11yLabel(s string) *VirtualListW

A11yLabel sets the accessible name of the list.

func (*VirtualListW) Height 实验性 ​

go
func (w *VirtualListW) Height(px float32) *VirtualListW

Height fixes the viewport height.

func (*VirtualListW) ID 实验性 ​

go
func (w *VirtualListW) ID() ID

ID returns the scroll container's ID.

func (*VirtualListW) Layout 实验性 ​

go
func (w *VirtualListW) Layout(opts ...layout.Option) *VirtualListW

Layout applies layout options to the viewport.

func (*VirtualListW) Offset 实验性 ​

go
func (w *VirtualListW) Offset() float64

Offset returns the vertical scroll offset.

func (*VirtualListW) Overscan 实验性 ​

go
func (w *VirtualListW) Overscan(rows int) *VirtualListW

Overscan sets how many extra rows are built above and below the viewport (default 3).

func (*VirtualListW) Range 实验性 ​

go
func (w *VirtualListW) Range() (first, end int)

Range returns the half-open range [first, end) of rows built this frame.

func (*VirtualListW) ScrollIntoView 实验性 ​

go
func (w *VirtualListW) ScrollIntoView(i int) *VirtualListW

ScrollIntoView scrolls the minimum amount that makes row i fully visible.

func (*VirtualListW) ScrollToIndex 实验性 ​

go
func (w *VirtualListW) ScrollToIndex(i int) *VirtualListW

ScrollToIndex scrolls so row i is at the top (clamped to the list).

VirtualOptionGroup 实验性 ​

go
type VirtualOptionGroup struct {
	Label   string
	Options []Option
}

VirtualOptionGroup is a titled group of options (Element's grouped options, Ant's OptGroup).

VirtualOptionState 实验性 ​

go
type VirtualOptionState struct {
	Active   bool // keyboard / hover highlight
	Selected bool
	Disabled bool // disabled option, or the selection limit is reached
	Created  bool // the "create new entry" row of AllowCreate
}

VirtualOptionState tells a custom option renderer how the row is shown.

VirtualSelectW 实验性 ​

go
type VirtualSelectW struct {
	// contains filtered or unexported fields
}

VirtualSelectW is a single or multiple select with a virtualized dropdown. Build it with VirtualSelect and chain modifiers; the dropdown and value handling run when a query method is called or at the end of the build.

func VirtualSelect 实验性 ​

go
func VirtualSelect(c *Context, val *string, opts []Option) *VirtualSelectW

VirtualSelect adds a select bound to *val over opts whose dropdown only builds the visible rows (100k options stay smooth). Call Multiple to bind a list of values instead.

ui.VirtualSelect(c, &city, cities).Filterable().AllowClear()
ui.VirtualSelect(c, nil, opts).Multiple(&tags).MaxCount(3)

func (*VirtualSelectW) AllowClear 实验性 ​

go
func (w *VirtualSelectW) AllowClear() *VirtualSelectW

AllowClear shows a clear button on hover.

func (*VirtualSelectW) AllowCreate 实验性 ​

go
func (w *VirtualSelectW) AllowCreate() *VirtualSelectW

AllowCreate offers the typed text as a new option when no label matches it exactly (Element allow-create, Ant mode="tags"); read it with Created.

func (*VirtualSelectW) Changed 实验性 ​

go
func (w *VirtualSelectW) Changed() bool

Changed reports a selection change this frame.

func (*VirtualSelectW) Created 实验性 ​

go
func (w *VirtualSelectW) Created() (string, bool)

Created returns the value of an entry created with AllowCreate this frame.

func (*VirtualSelectW) DataVersion 实验性 ​

go
func (w *VirtualSelectW) DataVersion(v int) *VirtualSelectW

DataVersion tells the select that the option slices were modified in place (caches are keyed by slice identity and this number).

func (*VirtualSelectW) Debounce 实验性 ​

go
func (w *VirtualSelectW) Debounce(d time.Duration) *VirtualSelectW

Debounce sets the delay of Remote calls.

func (*VirtualSelectW) Disabled 实验性 ​

go
func (w *VirtualSelectW) Disabled(on bool) *VirtualSelectW

Disabled turns the control off.

func (*VirtualSelectW) FilterMethod 实验性 ​

go
func (w *VirtualSelectW) FilterMethod(fn func(query string, o Option) bool) *VirtualSelectW

FilterMethod replaces the label match used by Filterable.

func (*VirtualSelectW) Filterable 实验性 ​

go
func (w *VirtualSelectW) Filterable() *VirtualSelectW

Filterable lets the user type to filter options by label (case-insensitive).

func (*VirtualSelectW) Groups 实验性 ​

go
func (w *VirtualSelectW) Groups(groups []VirtualOptionGroup) *VirtualSelectW

Groups replaces the options with titled groups (group titles are not selectable and are skipped by the keyboard).

func (*VirtualSelectW) ID 实验性 ​

go
func (w *VirtualSelectW) ID() ID

ID returns the control's ID.

func (*VirtualSelectW) IsOpen 实验性 ​

go
func (w *VirtualSelectW) IsOpen() bool

IsOpen reports whether the dropdown is shown.

func (*VirtualSelectW) ItemHeight 实验性 ​

go
func (w *VirtualSelectW) ItemHeight(px float32) *VirtualSelectW

ItemHeight sets the option row height (Element 34, Ant 32).

func (*VirtualSelectW) Layout 实验性 ​

go
func (w *VirtualSelectW) Layout(o ...layout.Option) *VirtualSelectW

Layout applies layout options to the control.

func (*VirtualSelectW) ListHeight 实验性 ​

go
func (w *VirtualSelectW) ListHeight(px float32) *VirtualSelectW

ListHeight sets the maximum dropdown height (Element 274, Ant 256).

func (*VirtualSelectW) Loading 实验性 ​

go
func (w *VirtualSelectW) Loading(on bool) *VirtualSelectW

Loading shows the loading text instead of the options and a spinner in place of the arrow (Ant loading).

func (*VirtualSelectW) MaxCount 实验性 ​

go
func (w *VirtualSelectW) MaxCount(n int) *VirtualSelectW

MaxCount limits how many values a multiple select may hold (Element multiple-limit, Ant maxCount); other options turn disabled at the limit.

func (*VirtualSelectW) MaxTagCount 实验性 ​

go
func (w *VirtualSelectW) MaxTagCount(n int) *VirtualSelectW

MaxTagCount collapses tags after n into "+ N ...".

func (*VirtualSelectW) Multiple 实验性 ​

go
func (w *VirtualSelectW) Multiple(vals *[]string) *VirtualSelectW

Multiple switches to multiple selection bound to *vals (selected values shown as closable tags).

func (*VirtualSelectW) NotFoundContent 实验性 ​

go
func (w *VirtualSelectW) NotFoundContent(s string) *VirtualSelectW

NotFoundContent replaces the text of an empty dropdown (Element no-data-text / no-match-text, Ant notFoundContent).

func (*VirtualSelectW) Open 实验性 ​

go
func (w *VirtualSelectW) Open() *VirtualSelectW

Open forces the dropdown open (screenshots, tests).

func (*VirtualSelectW) OptionRender 实验性 ​

go
func (w *VirtualSelectW) OptionRender(fn func(o Option, s VirtualOptionState)) *VirtualSelectW

OptionRender builds each option row's content with fn instead of the plain label (the row background, highlight and check mark stay).

func (*VirtualSelectW) Placeholder 实验性 ​

go
func (w *VirtualSelectW) Placeholder(s string) *VirtualSelectW

Placeholder sets the text shown without a value.

func (*VirtualSelectW) Placement 实验性 ​

go
func (w *VirtualSelectW) Placement(p Placement) *VirtualSelectW

Placement sets where the dropdown opens: BottomStart (default), BottomEnd, TopStart or TopEnd (Element placement, Ant placement); it flips when there is no room.

func (*VirtualSelectW) Query 实验性 ​

go
func (w *VirtualSelectW) Query() string

Query returns the current search text.

func (*VirtualSelectW) Remote 实验性 ​

go
func (w *VirtualSelectW) Remote(fn func(query string)) *VirtualSelectW

Remote turns on server-side search: fn receives the typed query after Debounce (default 300ms) and should replace the options; local filtering is off. Show progress with Loading.

func (*VirtualSelectW) Size 实验性 ​

go
func (w *VirtualSelectW) Size(s ControlSize) *VirtualSelectW

Size sets the control size.

func (*VirtualSelectW) Status 实验性 ​

go
func (w *VirtualSelectW) Status(s string) *VirtualSelectW

Status sets the validation status ("error", "warning").

func (*VirtualSelectW) Width 实验性 ​

go
func (w *VirtualSelectW) Width(px float32) *VirtualSelectW

Width fixes the control width.

VirtualTreeW 实验性 ​

go
type VirtualTreeW struct {
	// contains filtered or unexported fields
}

VirtualTreeW is a virtualized tree. Configure it with modifiers and call Show.

func VirtualTree 实验性 ​

go
func VirtualTree(c *Context, nodes []TreeNode) *VirtualTreeW

VirtualTree starts a virtualized tree over nodes (keys unique in the whole tree); configure with modifiers and call Show.

Keyboard (the tree is one Tab stop): Up/Down/PageUp/PageDown/Home/End move the cursor row, Right expands or enters the first child, Left collapses or returns to the parent, Enter makes the row current, Space checks it when Checkable.

ui.VirtualTree(c, nodes).Checkable(&checked).Height(400).Show()

func (*VirtualTreeW) Accordion 实验性 ​

go
func (w *VirtualTreeW) Accordion() *VirtualTreeW

Accordion keeps one node expanded per level: expanding a node collapses its expanded siblings (Element accordion).

func (*VirtualTreeW) CheckChanged 实验性 ​

go
func (w *VirtualTreeW) CheckChanged() bool

CheckChanged / ExpandChanged / CurrentChanged report changes in Show.

func (*VirtualTreeW) CheckOnClick 实验性 ​

go
func (w *VirtualTreeW) CheckOnClick() *VirtualTreeW

CheckOnClick toggles the check box when a row is clicked.

func (*VirtualTreeW) CheckOnClickLeaf 实验性 ​

go
func (w *VirtualTreeW) CheckOnClickLeaf(on bool) *VirtualTreeW

CheckOnClickLeaf toggles the check box when a leaf row is clicked (Element check-on-click-leaf; off by default, as antd selects instead).

func (*VirtualTreeW) CheckStrictly 实验性 ​

go
func (w *VirtualTreeW) CheckStrictly() *VirtualTreeW

CheckStrictly makes parent and child check states independent.

func (*VirtualTreeW) Checkable 实验性 ​

go
func (w *VirtualTreeW) Checkable(checked *[]string) *VirtualTreeW

Checkable shows check boxes bound to checked keys (fully checked keys, parents included; nil keeps them inside the tree).

func (*VirtualTreeW) Current 实验性 ​

go
func (w *VirtualTreeW) Current(key *string) *VirtualTreeW

Current binds the current (highlighted) node key.

func (*VirtualTreeW) CurrentChanged 实验性 ​

go
func (w *VirtualTreeW) CurrentChanged() bool

func (*VirtualTreeW) DataVersion 实验性 ​

go
func (w *VirtualTreeW) DataVersion(v int) *VirtualTreeW

DataVersion tells the tree that nodes were modified in place (the index is keyed by the slice identity and this number).

func (*VirtualTreeW) EmptyText 实验性 ​

go
func (w *VirtualTreeW) EmptyText(s string) *VirtualTreeW

EmptyText shows s instead of the empty illustration when no row is shown (Element empty-text); the Element theme shows Locale.NoData (TreeToken.ShowEmptyText).

func (*VirtualTreeW) ExpandChanged 实验性 ​

go
func (w *VirtualTreeW) ExpandChanged() bool

func (*VirtualTreeW) ExpandOnClick 实验性 ​

go
func (w *VirtualTreeW) ExpandOnClick(on bool) *VirtualTreeW

ExpandOnClick toggles expansion when a row is clicked (Element's expand-on-click-node; on by default with the Element theme).

func (*VirtualTreeW) Expanded 实验性 ​

go
func (w *VirtualTreeW) Expanded(keys *[]string) *VirtualTreeW

Expanded binds the expanded keys to the app.

func (*VirtualTreeW) Filter 实验性 ​

go
func (w *VirtualTreeW) Filter(query string) *VirtualTreeW

Filter shows only nodes matching query (case-insensitive title match) and their ancestors, expanding the ancestors when the query changes.

func (*VirtualTreeW) FilterMethod 实验性 ​

go
func (w *VirtualTreeW) FilterMethod(fn func(query string, n *TreeNode) bool) *VirtualTreeW

FilterMethod replaces the title match used by Filter.

func (*VirtualTreeW) HalfChecked 实验性 ​

go
func (w *VirtualTreeW) HalfChecked() []string

HalfChecked returns the half-checked keys (after Show).

func (*VirtualTreeW) Height 实验性 ​

go
func (w *VirtualTreeW) Height(px float32) *VirtualTreeW

Height sets the viewport height (default 200, Element's default).

func (*VirtualTreeW) ID 实验性 ​

go
func (w *VirtualTreeW) ID() ID

ID returns the scroll viewport's ID (after Show).

func (*VirtualTreeW) LoadData 实验性 ​

go
func (w *VirtualTreeW) LoadData(fn func(key string) bool) *VirtualTreeW

LoadData enables lazy loading: expanding a non-leaf node without children calls fn(key) every frame until it returns false (still loading = true). Add the children to the node meanwhile; the tree re-indexes when loading finishes.

func (*VirtualTreeW) NodeClicked 实验性 ​

go
func (w *VirtualTreeW) NodeClicked() (string, bool)

NodeClicked returns the key of the row clicked in Show.

func (*VirtualTreeW) NodeRender 实验性 ​

go
func (w *VirtualTreeW) NodeRender(fn func(n *TreeNode, depth int)) *VirtualTreeW

NodeRender builds each row's content with fn instead of the title.

func (*VirtualTreeW) Range 实验性 ​

go
func (w *VirtualTreeW) Range() (first, end int)

Range returns the rows [first, end) built by Show.

func (*VirtualTreeW) ScrollToKey 实验性 ​

go
func (w *VirtualTreeW) ScrollToKey(key string) *VirtualTreeW

ScrollToKey expands the ancestors of key and scrolls its row into view.

func (*VirtualTreeW) Show 实验性 ​

go
func (w *VirtualTreeW) Show() *VirtualTreeW

Show builds the tree.

func (*VirtualTreeW) VisibleCount 实验性 ​

go
func (w *VirtualTreeW) VisibleCount() int

VisibleCount returns the number of rows (expanded and not filtered out).

WatermarkW 实验性 ​

go
type WatermarkW struct {
	// contains filtered or unexported fields
}

WatermarkW tiles rotated text (or an image) over its content. The marks are painted above the children but never take pointer input.

The tiling follows Ant Design 6.7 (es/watermark/useClips.js): each mark is rotated about its centre, the rotated bounding box plus the gap makes a cell, and every other column is shifted down by half a cell.

func Watermark 实验性 ​

go
func Watermark(c *Context, lines ...string) *WatermarkW

Watermark starts a watermark container; each argument is one text line. Defaults follow Ant Design / Element Plus: -22°, gap 100×100, 16px, rgba(0,0,0,.15) (theme-aware), every other column shifted by half a cell.

func (*WatermarkW) Body 实验性 ​

go
func (w *WatermarkW) Body(fn func()) *WatermarkW

Body builds the watermarked content.

func (*WatermarkW) Color 实验性 ​

go
func (w *WatermarkW) Color(col theme.Color) *WatermarkW

Color sets the mark color (use a translucent color).

func (*WatermarkW) FontSize 实验性 ​

go
func (w *WatermarkW) FontSize(px float32) *WatermarkW

FontSize sets the text size.

func (*WatermarkW) FontStyle 实验性 ​

go
func (w *WatermarkW) FontStyle(s string) *WatermarkW

FontStyle sets "normal" (default) or "italic" ("oblique" draws italic; Ant font.fontStyle).

func (*WatermarkW) Gap 实验性 ​

go
func (w *WatermarkW) Gap(x, y float32) *WatermarkW

Gap sets the spacing between marks.

func (*WatermarkW) Grid 实验性 ​

go
func (w *WatermarkW) Grid() *WatermarkW

Grid disables the shifted columns (marks on a plain grid).

func (*WatermarkW) Image 实验性 ​

go
func (w *WatermarkW) Image(img image.Image, wpx, hpx float32) *WatermarkW

Image uses img (drawn at w×h and rotated like text) instead of text.

func (*WatermarkW) ImageOpacity 实验性 ​

go
func (w *WatermarkW) ImageOpacity(a float32) *WatermarkW

ImageOpacity sets the opacity of image marks (default 1: Ant draws the image as it is, so use a faint image or a lower opacity).

func (*WatermarkW) Layout 实验性 ​

go
func (w *WatermarkW) Layout(o ...layout.Option) *WatermarkW

Layout applies layout options to the container.

func (*WatermarkW) MarkSize 实验性 ​

go
func (w *WatermarkW) MarkSize(wpx, hpx float32) *WatermarkW

MarkSize sets the size of one mark before rotation (Ant width / height; default: the text's size, or 120×64 for an image without a size).

func (*WatermarkW) Offset 实验性 ​

go
func (w *WatermarkW) Offset(x, y float32) *WatermarkW

Offset sets where the first mark's box starts, measured to the middle of its gap (Ant offset; default gap/2, the box at the top-left corner).

func (*WatermarkW) Rotate 实验性 ​

go
func (w *WatermarkW) Rotate(deg float64) *WatermarkW

Rotate sets the rotation in degrees (negative = counter-clockwise).

func (*WatermarkW) Weight 实验性 ​

go
func (w *WatermarkW) Weight(wt text.Weight) *WatermarkW

Weight sets the text weight.

Window ​

go
type Window interface {
	// Size is the drawable content size in host logical pixels (before UI scaling).
	Size() geom.Size
	// Scale is the device-pixel ratio (2 on Retina).
	Scale() float32
	// Invalidate requests that the host call Runner.Frame soon (ideally on
	// the next vsync). Calls coalesce.
	Invalidate()
	// InvalidateAt requests a frame no later than t (timers, animations
	// paused between steps, caret blink). A later call with an earlier time
	// wins.
	InvalidateAt(t time.Time)
	// SetCursor changes the pointer shape over the content area.
	SetCursor(c input.Cursor)
	// ReadClipboard / WriteClipboard access the plain-text clipboard.
	ReadClipboard() string
	WriteClipboard(s string)
	// SetTextInput turns the platform text-input client (IME) on or off and
	// reports the caret rectangle, in logical pixels, used to position the
	// candidate window. While enabled the host delivers input.TextInput and
	// input.Composition events instead of raw characters.
	SetTextInput(enabled bool, caret geom.Rect)
	// Present shows a finished CPU frame. img has Size()*Scale() pixels,
	// is premultiplied RGBA (image.RGBA semantics) and is owned by the
	// runner: copy it or upload it before returning. Hosts using a GPU
	// renderer (RunnerOptions.Renderer) receive a nil image.
	Present(img *image.RGBA) error
}

Window is what the UI runtime needs from a platform window. A platform backend (macOS NSView, Win32 HWND, GTK widget, mobile view) implements it; so does the headless Driver used by tests.

Threading: every method except Invalidate is called on the UI thread (the thread that calls Runner.Frame / Runner.HandleEvent). Invalidate may be called from any goroutine and must only schedule a frame.

WindowAction 实验性 ​

go
type WindowAction string

WindowAction is a window button the user activated. Open set.

go
const (
	WindowActionMinimize   WindowAction = "minimize"
	WindowActionMaximize   WindowAction = "maximize"
	WindowActionRestore    WindowAction = "restore" // back from maximized or full screen
	WindowActionFullscreen WindowAction = "fullscreen"
	WindowActionClose      WindowAction = "close"
)

实验性

WindowControlsStyle 实验性 ​

go
type WindowControlsStyle uint8

WindowControlsStyle is how WindowControls draws the window buttons.

Append-only: never reorder or insert; the zero value stays WindowControlsAuto.

go
const (
	// WindowControlsAuto follows the platform: on macOS traffic lights at
	// the start (only room for them when the system draws its own),
	// elsewhere caption buttons at the end; nothing when the window keeps
	// its system title bar.
	WindowControlsAuto WindowControlsStyle = iota
	// WindowControlsCaption draws Windows / Linux caption buttons
	// (minimize, maximize / restore, close) at the end.
	WindowControlsCaption
	// WindowControlsTraffic draws macOS traffic lights (close, minimize,
	// full screen) at the start.
	WindowControlsTraffic
	// WindowControlsNone draws no buttons.
	WindowControlsNone
)

实验性

WindowControlsW 实验性 ​

go
type WindowControlsW struct {
	// contains filtered or unexported fields
}

WindowControlsW is the window button group WindowControls returns.

func WindowControls 实验性 ​

go
func WindowControls(c *Context) *WindowControlsW

WindowControls adds the minimize / maximize / close buttons of a frameless window. By default they act on the window the page draws into (Context.Window, when it implements WindowFrame) and follow the platform (WindowControlsAuto). TitleBar includes them; use WindowControls alone in a custom title area.

func (*WindowControlsW) Action 实验性 ​

go
func (w *WindowControlsW) Action() WindowAction

Action reports the button activated this frame ("" for none). Unless Manual, the window has already been asked to perform it.

func (*WindowControlsW) Frame 实验性 ​

go
func (w *WindowControlsW) Frame(f WindowFrame) *WindowControlsW

Frame sets the window the buttons act on, in place of Context.Window.

func (*WindowControlsW) Height 实验性 ​

go
func (w *WindowControlsW) Height(px float32) *WindowControlsW

Height sets the height of caption buttons (the TitleBar token's Height by default).

func (*WindowControlsW) ID 实验性 ​

go
func (w *WindowControlsW) ID() ID

ID returns the group's ID.

func (*WindowControlsW) Manual 实验性 ​

go
func (w *WindowControlsW) Manual() *WindowControlsW

Manual only reports the activated button (Action) and leaves the window alone, for apps that confirm before closing or route the actions elsewhere.

func (*WindowControlsW) Style 实验性 ​

go
func (w *WindowControlsW) Style(s WindowControlsStyle) *WindowControlsW

Style picks the button style (WindowControlsAuto by default).

WindowFrame 实验性 ​

go
type WindowFrame interface {
	// FrameInfo describes the window's current state and buttons.
	FrameInfo() WindowFrameInfo
	// SetWindowState minimizes, maximizes, makes full screen or restores
	// the window.
	SetWindowState(s WindowState)
	// CloseWindow asks the window to close, as its system close button
	// would (close handlers may still veto it).
	CloseWindow()
	// StartWindowMove hands the primary-button press that is in progress
	// to the window manager, which moves the window until the button is
	// released. Call it while handling the press.
	StartWindowMove()
}

WindowFrame is implemented by windows whose frame the page can drive: a frameless window with a self-drawn TitleBar asks it to move, to change state and to close. uihost windows implement it; TitleBar and WindowControls find it on Context.Window, or take one explicitly (TitleBarW.Frame) for other hosts and for tests.

All methods run on the UI thread.

WindowFrameInfo 实验性 ​

go
type WindowFrameInfo struct {
	State WindowState
	// SystemButtons is true when the platform draws the window buttons
	// over the page itself (macOS traffic lights over a hidden title bar):
	// a title bar leaves room for them and draws none.
	SystemButtons bool
	// SystemTitleBar is true when the window keeps its system title bar
	// (and buttons): a TitleBar in the page draws no window buttons.
	SystemTitleBar bool
	// NoMinimize, NoMaximize and NoClose disable those buttons (the
	// window's appearance forbids the action).
	NoMinimize, NoMaximize, NoClose bool
	// contains filtered or unexported fields
}

WindowFrameInfo is what a WindowFrame reports about its window.

WindowOptions 实验性 ​

go
type WindowOptions struct {
	Title                 string
	Width, Height         float32 // logical
	MinWidth, MinHeight   float32
	Resizable             bool
	BackgroundTransparent bool
	// contains filtered or unexported fields
}

WindowOptions describe a window to open.

WindowState 实验性 ​

go
type WindowState uint8

WindowState is the state of a window.

Append-only: never reorder or insert; the zero value stays WindowNormal.

go
const (
	WindowNormal WindowState = iota
	WindowMinimized
	WindowMaximized
	WindowFullscreen
)

实验性

以 MIT 许可发布