ui

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ui gives TSX nsgo/ui, package ui's components as Go components, for an app that imports this package for its effect; a theme of its own needs ui's roles, as core.DefaultTheme and ui.WarmDuskTheme have.

Each takes its Go fields as props (tsx.Register): variants by name, and icons as a name Icons gives or an SVG document. Generic components take string values. What a Go app holds in Go values a JS app holds in props: a List's and a Tree's selection are lists of keys, a Tree's items are data, and toasts go through the ref of Toasts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Icons

func Icons(named map[string]func() *core.SVG)

Icons names the icons TSX's icon props take, as an app lists the Lucide icons it uses, which keeps the others out of its binary.

Types

type Icon

type Icon struct {
	Name  func() *core.SVG
	Size  core.Points
	Color func() core.Color
}

Icon draws Name, Size points square in Color, the text's when nil.

func (Icon) Render

func (i Icon) Render(cx *core.Scope) core.Node

Render implements core.Node.

type List

type List struct {
	Count            func() int
	Key              func(i int) string
	Row              func(cx *core.Scope, index func() int) core.Node
	Multiple         bool
	Selected         func() []string
	OnSelectedChange func(selected []string)
	OnActivate       func(index int)
	TapSelects       bool
	RowLabel         func(i int) string
	Columns          int
	EstimatedSize    core.Points
	Gap              core.Points
	Header           core.Node
	Footer           core.Node
	Empty            core.Node
	OnLoadMore       func()
	Label            string
	Ref              *core.Ref
	TestID           string
	Style            core.Style
	RowStyle         core.Style
}

List is ui.List: Row gets a row's index, Key names rows, by their index when nil, and the selection is those names.

func (List) Render

func (l List) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ShellTab

type ShellTab struct {
	Text       string
	TextFunc   func() string
	Icon       func() *core.SVG
	SystemIcon string
	Badge      func() core.TabBadge
	Content    core.Node
	TestID     string
}

ShellTab is a tab of a TabShell.

type TabShell

type TabShell struct {
	Tabs      []ShellTab
	Selected  func() int
	OnChange  func(index int)
	Edge      core.TabBarEdge
	EdgeFunc  func() core.TabBarEdge
	Label     string
	LabelFunc func() string
	TestID    string
}

TabShell is ui.TabShell with each tab's Content a node.

func (TabShell) Render

func (t TabShell) Render(*core.Scope) core.Node

Render implements core.Node.

type Toasts

type Toasts struct {
	Placement  ui.ToastPlacement
	Reverse    bool
	Swipe      ui.ToastSwipe
	Inset      core.Points
	CloseLabel string
	// StyleFunc styles each toast through the reactive TSX style prop.
	StyleFunc func() core.Style
	Ref       *ToastsRef
	TestID    string
}

Toasts is ui.Toasts with a toaster of its own, which its ref drives.

func (Toasts) Render

func (t Toasts) Render(cx *core.Scope) core.Node

Render implements core.Node.

type ToastsRef

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

ToastsRef is what the ref of Toasts gets.

func (*ToastsRef) Dismiss

func (r *ToastsRef) Dismiss(id string)

Dismiss closes the toast of id.

func (*ToastsRef) DismissAll

func (r *ToastsRef) DismissAll()

DismissAll closes every toast.

func (*ToastsRef) Show

func (r *ToastsRef) Show(c ui.ToastContent) string

Show shows a toast and returns its ID.

type Tree

type Tree struct {
	Items            func() []TreeNode
	DefaultExpanded  []string
	Selected         func() []string
	OnSelectedChange func(selected []string)
	OnActivate       func(id string)
	ToggleLabel      string
	EstimatedSize    core.Points
	Empty            core.Node
	Label            string
	TestID           string
	Style            core.Style
}

Tree is ui.Tree of data: each of Items shows its Text after its Icon. It holds what is expanded itself, from DefaultExpanded, and the selection is the selected items' IDs.

func (Tree) Render

func (t Tree) Render(cx *core.Scope) core.Node

Render implements core.Node.

type TreeNode

type TreeNode struct {
	ID       string
	Text     string
	Icon     func() *core.SVG
	Children []TreeNode
}

TreeNode is an item of a Tree: its ID, what it shows, and its children.

Directories

Path Synopsis
Package chat gives TSX nsgo/ui/chat, ui/chat's conversation components, for an app that imports this package for its effect beside tsx/ui.
Package chat gives TSX nsgo/ui/chat, ui/chat's conversation components, for an app that imports this package for its effect beside tsx/ui.
Package richeditor gives TSX nsgo/ui's RichEditor, ui/richeditor's View over a RichEditorSession, which links packages other apps should not: an app whose TSX uses it imports this package for its effect.
Package richeditor gives TSX nsgo/ui's RichEditor, ui/richeditor's View over a RichEditorSession, which links packages other apps should not: an app whose TSX uses it imports this package for its effect.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL