mygoui

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 20 Imported by: 0

README

MyGo UI

A complete native UI solution for MyGo applications: theme tokens, a component library, a design and behavior reference, and agent skills. Its current visual language reconstructs coss ui; PRODUCT.md records what is delivered and what is planned.

Typed options, explicit application state, semantic light/dark colors, and native editing, selection, focus and scrolling. Components compose through Go callbacks and typed collections. Applications run without a JavaScript runtime or WebView.

The native chart family adds the 19 Bklit chart subjects and composable axes, legends, brush and annotations, using the same semantic theme. Its capability matrix records native subsets rather than full React parity.

The capability matrix maps every component found across the pinned coss catalogs, where the components originated, plus their two documented hooks. A mapping records the native implementation and its limits; it does not certify visual or behavioral parity. Current verification belongs in VALIDATION.md.

The module targets Go 1.27.3 and pins MyGo v0.9.0 and mygoicons v0.2.1.

Development uses OpenSpec and Impeccable for requirements, scoped changes and native design review in Claude Code and Codex, sharing .agents/skills through .claude/skills. Start with make agents; these tools are optional development dependencies.

Try it

go run ./examples/basic
go run ./examples/gallery
go run ./examples/shell

make dev
make app

The gallery is a native component workbench with a custom title bar, grouped sidebar, Cmd/Ctrl+K search, an appearance popover, and Preview / Code / API / Tokens views. It reserves the platform's actual window-control insets rather than drawing replacement window buttons. Try it in the browser or download it for macOS, Windows or Linux from the latest release. Examples and snippets are consumers of the public API; the capability matrix records native adaptations and limits.

For external native-app tests, build the Gallery with -tags e2e and set MYGO_AUTOMATION to a socket path in a private directory. Normal builds do not import the automation plugin. See MyGo integration.

Use

Apply the theme at the start of each view build. Keep values and widget state with the window's model:

import (
    "github.com/Cyenoch/mygoui"
    "github.com/Cyenoch/mygoui/form"
    "github.com/Cyenoch/mygoui/theme"
    "github.com/egoist/mygo/ui"
)

type settings struct {
    name  string
    saved bool
}

func (s *settings) View(c *ui.Context) {
    theme.Apply(c)
    mygoui.Card(c, mygoui.CardOptions{}, func() {
        mygoui.CardHeader(c, func() {
            mygoui.CardTitle(c, "Project")
        })
        mygoui.CardContent(c, func() {
            form.Input(c, &s.name, form.InputOptions{
                Label: "Name", FullWidth: true,
            })
        })
        mygoui.CardFooter(c, func() {
            mygoui.Button(c, mygoui.ButtonOptions{
                Label: "Save",
                OnClick: func() { s.saved = true },
            })
        })
    })
}

A window with its own title bar, a sidebar and an inspector starts from layout.Scaffold; layout.TitleBar and layout.SplitView are its parts. go run ./examples/shell shows them with caller-owned pane state.

ui.Element, custom parts and *ui.Context belong to the current build. Retain model values, component state and ui.Handle instead. Use native services for clipboard and URL actions; publish worker results through Window.Update. See ownership rules.

Customize

The canonical colors are coss roles such as Primary, Secondary, MutedBackground, MutedForeground, Accent, Card, Popover, Destructive, Input and Ring. Each has an independent override in theme.PalettePatch; light and dark appearances have separate patches.

primary := ui.RGB(30, 90, 180)
onPrimary := ui.RGB(255, 255, 255)
theme.Configure(theme.Preferences{
    Radius: 10,
    Palette: theme.PaletteOverrides{
        Light: &theme.PalettePatch{
            Primary: &primary, PrimaryForeground: &onPrimary,
        },
    },
})

Call Configure before building views, or use UpdatePreferences on the UI thread and invalidate the affected windows. Read colors live with theme.Colors(c). See theme tokens and provenance.

Body, heading and mono font families are independently configurable. Defaults use native system fonts, so text metrics differ from the coss site. Applications can opt into the embedded, independently OFL-licensed Cal Sans faces:

if err := fonts.Register(); err != nil {
    return err
}
theme.UpdatePreferences(func(p *theme.Preferences) {
    p.FontFamily = fonts.Family
    p.HeadingFontFamily = fonts.Family
})

Import github.com/Cyenoch/mygoui/fonts and call this during application startup in a function returning an error. Registration is explicit and idempotent; browser builds return an error. Mono keeps native fallbacks unless the host independently registers another face. See font sources, registration and limits. Configuring a family name alone does not load that font.

Scrolling

ScrollArea supports ScrollVertical, ScrollHorizontal and ScrollBoth. ScrollFade can also decorate an existing viewport and its ui.ScrollState. MaskFade fades the native subtree to transparency through a shader effect. ShadowFade paints an edge shadow; SurfaceFade blends into the actual opaque surface color. Effect layers have an 8192-pixel side limit and exclude embedded webviews; GPU/platform checks remain separate from headless rendering. See scroll examples and limits.

Package effect applies the same kind of shader to your own elements: effect.Mask, effect.Shimmer and effect.Reveal, each with a fallback where no GPU runs it. See effects.

Agent skills

Five skills teach a coding agent to build with mygoui: components, theme, design and behavior, motion, and shader effects.

npx skills add https://github.com/Cyenoch/mygoui/tree/main/skills
npx skills add Cyenoch/mygoui --skill mygoui-components

They live in skills/ and defer to the records shipped with the module version your application uses.

References and license

