button

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, p Params, submit func(ctx context.Context, value string) bool) (api.Widget[Patch], error)

New builds a button widget for Library.Control: a click on the enabled button submits its value param to the script waiting in ui.draw(). It is also a Use described by its text, so the agent can click it.

Types

type Params

type Params struct {
	Size     string `json:"size,omitempty" enum:"sm,md,lg" default:"md"`
	Style    string `` /* 168-byte string literal not displayed */
	Text     string `json:"text" maxLength:"80" required:"true" minLength:"1" description:"label shown on the button"`
	Disabled bool   `json:"disabled,omitempty" description:"true disables the button: clicks do nothing"`
	Value    string `json:"value,omitempty" maxLength:"1000" description:"data the click submits; empty when omitted"`
	// contains filtered or unexported fields
}

Params is what a script passes to ui.button.

type Patch

type Patch struct {
	Text     string `json:"text,omitempty" minLength:"1" maxLength:"80" description:"new label; omit to keep the current one"`
	Disabled *bool  `json:"disabled,omitempty" description:"true disables the button, false enables it; omit to keep the current state"`
	// contains filtered or unexported fields
}

Patch is what a script passes to update a button.

Jump to

Keyboard shortcuts

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