DESIGN.md is the visual authority. The design language originated in coss ui commit 3d8ca28e7d90123e9e0f44665944dc240b026ccb. Run make refs to check out its source at references/coss. Reference provenance identifies the MIT apps/ui registry and documentation. The upstream monorepo has mixed licensing; packages/* is outside that MIT scope, and its source and font assets must not be copied as MIT material.

Project code retains its MIT license. See third-party notices for reference attribution, dependencies and optional font licenses. This is an independent native implementation.

Documentation

Overview

Package mygoui provides native MyGo components following coss ui.

Apply theme.Apply at the start of a view. Callers own model values and widget state per window; constructors consume a build-scoped *ui.Context and return build-scoped ui.Element values. Retain ui.Handle for persistent focus and geometry, never elements or custom parts from an earlier build.

Composition uses typed options, content callbacks and keyed collections. Related controls live in form, navigation, overlay, date, data and other family packages. A card composes ordinary native children:

mygoui.Card(c, mygoui.CardOptions{}, func() {
	mygoui.CardHeader(c, func() {
		mygoui.CardTitle(c, "Project")
	})
	mygoui.CardContent(c, func() {
		mygoui.Paragraph(c, "Ready to deploy", false)
	})
})

Colors are read live through theme.Colors. Host preferences configure semantic roles, radii and body/heading/mono families; applications register their own fonts explicitly. Importing this library does not initialize an application or start I/O or background jobs.

ScrollArea wraps native scrolling. ScrollFade provides subtree alpha masking, shadow and opaque-surface edge treatments through native paint and effects. docs/components.md maps the coss catalog and native limits, docs/theme.md describes customization, and docs/references.md records source provenance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alert

func Alert(c *ui.Context, o AlertOptions) ui.Element

Alert renders a status callout with an optional icon and action. A danger alert is an alert, which screen readers announce at once; the others are a polite status.

func Avatar

func Avatar(c *ui.Context, o AvatarOptions) ui.Element

Avatar shows an already-loaded image or initials. It never fetches.

func AvatarGroup

func AvatarGroup(c *ui.Context, o AvatarGroupOptions) ui.Element

AvatarGroup overlaps avatars by 30% of the group size and optionally adds background-colored rings. A Total above the displayed count adds overflow, named by the locale's MoreCount. It is a group; name it with Label.

func Badge

func Badge(c *ui.Context, o BadgeOptions) ui.Element

Badge renders a compact COSS status label with a size-dependent minimum.

func BadgeAnchor

func BadgeAnchor(c *ui.Context, o BadgeAnchorOptions, body func()) ui.Element

BadgeAnchor places a badge at one corner without changing the content's layout. The badge can extend beyond the box and follows ancestor clipping.

func Banner(c *ui.Context, o BannerOptions) ui.Element

Banner is a persistent message bar for the top of a window or a pane: one square row from edge to edge, ruled along its bottom. An Alert is the rounded callout within content. Its role is an Alert's. The text takes the width the icon and the close button leave, and the actions wrap below it when there is no room beside it. When the caller stops building it after OnDismiss, the bar fades out over the reveal duration; what follows it moves up at once unless the caller gives it a Position transition.

func Button

func Button(c *ui.Context, o ButtonOptions) ui.Element

Button builds a coss action on MyGo's native focusable button base. A pending spinner crossfades over the content, preserving the button size.

func ButtonGroup

func ButtonGroup(c *ui.Context, o ButtonGroupOptions, buttons ...ButtonOptions) ui.Element

ButtonGroup builds buttons with only the outer corners rounded, as coss ui does. The caller supplies complete button options, avoiding an ambient context and keeping each action independently focusable. Separators paint a half-height divider at each shared edge instead of taking layout width. Adjacent outline edges are removed, and buttons do not scale on press.

func Card

func Card(c *ui.Context, o CardOptions, body func()) ui.Element

Card is a bordered rounded surface. Each section owns its padding.

func CardContent

func CardContent(c *ui.Context, body func()) ui.Element

CardContent grows to fill the card, with horizontal padding and a 4 DIP gap. Standalone content can set vertical padding on the returned element.

func CardDescription

func CardDescription(c *ui.Context, text string) ui.Element

CardDescription renders coss ui's 14/20 muted card description.

func CardFooter

func CardFooter(c *ui.Context, body func()) ui.Element

CardFooter aligns actions in a wrapping row.

func CardFrame

func CardFrame(c *ui.Context, o CardFrameOptions, body func()) ui.Element

CardFrame builds a muted, bordered container for cards and frame sections.

func CardFrameDescription

func CardFrameDescription(c *ui.Context, text string) ui.Element

CardFrameDescription renders secondary frame text.

func CardFrameFooter

func CardFrameFooter(c *ui.Context, body func()) ui.Element

CardFrameFooter hosts frame-level content below its cards.

func CardFrameHeader

func CardFrameHeader(c *ui.Context, body func()) ui.Element

CardFrameHeader groups frame metadata above its cards.

func CardFrameTitle

func CardFrameTitle(c *ui.Context, title string) ui.Element

CardFrameTitle renders a compact semibold frame title, as FrameTitle.

func CardHeader

func CardHeader(c *ui.Context, body func()) ui.Element

CardHeader groups a title and description.

func CardTitle

func CardTitle(c *ui.Context, text string) ui.Element

CardTitle renders coss ui's 18 DIP semibold heading, a level-3 heading; set another with Level on the returned element.

func Chip

func Chip(c *ui.Context, o ChipOptions) ui.Element

Chip renders a compact status label. Its icon follows the label size.

func CloseButton

func CloseButton(c *ui.Context, o CloseButtonOptions) ui.Element

CloseButton is a 24 DIP dismiss button with a native focus ring. Hover and press show its face at once. Label defaults to the locale's Close.

func Code

func Code(c *ui.Context, text string) ui.Element

Code renders selectable inline code.

func Descriptions added in v0.2.0

func Descriptions(c *ui.Context, o DescriptionsOptions) ui.Element

Descriptions lays read-only label and value pairs out in rows of Columns items. The item ending a row takes the columns left in it, so a row is never ragged. Below 320 DIPs a column a bordered table stacks each label over its value. It builds every item: page a record of unbounded length.

func EmptyState

func EmptyState(c *ui.Context, o EmptyStateOptions) ui.Element

EmptyState centers an icon, title, description and optional recovery action. The title is a level-3 heading. With no content it shows the localized empty placeholder.

func Frame

func Frame(c *ui.Context, o FrameOptions, body func()) ui.Element

Frame builds coss's muted outer frame. Panels remain independently composable.

func FrameDescription

func FrameDescription(c *ui.Context, text string) ui.Element

FrameDescription renders the frame's secondary text.

func FrameFooter

func FrameFooter(c *ui.Context, body func()) ui.Element

FrameFooter hosts frame-level actions outside its panels.

func FrameHeader

func FrameHeader(c *ui.Context, body func()) ui.Element

FrameHeader groups a frame's title and description.

func FramePanel

func FramePanel(c *ui.Context, body func()) ui.Element

FramePanel builds a bordered panel; callers can override native layout on return.

func FrameTitle

func FrameTitle(c *ui.Context, title string) ui.Element

FrameTitle renders a compact semibold frame title, a level-3 heading; set another with Level on the returned element.

func Group

func Group(c *ui.Context, o GroupOptions, items ...GroupItem) ui.Element

Group composes native controls without an ambient provider or child inspection.

func GuideCard

func GuideCard(c *ui.Context, o GuideCardOptions) ui.Element

GuideCard is a card introducing a feature: cover, title, description, actions and a close button.

func Header(c *ui.Context, o HeaderOptions) ui.Element

Header is a small muted section heading used by menus and lists.

func Heading

func Heading(c *ui.Context, level int, text string) ui.Element

Heading renders a heading level 1–6.

func Highlight added in v0.2.0

func Highlight(c *ui.Context, o HighlightOptions) ui.Element

Highlight shows Text as one paragraph with the matches of Queries marked, as the hits of a search. Matches are found rune by rune, so text in any script keeps its characters whole, and overlapping or touching matches share one mark. The matches are found again only when the options change. Style the returned paragraph as any text.

func Image

func Image(c *ui.Context, o ImageOptions) ui.Element

Image shows an already-decoded picture in a rounded box, a skeleton while the caller loads it and a fallback when loading failed or there is no picture. It never fetches or decodes.

func Kbd

func Kbd(c *ui.Context, o KbdOptions) ui.Element

Kbd renders one coss ui keycap. Multiple keys form a chord separated by a thin gap, with the concatenated chord as its accessible text.

func KbdGroup

func KbdGroup(c *ui.Context, o KbdOptions) ui.Element

KbdGroup renders each key in a chord as a separate keycap.

func Link(c *ui.Context, o LinkOptions) ui.Element

Link is an inline, keyboard-focusable link: Enter follows it, Space does not. Hover, press and keyboard focus underline the label, and the trailing icon fades from 60% to full opacity. The underline is painted over the native text so the static layout does not shift. URL opening remains application work; the library performs no I/O.

func LinkButton

func LinkButton(c *ui.Context, o LinkButtonOptions) ui.Element

LinkButton is a text action with no hover background, padding or minimum height. It uses native button activation and focus.

func ListGroup

func ListGroup(c *ui.Context, o ListGroupOptions, body func()) ui.Element

ListGroup is a rounded surface containing related rows: a list named by Label, whose ListGroupItems are its items.

func ListGroupItem

func ListGroupItem(c *ui.Context, o ListGroupItemOptions) ui.Element

ListGroupItem renders a 16 DIP padded list item with an optional chevron, which points along the reading direction. With OnClick the row is a native button inside the item. Prefix and suffix callbacks own their layout.

func LoadingOverlay added in v0.2.0

func LoadingOverlay(c *ui.Context, o LoadingOverlayOptions, body func()) ui.Element

LoadingOverlay builds body in a container and, while Visible, covers it with a light scrim and a spinner. The covered content keeps its place and still shows, but takes neither the pointer nor the keyboard and loses the focus, which it gets back when the cover hides unless the user moved it meanwhile; the container is busy to assistive technology and the cover is a status named by Label. Size the returned container as any other.

func Meter

func Meter(c *ui.Context, o MeterOptions) ui.Element

Meter renders a coss ui meter with its label and output.

func NumberFlip added in v0.2.0

func NumberFlip(c *ui.Context, o NumberFlipOptions) ui.Element

NumberFlip shows a value that rolls its digits to a new one: columns are matched from the end, a digit slides out and in over 300 ms in the direction of the change, and other characters crossfade. Reduced motion crossfades only. At rest it is plain text. Assistive technology reads the whole value once.

func Paragraph

func Paragraph(c *ui.Context, text string, small bool) ui.Element

Paragraph renders selectable body copy at base or small size.

func PressableFeedback

func PressableFeedback(c *ui.Context, o PressableFeedbackOptions, body func()) ui.Element

PressableFeedback animates a 0.985 press scale and shows its hover and pressed surfaces at once. It does not draw a ripple.

func ProgressBar

func ProgressBar(c *ui.Context, o ProgressOptions) ui.Element

ProgressBar draws a linear determinate or indeterminate indicator, with an optional label and value output above the track.

func ProgressCircle

func ProgressCircle(c *ui.Context, o ProgressCircleOptions) ui.Element

ProgressCircle draws a determinate ring or an indeterminate native spinner and exposes its progress through native accessibility semantics.

func Prose

func Prose(c *ui.Context, body func()) ui.Element

Prose arranges caller-composed typography with an 8 DIP gap.

func ResizablePanel

func ResizablePanel(c *ui.Context, o ResizablePanelOptions, body func()) ui.Element

ResizablePanel sizes body along one axis and lets the user move the edge on Side by pointer or keyboard: arrows step 16 DIPs, PageUp and PageDown 64, Home goes to Min and End to Max, if there is one; on a collapsible panel Enter or a double click toggles it. The cross axis stretches to the parent.

func Result

func Result(c *ui.Context, o ResultOptions) ui.Element

Result centers a status icon, title, description, actions and optional detail. Text and actions are an EmptyState; the icon carries the status, which assistive technology reads as an image named by it.

func ScrollArea

func ScrollArea(c *ui.Context, state *ui.ScrollState, o ScrollAreaOptions, body func()) ui.Element

ScrollArea retains native scrolling, focus, wheel and scrollbar behavior.

func ScrollFade

func ScrollFade(c *ui.Context, viewport ui.Element, state *ui.ScrollState, o ScrollFadeOptions) ui.Element

ScrollFade decorates any native viewport tracking state, including existing application scroll views. It preserves native hit testing and adds no timer. MaskFade uses an effect on the viewport, replacing any existing effect. Without a GPU, or for a viewport above MyGo's 8192-pixel effect layer, the shadow stands in for the mask. Embedded web views do not show through it.

func ScrollShadow

func ScrollShadow(c *ui.Context, s *ui.ScrollState, o ScrollShadowOptions, body func()) ui.Element

ScrollShadow wraps caller-owned content in a native scroll viewport and fades both edges in proportion to the remaining scroll distance.

func Separator

func Separator(c *ui.Context, o SeparatorOptions) ui.Element

Separator draws a decorative 1 DIP rule. Vertical rules stretch to the row height.

func SettingsGroup added in v0.2.0

func SettingsGroup(c *ui.Context, o SettingsGroupOptions) ui.Element

SettingsGroup is a boxed list of settings: a header over one rounded card whose rows are separated by hairlines.

func Sidebar(c *ui.Context, o SidebarOptions) ui.Element

Sidebar builds a scrollable navigation sidebar with a native collapse toggle and individually focusable navigation actions. The caller owns the selected ID, collapse state and the work performed by an activation.

func Skeleton

func Skeleton(c *ui.Context, o SkeletonOptions) ui.Element

Skeleton paints a muted placeholder with a paint-only shimmer or pulse. Reduced motion and high contrast keep it still.

func SkeletonGroup

func SkeletonGroup(c *ui.Context, o SkeletonGroupOptions, body func()) ui.Element

SkeletonGroup lays out placeholders, as a busy group named by the locale's Loading, and animates the entire rendered subtree together through effect.Shimmer. Skeletons inside a group should use SkeletonNone. Without a GPU, above MyGo's 8192-pixel effect layer, under reduced motion and under high contrast the group rests; embedded web views do not show through it while it animates.

func Spinner

func Spinner(c *ui.Context, o SpinnerOptions) ui.Element

Spinner uses MyGo's maintained arc indicator. The toolkit owns frame scheduling and reduced-motion poses. The native arc approximates COSS's rotating loading icon.

func Spoiler added in v0.2.0

func Spoiler(c *ui.Context, o SpoilerOptions, body func()) ui.Element

Spoiler cuts body at MaxHeight, fading its last lines out, and adds a control that shows the rest and hides it again. Content that fits shows whole, with no control. The height is that of the last layout, so the control follows the content one frame after it changes.

func Statistic added in v0.2.0

func Statistic(c *ui.Context, o StatisticOptions) ui.Element

Statistic shows a large value under its label, with an optional change. A value wider than its room is cut with an ellipsis and shown whole in a tooltip. Assistive technology reads it as a group named by the label.

func StatusDot added in v0.2.0

func StatusDot(c *ui.Context, o StatusDotOptions) ui.Element

StatusDot shows a small colored dot before an optional label. A success, warning, danger or info dot is an image named by its status, so the status does not rest on colour alone. The dot takes its own size only: a pulse's ring grows past it, over what is around. The motion only repaints the dot; a still dot asks for no frames.

func StatusIcon

func StatusIcon(color StatusColor) *ui.SVG

StatusIcon is the coss icon for a status: info, check, triangle alert, or circle alert for danger.

func Surface

func Surface(c *ui.Context, o SurfaceOptions, body func()) ui.Element

Surface paints a theme surface and exposes the matching foreground.

func Tag

func Tag(c *ui.Context, o TagOptions) ui.Element

Tag renders one tag. Most callers use TagGroup; Tag is available for a standalone label.

func TagGroup

func TagGroup(c *ui.Context, o TagGroupOptions, tags []TagOptions) ui.Element

TagGroup lays out removable, optionally selectable tags. Tags stay smaller than buttons and expose native focus and removal actions.

func Timeline added in v0.2.0

func Timeline(c *ui.Context, o TimelineOptions) ui.Element

Timeline shows events down a line of markers. It builds every item that is shown: show a bounded history, and page or virtualize a log of unbounded length.

func ToggleButton

func ToggleButton(c *ui.Context, o ToggleButtonOptions) ui.Element

ToggleButton is a focusable native toggle whose selected paint follows the caller's bool. It is not a radio: each button owns its state.

func ToggleButtonGroup

func ToggleButtonGroup(c *ui.Context, o ToggleButtonGroupOptions, buttons ...ToggleButtonOptions) ui.Element

ToggleButtonGroup lays out caller-owned toggle states. Each option carries its own Selected pointer, so single- and multi-select are both explicit Go state rather than an ambient group context. Outline-only groups join their items; other groups use independent rounded items with a 2 DIP gap.

func Typography

func Typography(c *ui.Context, text string, o TypographyOptions) ui.Element

Typography renders a semantic theme type role. Headings expose a heading role and level to assistive technology; body and code remain ordinary text.

Types

type AlertOptions

type AlertOptions struct {
	Title, Description string
	Status             StatusColor
	Icon               *ui.SVG
	// ShowIcon uses the status glyph when Icon is nil.
	ShowIcon bool
	Action   func()
}

AlertOptions configures a status callout.

type Align

type Align uint8

Align is placement alignment along the chosen edge.

const (
	AlignCenter Align = iota
	AlignStart
	AlignEnd
)

type AvatarGroupOptions

type AvatarGroupOptions struct {
	Size    AvatarSize
	Overlap float32
	Ring    bool
	Grid    bool
	Total   int
	Avatars []AvatarOptions
}

AvatarGroupOptions configures an avatar stack or grid.

type AvatarOptions

type AvatarOptions struct {
	Image    ui.ImageSource
	Name     string
	Fallback string
	Size     AvatarSize
	Soft     bool
	Ring     bool
	Color    StatusColor
	Badge    func()
}

AvatarOptions configures a caller-loaded avatar. Name is the accessible name; Fallback overrides generated initials.

type AvatarSize

type AvatarSize uint8

AvatarSize selects a native avatar size.

const (
	AvatarMedium AvatarSize = iota
	AvatarSmall
	AvatarLarge
)

type BadgeAnchorOptions

type BadgeAnchorOptions struct {
	Placement BadgePlacement
	Badge     BadgeOptions
}

BadgeAnchorOptions places a badge over caller content.

type BadgeOptions

type BadgeOptions struct {
	Label   string
	Variant BadgeVariant
	Size    BadgeSize
	Icon    *ui.SVG
}

BadgeOptions configures a badge.

type BadgePlacement

type BadgePlacement uint8

BadgePlacement is the corner used by BadgeAnchor.

const (
	BadgeTopRight BadgePlacement = iota
	BadgeTopLeft
	BadgeBottomRight
	BadgeBottomLeft
)

type BadgeSize

type BadgeSize uint8

BadgeSize is coss ui's badge scale.

const (
	BadgeMedium BadgeSize = iota
	BadgeSmall
	BadgeLarge
)

type BadgeVariant

type BadgeVariant uint8

BadgeVariant selects a coss ui badge surface treatment.

const (
	BadgePrimary BadgeVariant = iota
	BadgeSecondary
	BadgeOutline
	BadgeDestructive
	BadgeError
	BadgeInfo
	BadgeSuccess
	BadgeWarning
)

type BannerOptions added in v0.2.0

type BannerOptions struct {
	Text   string
	Status StatusColor
	Icon   *ui.SVG
	// ShowIcon uses the status glyph when Icon is nil.
	ShowIcon  bool
	Action    func()
	OnDismiss func()
}

BannerOptions configures a message bar. Status tints it as an Alert's does. Action builds its controls after the text. OnDismiss adds a close button and is called when it is pressed: the caller stops building the banner.

type ButtonAlign

type ButtonAlign uint8

ButtonAlign places button content.

const (
	ButtonAlignCenter ButtonAlign = iota
	ButtonAlignStart
	ButtonAlignEnd
)

type ButtonGroupOptions

type ButtonGroupOptions struct {
	Orientation ButtonGroupOrientation
	FullWidth   bool
	Separators  bool
}

ButtonGroupOptions controls a joined set of buttons.

type ButtonGroupOrientation

type ButtonGroupOrientation uint8

ButtonGroupOrientation selects the join axis.

const (
	GroupHorizontal ButtonGroupOrientation = iota
	GroupVertical
)

type ButtonOptions

type ButtonOptions struct {
	Label     string
	Icon      *ui.SVG
	EndIcon   *ui.SVG
	Variant   ButtonVariant
	Size      theme.ButtonSize
	IconOnly  bool
	FullWidth bool
	Loading   bool
	Disabled  bool
	OnClick   func()
	Handle    *ui.Handle
	Tooltip   string
	Content   func()

	// Align overrides the centered label placement, for navigation rows and
	// other left-aligned actions.
	Align ButtonAlign

	// Corners overrides the uniform radius. Nil keeps the default;
	// a zero array makes square corners.
	Corners *[4]float32
}

ButtonOptions configures a native button. Label is always the accessible name, including icon-only layouts and custom content.

type ButtonVariant

type ButtonVariant uint8

ButtonVariant selects a button face, including native theme extensions.

const (
	ButtonPrimary ButtonVariant = iota
	ButtonSecondary
	ButtonTertiary
	ButtonOutline
	ButtonGhost
	ButtonDanger
	ButtonDangerSoft
	ButtonDestructiveOutline
	ButtonLink
)

type CardFrameOptions

type CardFrameOptions struct {
	Label string
}

CardFrameOptions configures a framed group of cards and supporting content.

type CardOptions

type CardOptions struct {
	Variant CardVariant
	Label   string
	OnClick func()
	Handle  *ui.Handle
}

CardOptions customizes a Card. OnClick makes the whole card a real native action without changing its visual variants.

type CardVariant

type CardVariant uint8

CardVariant selects a card surface, including native theme extensions.

const (
	CardDefault CardVariant = iota
	CardSecondary
	CardTertiary
	CardTransparent
)

type ChipOptions

type ChipOptions struct {
	Label   string
	Color   StatusColor
	Variant ChipVariant
	Size    ChipSize
	Icon    *ui.SVG
}

ChipOptions configures a compact native chip.

type ChipSize

type ChipSize uint8

ChipSize selects the chip's density.

const (
	ChipMedium ChipSize = iota
	ChipSmall
	ChipLarge
)

type ChipVariant

type ChipVariant uint8

ChipVariant selects a native chip surface treatment.

const (
	ChipSecondary ChipVariant = iota
	ChipPrimary
	ChipSoft
	ChipTertiary
)

type CloseButtonOptions

type CloseButtonOptions struct {
	Label    string
	Disabled bool
	OnClick  func()
}

CloseButtonOptions configures the compact dismiss control.

type DescriptionsItem added in v0.2.0

type DescriptionsItem struct {
	Label, Value string
	Content      func()
	Span         int
}

DescriptionsItem is one labelled value. Content replaces the Value text with caller-built content, as a badge or a link. Span is the number of columns the item takes; values below one take one.

type DescriptionsOptions added in v0.2.0

type DescriptionsOptions struct {
	Title          string
	Items          []DescriptionsItem
	Columns        int
	MinColumnWidth float32
	Bordered       bool
	Truncate       bool
	// Loading keeps the labels and shows a skeleton bar in place of each
	// value, for a record whose values have not arrived.
	Loading bool
}

DescriptionsOptions configures a grid of labelled values. Columns is the number of items in a row, three when zero; the grid drops to fewer when its width leaves a column less than MinColumnWidth, 200 DIPs when zero. Bordered draws the values as a ruled table with the labels in aligned, tinted columns; otherwise each label sits above its value. A value that is empty shows a muted dash. Values wrap; Truncate cuts each at one line and shows the whole in a tooltip. Each item is a group named by its label.

type EmptyStateOptions

type EmptyStateOptions struct {
	Title, Description string
	Icon               *ui.SVG
	Action             func()
}

EmptyStateOptions configures a quiet empty result.

type FlyoutHost

type FlyoutHost struct {
	Window *mygo.Window
}

FlyoutHost lets anchored popups open as native flyouts of Window, so they can extend beyond it. Keep one per window and pass a pointer to it in a popup's options. A nil host, a nil Window or a platform without flyouts (WebAssembly) keeps the popup inside the window.

type FrameOptions

type FrameOptions struct {
	Padding, Gap float32
	Label        string
}

FrameOptions configures the inset between a frame and its independent panels.

type GroupItem

type GroupItem struct {
	Key   string
	Build func(corners [4]float32) ui.Element
}

GroupItem builds one control with the supplied outer-only corner radii. A mixed group can combine buttons, editors and application-defined controls.

type GroupOptions

type GroupOptions struct {
	Orientation Orientation
	FullWidth   bool
	Label       string
}

GroupOptions configures joined controls. Each item receives its own corners before construction, so its paint and keyboard focus use the same geometry.

type GuideCardOptions

type GuideCardOptions struct {
	Title, Description string
	Cover              ui.ImageSource
	CoverContent       func()
	Actions            func()
	OnDismiss          func()
}

GuideCardOptions configures a dismissible tip. Cover is an already-decoded picture shown across the top at its own ratio; CoverContent builds a custom cover instead. OnDismiss adds the close button: the caller stops rendering the card.

type HeaderOptions

type HeaderOptions struct {
	Text string
}

HeaderOptions configures a section header.

type HighlightOptions added in v0.2.0

type HighlightOptions struct {
	Text       string
	Queries    []string
	IgnoreCase bool
}

HighlightOptions configures marked text. Every occurrence of each query in Text is marked; queries are trimmed and blank ones ignored. IgnoreCase matches letters whatever their case.

type ImageFit

type ImageFit uint8

ImageFit selects how the picture fills its box.

const (
	ImageCover ImageFit = iota
	ImageContain
)

type ImageOptions

type ImageOptions struct {
	Source        ui.ImageSource
	Label         string
	Width, Height float32
	AspectRatio   float32
	Fit           ImageFit
	Radius        float32
	Status        ImageStatus
	// Fallback adds content under the failed icon.
	Fallback func()
	// OnClick makes a shown picture a button, as for opening a preview.
	OnClick func()
}

ImageOptions configures a caller-loaded image. Label is the accessible name. A zero Width fills the parent. Height wins over AspectRatio (width / height); with neither, the box takes the picture's own ratio, or 16:9 while there is none. A nonpositive Radius uses the theme's large radius.

type ImageStatus

type ImageStatus uint8

ImageStatus is the caller's load state for an Image.

const (
	ImageReady ImageStatus = iota
	ImageLoading
	ImageFailed
)

type IndicatorColor

type IndicatorColor uint8

IndicatorColor is the color of a progress or meter indicator. Its zero value uses the primary color, unlike the status colors used by chips.

const (
	IndicatorAccent IndicatorColor = iota
	IndicatorDefault
	IndicatorSuccess
	IndicatorWarning
	IndicatorDanger
)

type KbdOptions

type KbdOptions struct {
	Keys []string
	// Light removes the default background.
	Light bool
}

KbdOptions configures a keyboard chord.

type LinkButtonOptions

type LinkButtonOptions struct {
	Label    string
	Icon     *ui.SVG
	Disabled bool
	OnClick  func()
}

LinkButtonOptions configures a link-style native button.

type LinkOptions

type LinkOptions struct {
	Label    string
	Icon     *ui.SVG
	Disabled bool
	OnClick  func()
	Tooltip  string
}

LinkOptions configures an inline native action.

type ListGroupItemOptions

type ListGroupItemOptions struct {
	Title, Description string
	Prefix, Suffix     func()
	Chevron            bool
	Disabled           bool
	OnClick            func()
}

ListGroupItemOptions configures one row.

type ListGroupOptions

type ListGroupOptions struct {
	Variant SurfaceVariant
	Label   string
}

ListGroupOptions configures a native list group.

type LoadingOverlayOptions added in v0.2.0

type LoadingOverlayOptions struct {
	Visible bool
	Label   string
	// ShowLabel prints Label under the spinner, on a plate that keeps it
	// legible over the content.
	ShowLabel bool
}

LoadingOverlayOptions configures a loading cover. Visible is the caller's flag. Label names what is loading to assistive technology; the locale's Loading when empty.

type MeterOptions

type MeterOptions struct {
	Label           string
	Value, Min, Max float64
	Color           IndicatorColor
	Size            ProgressSize
	ShowOutput      bool
	OutputText      string
}

MeterOptions configures a quantity within a known range.

type NumberFlipOptions added in v0.2.0

type NumberFlipOptions struct {
	// Value is shown as given: the caller formats separators, signs and
	// units. A change rolls the digits that differ and fades the rest.
	Value string
	// Style is the text role of the value; the zero value is theme.H2.
	Style theme.TextStyle
	// Color is the ink; the zero value is the foreground.
	Color ui.Color
	// Label is the accessible name; Value when empty.
	Label string
}

NumberFlipOptions configures a value whose digits roll when it changes.

type Orientation

type Orientation uint8

Orientation is a horizontal or vertical layout direction.

const (
	Horizontal Orientation = iota
	Vertical
)

type PanelSide

type PanelSide uint8

PanelSide selects the edge of a ResizablePanel that carries its handle. Start and end follow the layout direction.

const (
	PanelEnd PanelSide = iota
	PanelStart
	PanelTop
	PanelBottom
)

type Placement

type Placement struct {
	Side   Side
	Align  Align
	Offset float32
}

Placement anchors a floating panel. Offset is the gap from the anchor; zero uses the component's default gap, typically 4 DIPs.

type PressableFeedbackOptions

type PressableFeedbackOptions struct {
	Label     string
	Disabled  bool
	FullWidth bool
	OnClick   func()
}

PressableFeedbackOptions configures a native press-feedback container.

type ProgressCircleOptions

type ProgressCircleOptions struct {
	Label           string
	Value, Min, Max float64
	Indeterminate   bool
	Color           IndicatorColor
	Size            ProgressSize
	ShowOutput      bool
}

ProgressCircleOptions configures a circular indicator.

type ProgressOptions

type ProgressOptions struct {
	Label           string
	Value, Min, Max float64
	Indeterminate   bool
	Color           IndicatorColor
	Size            ProgressSize
	ShowOutput      bool
	OutputText      string
}

ProgressOptions configures a bar indicator.

type ProgressSize

type ProgressSize uint8

ProgressSize selects a native meter or progress track height.

const (
	ProgressMedium ProgressSize = iota
	ProgressSmall
	ProgressLarge
)

type ResizablePanelOptions

type ResizablePanelOptions struct {
	Label            string
	Side             PanelSide
	Size             *float32
	Min, Max         float32
	Collapsed        *bool
	OnResize         func(size float32)
	OnCollapseChange func(collapsed bool)
	Shown            *float32
	// Border colours the hairline on the edge at rest; zero uses the
	// theme's Border.
	Border ui.Color
}

ResizablePanelOptions configures a panel resized from one edge. Size, Min and Max are DIPs along the resized axis before the text scale; Size is always shown within [Min, Max], and a nonpositive Max sets no upper bound. A nil Size is kept by the panel. A non-nil Collapsed makes the panel collapsible. Label names the handle and defaults to the locale's Resize.

Shown, when set, receives the size the panel has in this build, in DIPs after the text scale: it runs behind Size while the panel collapses or expands, for layout beside the panel that follows the motion.

type ResultOptions

type ResultOptions struct {
	Status             StatusColor
	Title, Description string
	Icon               *ui.SVG
	// Actions builds the buttons under the text.
	Actions func()
	// Content builds supporting detail under the actions.
	Content func()
}

ResultOptions configures the outcome of an operation. Status picks the tint and the default icon; Icon replaces the glyph and keeps the tint.

type ScrollAreaOptions

type ScrollAreaOptions struct {
	Axis   ScrollAxis
	Height float32
	Label  string
	Fade   *ScrollFadeOptions
}

ScrollAreaOptions configures a scroll viewport with native scrollbars.

type ScrollAxis

type ScrollAxis uint8

ScrollAxis selects the axes of a native scroll area.

const (
	ScrollVertical ScrollAxis = iota
	ScrollHorizontal
	ScrollBoth
)

type ScrollFadeEdges

type ScrollFadeEdges uint8

ScrollFadeEdges selects physical viewport edges; zero enables every edge.

const (
	FadeTop ScrollFadeEdges = 1 << iota
	FadeRight
	FadeBottom
	FadeLeft
)

type ScrollFadeMode

type ScrollFadeMode uint8

ScrollFadeMode selects a native edge treatment.

const (
	ShadowFade ScrollFadeMode = iota
	SurfaceFade
	// MaskFade fades the viewport and its descendants to transparency.
	MaskFade
)

type ScrollFadeOptions

type ScrollFadeOptions struct {
	Mode    ScrollFadeMode
	Edges   ScrollFadeEdges
	Size    float32
	Surface ui.Color
	Color   ui.Color
}

ScrollFadeOptions customizes an edge fade independently of scrolling. SurfaceFade requires the actual opaque surface. Color customizes a shadow. MaskFade uses a subtree effect and needs neither Surface nor Color.

type ScrollShadowOptions

type ScrollShadowOptions struct {
	Orientation ScrollShadowOrientation
	Surface     ui.Color
	Size        float32
	Height      float32
	Label       string
}

ScrollShadowOptions describes an opaque scrolling surface. The edge fade is painted in Surface, which should be the actual opaque background. ScrollArea with MaskFade instead fades content to transparency.

type ScrollShadowOrientation

type ScrollShadowOrientation uint8

ScrollShadowOrientation selects the scroll axis; vertical is the default.

const (
	ScrollShadowVertical ScrollShadowOrientation = iota
	ScrollShadowHorizontal
)

type SeparatorColor

type SeparatorColor uint8

SeparatorColor selects the divider's emphasis.

const (
	SeparatorDefault SeparatorColor = iota
	SeparatorSecondary
	SeparatorTertiary
)

type SeparatorOptions

type SeparatorOptions struct {
	Orientation Orientation
	Color       SeparatorColor
}

SeparatorOptions configures a semantic divider.

type SettingsGroupOptions added in v0.2.0

type SettingsGroupOptions struct {
	Title, Description string
	Action             func()
	Rows               []SettingsRow
	// Loading shows LoadingRows skeleton rows while the group has no rows
	// yet. With rows it is a refresh: they dim, ignore input and a line runs
	// along the top of the card.
	Loading     bool
	LoadingRows int
}

SettingsGroupOptions configures a titled group of settings rows. Action builds a control at the end of the header, as a button acting on the whole group.

type SettingsRow added in v0.2.0

type SettingsRow struct {
	Icon            *ui.SVG
	Title, Subtitle string
	Trailing        func()
	Control         *ui.Handle
	OnClick         func()
	Rows            []SettingsRow
	Expanded        *bool
	Disabled        bool
	Destructive     bool
}

SettingsRow is one row of a SettingsGroup: a leading icon, a title over a subtitle, and Trailing, which builds the row's control or value.

Control is the handle the caller bound to the control Trailing builds, so that the title names it for assistive technology; on a plain row a click on the title also focuses or toggles it.

OnClick makes the whole row a button with a chevron; its Trailing then holds passive content, as the current value. Rows makes the row an expander revealing them, open while *Expanded, which the row keeps per window when nil, under the row's Title, which then must differ among the expanders of a group; an expander's own OnClick is not used.

The trailing control sits beside the text and goes below it where they do not fit in one line. Destructive inks the icon and the title with the danger color, for a row that deletes or resets. The rows of an expander start at the edge of its title.

type Side

type Side uint8

Side is a placement edge. SideAuto selects the component's default edge.

const (
	SideAuto Side = iota
	SideTop
	SideBottom
	SideLeft
	SideRight
)

type SidebarGroupOptions

type SidebarGroupOptions struct {
	Key   string
	Label string
	Items []SidebarItemOptions
}

SidebarGroupOptions groups navigation actions under an optional label. Key preserves the group's identity when groups are reordered and must be unique among groups when set. Without a key, its position is its identity.

type SidebarItemOptions

type SidebarItemOptions struct {
	ID       string
	Label    string
	Icon     *ui.SVG
	Disabled bool
	OnClick  func()
}

SidebarItemOptions describes one navigation action. ID must be nonempty and unique within the sidebar; Label is its accessible name. OnClick runs after the selection is updated.

type SidebarOptions

type SidebarOptions struct {
	Selected         *string
	Collapsed        *bool
	Groups           []SidebarGroupOptions
	Header           func()
	Footer           func()
	Width            float32
	CollapsedWidth   float32
	Label            string
	ToggleLabel      string
	OnSelect         func(id string)
	OnCollapseChange func(collapsed bool)
}

SidebarOptions configures a sidebar. Selected and Collapsed are required caller-owned per-window state, and an empty Selected means no selection. Width and CollapsedWidth scale with the text size; nonpositive values use the 256 and 48 DIP defaults. Header and Footer build their own content in both states and can read Collapsed to adapt their layout. A collapsed item without an icon retains its text so it remains usable.

OnSelect runs for every enabled activation, including the current item, before the item's OnClick. The sidebar is a navigation landmark named by Label, the selected item its current page; Label and ToggleLabel default to the locale's Sidebar and ToggleSidebar.

type SkeletonAnimation

type SkeletonAnimation uint8

SkeletonAnimation selects placeholder motion; shimmer is the COSS default.

const (
	SkeletonShimmer SkeletonAnimation = iota
	SkeletonPulse
	SkeletonNone
)

type SkeletonGroupOptions

type SkeletonGroupOptions struct {
	Animation SkeletonAnimation
}

SkeletonGroupOptions coordinates placeholder animation.

type SkeletonOptions

type SkeletonOptions struct {
	Width, Height float32
	Radius        float32
	Circle        bool
	Animation     SkeletonAnimation
}

SkeletonOptions reserves the shape of loading content.

type SpinnerOptions

type SpinnerOptions struct {
	Size  SpinnerSize
	Color StatusColor
	Label string
}

SpinnerOptions configures a loading indicator.

type SpinnerSize

type SpinnerSize uint8

SpinnerSize selects a native loading indicator size.

const (
	SpinnerMedium SpinnerSize = iota
	SpinnerSmall
	SpinnerLarge
	SpinnerExtraLarge
)

type SpoilerOptions added in v0.2.0

type SpoilerOptions struct {
	Expanded             *bool
	MaxHeight            float32
	ShowLabel, HideLabel string
}

SpoilerOptions configures clamped content. Expanded is the caller-owned flag the control toggles; nil keeps the flag with the element. MaxHeight is the height the content is cut at while collapsed, 96 scaled DIPs when zero. ShowLabel and HideLabel replace the locale's control labels.

type StatisticOptions added in v0.2.0

type StatisticOptions struct {
	Label          string
	Value          string
	Prefix, Suffix string
	Delta          string
	Trend          StatisticTrend
	DeltaStatus    StatusColor
	// Content builds caller content under the value and its change, as a
	// sparkline or a progress bar.
	Content func()
	// Loading keeps the label and shows a skeleton block in the value's
	// place, of the value's height; the delta waits for data.
	Loading bool
}

StatisticOptions configures a metric. Value, Prefix, Suffix and Delta are shown as given: the caller formats numbers, units and signs. Delta shows under the value with the icon of Trend; DeltaStatus replaces the color the trend implies (success up, danger down), as for a cost that rose.

type StatisticTrend added in v0.2.0

type StatisticTrend uint8

StatisticTrend is the direction of a metric's change.

const (
	// TrendFlat marks a change with no direction.
	TrendFlat StatisticTrend = iota
	TrendUp
	TrendDown
)

type StatusColor

type StatusColor uint8

StatusColor selects a semantic color for native status components.

const (
	ColorDefault StatusColor = iota
	ColorAccent
	ColorSuccess
	ColorWarning
	ColorDanger
	// ColorInfo uses the theme's informational color.
	ColorInfo
)

type StatusDotOptions added in v0.2.0

type StatusDotOptions struct {
	Status  StatusColor
	Label   string
	Pulse   bool
	Breathe bool
}

StatusDotOptions configures a status indicator. The default status is a muted dot, as for something offline. Pulse radiates a ring from the dot, for something live; Breathe slowly dims and restores the dot, for something in progress such as connecting. Both are still under reduced motion.

type StatusPalette

type StatusPalette struct {
	Solid, SolidForeground ui.Color
	Hover                  ui.Color
	Soft, SoftForeground   ui.Color
	SoftHover              ui.Color
	Foreground             ui.Color
}

StatusPalette is the resolved color set for one status. Components and applications use it to paint custom status surfaces consistently.

func StatusColors

func StatusColors(c *ui.Context, color StatusColor) StatusPalette

StatusColors resolves a status against the live theme.

type SurfaceOptions

type SurfaceOptions struct {
	Variant   SurfaceVariant
	Padding   float32
	Radius    float32
	FillWidth bool
	Label     string
}

SurfaceOptions customizes a native Surface. Padding and Radius default to zero so callers can compose their own layout.

type SurfaceVariant

type SurfaceVariant uint8

SurfaceVariant selects a native container surface.

const (
	SurfaceDefault SurfaceVariant = iota
	SurfaceSecondary
	SurfaceTertiary
	SurfaceTransparent
)

type TagGroupOptions

type TagGroupOptions struct {
	Label, Description, Error string
	Selection                 TagSelection
	Size                      TagSize
	Variant                   TagVariant
	State                     *TagGroupState
	OnChange                  func(keys []string)
}

TagGroupOptions configures a focusable tag collection.

type TagGroupState

type TagGroupState struct {
	Selected map[string]bool
}

TagGroupState is caller-owned tag selection.

func (*TagGroupState) IsSelected

func (s *TagGroupState) IsSelected(key string) bool

IsSelected reports whether key is chosen.

type TagOptions

type TagOptions struct {
	Key       string
	Label     string
	Icon      *ui.SVG
	Removable bool
	Disabled  bool
	OnRemove  func()
	OnClick   func()
}

TagOptions configures one tag.

type TagSelection

type TagSelection uint8

TagSelection selects the tag group's selection behavior.

const (
	TagSelectNone TagSelection = iota
	TagSelectSingle
	TagSelectMultiple
)

type TagSize

type TagSize uint8

TagSize selects the tag's density.

const (
	TagMedium TagSize = iota
	TagSmall
	TagLarge
)

type TagVariant

type TagVariant uint8

TagVariant selects the unselected tag surface.

const (
	TagDefault TagVariant = iota
	TagSurface
)

type TimelineItem added in v0.2.0

type TimelineItem struct {
	Title, Description string
	Time               string
	Status             StatusColor
	Icon               *ui.SVG
	Content            func()
	OnClick            func()
}

TimelineItem is one event. Status colors its marker, which assistive technology reads by the status's name; Icon replaces the dot with a glyph on a tinted disc. Time is shown as given, after the title. Content builds caller content under the description, as a diff summary or an attachment. OnClick makes the text a button, as for opening the event's details.

type TimelineOptions added in v0.2.0

type TimelineOptions struct {
	Items        []TimelineItem
	Label        string
	Pending      bool
	Recent       int
	Expanded     *bool
	EarlierLabel string
}

TimelineOptions configures a vertical list of events, in the order given. Pending marks the last item as still in progress: its marker is a spinner and the line leading to it is dashed. Recent, when positive and less than the number of items, shows only that many of the newest behind a control that reveals the earlier ones; Expanded is the caller-owned flag it toggles, kept with the element when nil, and EarlierLabel names the control, the locale's ShowMore when empty (the caller formats a count).

type ToggleButtonGroupOptions

type ToggleButtonGroupOptions struct {
	Orientation Orientation
	FullWidth   bool
	// Detached keeps a 4 DIP gap even for outline toggles.
	Detached bool
	// Separators paints a divider at the shared edges of joined outline toggles.
	Separators bool
}

ToggleButtonGroupOptions controls a joined or detached toggle set.

type ToggleButtonOptions

type ToggleButtonOptions struct {
	Label     string
	Icon      *ui.SVG
	Variant   ToggleButtonVariant
	Size      theme.ButtonSize
	IconOnly  bool
	FullWidth bool
	Selected  *bool
	// Loading answers a press in flight: the control keeps its size and
	// state, shows a spinner and takes no press until it clears.
	Loading  bool
	Disabled bool
	OnChange func(bool)
	Tooltip  string
	// Corners overrides the uniform radius. Nil keeps it.
	Corners *[4]float32
}

ToggleButtonOptions configures a persistent pressed-state button. Selected is caller-owned; clicking flips it and reports the new value.

type ToggleButtonVariant

type ToggleButtonVariant uint8

ToggleButtonVariant selects a toggle surface, including a native ghost variant.

const (
	ToggleDefault ToggleButtonVariant = iota
	ToggleGhost
	ToggleOutline
)

type TypographyOptions

type TypographyOptions struct {
	Type       theme.SemanticType
	Muted      bool
	Truncate   bool
	Align      ui.Align
	Weight     int
	Selectable bool
	Level      int
}

TypographyOptions selects a semantic theme role and emphasis.

Directories

Path Synopsis
Package chart provides native, coss-themed charts inspired by Bklit's MIT chart catalog.
Package chart provides native, coss-themed charts inspired by Bklit's MIT chart catalog.
Package color implements color controls with native MyGo painting, keyboard handling and accessibility.
Package color implements color controls with native MyGo painting, keyboard handling and accessibility.
Package content provides native components that copy, colour and render text: a copy button, a one-line snippet, a highlighted code block, themed Markdown and a QR code.
Package content provides native components that copy, colour and render text: a copy button, a one-line snippet, a highlighted code block, themed Markdown and a QR code.
Package data provides a COSS-inspired native table.
Package data provides a COSS-inspired native table.
Package date provides COSS-inspired Gregorian date and time controls: Calendar, RangeCalendar, DateField, DatePicker, DateRangePicker and TimeField.
Package date provides COSS-inspired Gregorian date and time controls: Calendar, RangeCalendar, DateField, DatePicker, DateRangePicker and TimeField.
Package effect applies shader effects to an application's own elements: Mask fades edges to transparency, Shimmer passes a loading highlight over placeholders and Reveal wipes arriving content in.
Package effect applies shader effects to an application's own elements: Mask fades edges to transparency, Shimmer passes a loading highlight over placeholders and Reveal wipes arriving content in.
examples
basic command
Command basic demonstrates a small native application using mygoui.
Command basic demonstrates a small native application using mygoui.
gallery command
Command gallery opens the native MyGo UI component workbench.
Command gallery opens the native MyGo UI component workbench.
shell command
Command shell demonstrates the layout family: a custom title bar, a resizable sidebar, an inspector and a status strip, built with layout.Scaffold.
Command shell demonstrates the layout family: a custom title bar, a resizable sidebar, an inspector and a status strip, built with layout.Scaffold.
Package fonts provides the optional Cal Sans font family.
Package fonts provides the optional Cal Sans font family.
Package form provides Coss-inspired form controls with native MyGo editing, focus, selection and accessibility.
Package form provides Coss-inspired form controls with native MyGo editing, focus, selection and accessibility.
internal
anchored
Package anchored maps typed placements onto MyGo's native anchor engine.
Package anchored maps typed placements onto MyGo's native anchor engine.
apidoc
Package apidoc derives the gallery's API reference from the library source.
Package apidoc derives the gallery's API reference from the library source.
apidoc/cmd/apidoc command
Command apidoc writes the gallery's generated API and example tables.
Command apidoc writes the gallery's generated API and example tables.
busy
Package busy holds the loading treatment components share, so a pending button, a working field and a refreshing list fade, wait and dim alike.
Package busy holds the loading treatment components share, so a pending button, a working field and a refreshing list fade, wait and dim alike.
formstyle
Package formstyle shares Coss field chrome between native form and date controls.
Package formstyle shares Coss field chrome between native form and date controls.
fx
Package fx holds the shaders and paint helpers the effect family and the root components draw with.
Package fx holds the shaders and paint helpers the effect family and the root components draw with.
gallery
Package gallery is the interactive native workbench for mygoui.
Package gallery is the interactive native workbench for mygoui.
motion
Package motion holds the two state-change helpers components share, so every control that changes state in place moves alike.
Package motion holds the two state-change helpers components share, so every control that changes state in place moves alike.
style
Package style centralizes typography and state styling shared by components.
Package style centralizes typography and state styling shared by components.
Package layout provides the window-level building blocks of a native application: a custom title bar that keeps clear of the system window controls, a split view of side panes beside the content, and a scaffold composing both with a status strip.
Package layout provides the window-level building blocks of a native application: a custom title bar that keeps clear of the system window controls, a split view of side panes beside the content, and a scaffold composing both with a status strip.
Package list provides virtualized, selectable rows with Coss-inspired appearance and optional labelled sections.
Package list provides virtualized, selectable rows with Coss-inspired appearance and optional labelled sections.
Package locale owns library-level accessible labels.
Package locale owns library-level accessible labels.
Package navigation provides Coss-inspired native navigation controls: accordions, disclosures, tabs, segmented controls, breadcrumbs, pagination, toolbars, menus, context menus, and searchable commands.
Package navigation provides Coss-inspired native navigation controls: accordions, disclosures, tabs, segmented controls, breadcrumbs, pagination, toolbars, menus, context menus, and searchable commands.
Package overlay implements COSS-inspired transient surfaces on MyGo's native overlay, focus and toast engines.
Package overlay implements COSS-inspired transient surfaces on MyGo's native overlay, focus and toast engines.
Package theme owns the design tokens: semantic colors, geometry, type, elevation, motion and effects.
Package theme owns the design tokens: semantic colors, geometry, type, elevation, motion and effects.

Jump to

Keyboard shortcuts

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