ui

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package ui is a declarative authoring layer for the Mosaic SDUI — a "reads like a widget tree" ergonomics (Flutter/Compose/Vaadin, the gomponents pattern in Go). A component takes ...El, and children, props and slots are all Els that intermix, so a screen reads as a tree rather than a builder with option bags. The tree compiles to the same protobuf UINode the wire uses (ADR 0044) at Build(); only the authoring changes, not the payload.

This file is the hand-written runtime — the Element machinery and the control-flow/escape-hatch options (Prop, ID, Slot, Group, When). The component constructors and the typed sugar (Hero, PosterCard, OnTap, Meta, …) are generated into components.gen.go from ui.spec.json by tools/genui; edit the spec, not the generated file.

Index

Constants

View Source
const (
	ToneNeutral = sdui.ToneNeutral
	ToneAccent  = sdui.ToneAccent
	ToneSuccess = sdui.ToneSuccess
	ToneWarning = sdui.ToneWarning
	ToneDanger  = sdui.ToneDanger
	ToneInfo    = sdui.ToneInfo
)

Tone values (the open-bag string encoding), re-exported from the producer binding.

View Source
const (
	SurfaceModal  = sdui.SurfaceModal
	SurfaceSheet  = sdui.SurfaceSheet
	SurfaceDrawer = sdui.SurfaceDrawer
)

Variables

View Source
var (
	Navigate     = sdui.Navigate
	Invoke       = sdui.Invoke
	Play         = sdui.Play
	OpenURL      = sdui.OpenURL
	Back         = sdui.Back
	Query        = sdui.Query
	OpenOverlay  = sdui.OpenOverlay
	CloseOverlay = sdui.CloseOverlay
	Toast        = sdui.Toast
	Sequence     = sdui.Sequence
	SetValue     = sdui.SetValue
	Submit       = sdui.Submit
)

Action constructors, re-exported from the producer binding; they ride the open props bag as JSON (ADR 0044).

Functions

This section is empty.

Types

type Action

type Action = sdui.Action

Action is a declarative behaviour envelope, re-exported from the producer binding; it rides the open props bag as JSON (ADR 0044). Author one with the generated constructors (Navigate, Invoke, Play).

func DismissOverlay added in v0.16.0

func DismissOverlay() Action

DismissOverlay closes the topmost overlay. It is what a cancel control emits: the overlay never navigated anywhere, so there is nothing to navigate back to.

func Overlay added in v0.16.0

func Overlay(surface Surface, el *Element) Action

Overlay presents an element over the current screen instead of navigating to it — a confirmation, a picker, a detail sheet.

It is hand-written rather than generated because it is the one action whose argument is a *tree*: the node rides inside the action, so the authoring layer has to build it. The generated constructors take scalars and prop bags.

Reach for it when what you are presenting is a decision about the screen you're on. A screen is the wrong shape for that — it takes the context away and needs a way back to it — which is why the extension install confirmation is this and not a route.

type El

type El interface {
	// contains filtered or unexported methods
}

El is anything that composes into an element: a child, a prop, or a slot. A component accepts ...El and lets them intermix.

func A11yLabel added in v0.25.0

func A11yLabel(v string) El

A11yLabel is the accessible name, for when the visible content is not one — an icon-only control, an image that carries meaning. It is deliberately not `label`: a visible label and an accessible name are different things, and one key meaning both is how a control ends up announced as its own caption.

func Account added in v0.16.0

func Account(els ...El) El

Account fills the app frame's "account" slot.

func ActionLabel

func ActionLabel(v string) El

ActionLabel sets a Section's "see all" action label (paired with OnTap).

func ActionSlot added in v0.16.0

func ActionSlot(els ...El) El

ActionSlot fills the "action" slot (an empty state's call to action).

func Actions

func Actions(els ...El) El

Actions fills the "actions" slot (a hero's CTA row).

func Active added in v0.16.0

func Active(v bool) El

Active marks the open nav row.

func Align added in v0.16.0

func Align(v string) El

Align sets a stack's cross-axis alignment.

func Aside

func Aside(els ...El) El

Aside fills the "aside" slot (a hero's docked poster).

func Avatar added in v0.16.0

func Avatar(v string) El

Avatar sets a person's portrait.

func Backdrop

func Backdrop(v string) El

Backdrop sets a hero backdrop image URL.

func BadgeText

func BadgeText(v string) El

BadgeText sets a corner badge on a card.

func BindA11yLabel added in v0.25.0

func BindA11yLabel(path string) El

BindA11yLabel sets "a11yLabel" from the named path instead of from a value.

func BindActionLabel added in v0.20.0

func BindActionLabel(path string) El

BindActionLabel sets "actionLabel" from the named path instead of from a value.

func BindActive added in v0.20.0

func BindActive(path string) El

BindActive sets "active" from the named path instead of from a value.

func BindAlign added in v0.20.0

func BindAlign(path string) El

BindAlign sets "align" from the named path instead of from a value.

func BindAvatar added in v0.20.0

func BindAvatar(path string) El

BindAvatar sets "avatar" from the named path instead of from a value.

func BindBackdrop added in v0.20.0

func BindBackdrop(path string) El

BindBackdrop sets "backdrop" from the named path instead of from a value.

func BindBadgeText added in v0.20.0

func BindBadgeText(path string) El

BindBadgeText sets "badge" from the named path instead of from a value.

func BindBusy added in v0.22.0

func BindBusy(path string) El

BindBusy sets "busy" from the named path instead of from a value.

func BindCapabilities added in v0.20.0

func BindCapabilities(path string) El

BindCapabilities sets "capabilities" from the named path instead of from a value.

func BindCredits added in v0.20.0

func BindCredits(path string) El

BindCredits sets "credits" from the named path instead of from a value.

func BindDisabled added in v0.20.0

func BindDisabled(path string) El

BindDisabled sets "disabled" from the named path instead of from a value.

func BindError added in v0.22.0

func BindError(path string) El

BindError sets "error" from the named path instead of from a value.

func BindFocusGroup added in v0.26.0

func BindFocusGroup(path string) El

BindFocusGroup sets "focusGroup" from the named path instead of from a value.

func BindFocusable added in v0.26.0

func BindFocusable(path string) El

BindFocusable sets "focusable" from the named path instead of from a value.

func BindGenres added in v0.20.0

func BindGenres(path string) El

BindGenres sets "genres" from the named path instead of from a value.

func BindHasMore added in v0.27.0

func BindHasMore(path string) El

BindHasMore sets "hasMore" from the named path instead of from a value.

func BindHasNext added in v0.20.0

func BindHasNext(path string) El

BindHasNext sets "hasNext" from the named path instead of from a value.

func BindHasPrev added in v0.20.0

func BindHasPrev(path string) El

BindHasPrev sets "hasPrev" from the named path instead of from a value.

func BindHeading added in v0.20.0

func BindHeading(path string) El

BindHeading sets "heading" from the named path instead of from a value.

func BindHeadingLevel added in v0.25.0

func BindHeadingLevel(path string) El

BindHeadingLevel sets "headingLevel" from the named path instead of from a value.

func BindHelp added in v0.20.0

func BindHelp(path string) El

BindHelp sets "help" from the named path instead of from a value.

func BindIconName added in v0.20.0

func BindIconName(path string) El

BindIconName sets "icon" from the named path instead of from a value.

func BindIndex added in v0.20.0

func BindIndex(path string) El

BindIndex sets "index" from the named path instead of from a value.

func BindInitialFocus added in v0.26.0

func BindInitialFocus(path string) El

BindInitialFocus sets "initialFocus" from the named path instead of from a value.

func BindInputType added in v0.20.0

func BindInputType(path string) El

BindInputType sets "inputType" from the named path instead of from a value.

func BindItemWidth added in v0.20.0

func BindItemWidth(path string) El

BindItemWidth sets "itemWidth" from the named path instead of from a value.

func BindJustify added in v0.20.0

func BindJustify(path string) El

BindJustify sets "justify" from the named path instead of from a value.

func BindKicker added in v0.20.0

func BindKicker(path string) El

BindKicker sets "kicker" from the named path instead of from a value.

func BindLive added in v0.25.0

func BindLive(path string) El

BindLive sets "live" from the named path instead of from a value.

func BindLoadMore added in v0.27.0

func BindLoadMore(path string) El

BindLoadMore sets "loadMore" from the named path instead of from a value.

func BindLogo(path string) El

BindLogo sets "logo" from the named path instead of from a value.

func BindMessage added in v0.34.0

func BindMessage(path string) El

BindMessage sets "message" from the named path instead of from a value.

func BindMeta added in v0.20.0

func BindMeta(path string) El

BindMeta sets "meta" from the named path instead of from a value.

func BindMimeType added in v0.20.0

func BindMimeType(path string) El

BindMimeType sets "mimeType" from the named path instead of from a value.

func BindMinColumnWidth added in v0.20.0

func BindMinColumnWidth(path string) El

BindMinColumnWidth sets "minColumnWidth" from the named path instead of from a value.

func BindName added in v0.22.0

func BindName(path string) El

BindName sets "name" from the named path instead of from a value.

func BindNativeTitle added in v0.20.0

func BindNativeTitle(path string) El

BindNativeTitle sets "nativeTitle" from the named path instead of from a value.

func BindNextAction added in v0.20.0

func BindNextAction(path string) El

BindNextAction sets "nextAction" from the named path instead of from a value.

func BindNextFocus added in v0.26.0

func BindNextFocus(path string) El

BindNextFocus sets "nextFocus" from the named path instead of from a value.

func BindNodeID added in v0.20.0

func BindNodeID(path string) El

BindNodeID sets "nodeId" from the named path instead of from a value.

func BindOn added in v0.20.0

func BindOn(path string) El

BindOn sets "on" from the named path instead of from a value.

func BindOnAppear added in v0.24.0

func BindOnAppear(path string) El

BindOnAppear sets "onAppear" from the named path instead of from a value.

func BindOnDisappear added in v0.24.0

func BindOnDisappear(path string) El

BindOnDisappear sets "onDisappear" from the named path instead of from a value.

func BindOnTap added in v0.20.0

func BindOnTap(path string) El

BindOnTap sets "action" from the named path instead of from a value.

func BindOptions added in v0.20.0

func BindOptions(path string) El

BindOptions sets "options" from the named path instead of from a value.

func BindOrigin added in v0.20.0

func BindOrigin(path string) El

BindOrigin sets "origin" from the named path instead of from a value.

func BindOverlayTitle added in v0.35.0

func BindOverlayTitle(path string) El

BindOverlayTitle sets "overlayTitle" from the named path instead of from a value.

func BindOverview added in v0.20.0

func BindOverview(path string) El

BindOverview sets "overview" from the named path instead of from a value.

func BindPartID added in v0.20.0

func BindPartID(path string) El

BindPartID sets "partId" from the named path instead of from a value.

func BindPlaceholder added in v0.20.0

func BindPlaceholder(path string) El

BindPlaceholder sets "placeholder" from the named path instead of from a value.

func BindPoster added in v0.20.0

func BindPoster(path string) El

BindPoster sets "poster" from the named path instead of from a value.

func BindPrevAction added in v0.20.0

func BindPrevAction(path string) El

BindPrevAction sets "prevAction" from the named path instead of from a value.

func BindProgress added in v0.20.0

func BindProgress(path string) El

BindProgress sets "progress" from the named path instead of from a value.

func BindProgressLabel added in v0.20.0

func BindProgressLabel(path string) El

BindProgressLabel sets "progressLabel" from the named path instead of from a value.

func BindRating added in v0.20.0

func BindRating(path string) El

BindRating sets "rating" from the named path instead of from a value.

func BindRatingLabel added in v0.20.0

func BindRatingLabel(path string) El

BindRatingLabel sets "ratingLabel" from the named path instead of from a value.

func BindResumeAt added in v0.20.0

func BindResumeAt(path string) El

BindResumeAt sets "resumeAt" from the named path instead of from a value.

func BindRetry added in v0.20.0

func BindRetry(path string) El

BindRetry sets "retry" from the named path instead of from a value.

func BindRole added in v0.20.0

func BindRole(path string) El

BindRole sets "role" from the named path instead of from a value.

func BindRows added in v0.20.0

func BindRows(path string) El

BindRows sets "rows" from the named path instead of from a value.

func BindRuntime added in v0.20.0

func BindRuntime(path string) El

BindRuntime sets "runtime" from the named path instead of from a value.

func BindSelected added in v0.20.0

func BindSelected(path string) El

BindSelected sets "selected" from the named path instead of from a value.

func BindShowTags added in v0.20.0

func BindShowTags(path string) El

BindShowTags sets "showTags" from the named path instead of from a value.

func BindSources added in v0.20.0

func BindSources(path string) El

BindSources sets "sources" from the named path instead of from a value.

func BindSubmitAction added in v0.22.0

func BindSubmitAction(path string) El

BindSubmitAction sets "submitAction" from the named path instead of from a value.

func BindSubmitLabel added in v0.22.0

func BindSubmitLabel(path string) El

BindSubmitLabel sets "submitLabel" from the named path instead of from a value.

func BindSubtitle added in v0.20.0

func BindSubtitle(path string) El

BindSubtitle sets "subtitle" from the named path instead of from a value.

func BindSummary added in v0.20.0

func BindSummary(path string) El

BindSummary sets "summary" from the named path instead of from a value.

func BindThumbnail added in v0.20.0

func BindThumbnail(path string) El

BindThumbnail sets "thumbnail" from the named path instead of from a value.

func BindTitle added in v0.20.0

func BindTitle(path string) El

BindTitle sets "title" from the named path instead of from a value.

func BindValue added in v0.20.0

func BindValue(path string) El

BindValue sets "value" from the named path instead of from a value.

func BindVars added in v0.21.0

func BindVars(path string) El

BindVars sets "vars" from the named path instead of from a value.

func BindWatched added in v0.20.0

func BindWatched(path string) El

BindWatched sets "watched" from the named path instead of from a value.

func BindWrap added in v0.20.0

func BindWrap(path string) El

BindWrap sets "wrap" from the named path instead of from a value.

func BindYear added in v0.20.0

func BindYear(path string) El

BindYear sets "year" from the named path instead of from a value.

func Bleed added in v0.16.0

func Bleed(els ...El) El

Bleed fills a screen's edge-to-edge "bleed" slot (a cinematic hero).

func Busy added in v0.22.0

func Busy(v bool) El

Busy marks a form as awaiting its submission's result.

func Capabilities added in v0.16.0

func Capabilities(v []any) El

Capabilities are the provider roles a module declares, as chips.

func Content added in v0.16.0

func Content(els ...El) El

Content fills the app frame's "content" region — where the current screen renders.

func Credits added in v0.16.0

func Credits(v ...string) El

Credits sets a hero's cast/crew line.

func Disabled added in v0.16.0

func Disabled(v bool) El

Disabled greys a control and stops it emitting.

func Error added in v0.22.0

func Error(v string) El

Error is a form-level failure message, distinct from a field's own.

func FocusGroup added in v0.26.0

func FocusGroup(v bool) El

FocusGroup makes this node's focusable descendants one stop in the tab order, moved between with the arrow keys — the roving pattern. A rail of forty cards is one stop, not forty.

func Focusable added in v0.26.0

func Focusable(v bool) El

Focusable marks a node that can take focus. Stated rather than inferred from interactivity: a card that navigates is focusable, and so is a heading a TV viewer needs to land on to read, and only the emit-side knows which.

func Footer(els ...El) El

Footer fills a frame's "footer" slot (level controls, not sections).

func Genres

func Genres(v ...string) El

Genres sets a DetailHeader's genre list.

func Group

func Group(els ...El) El

Group bundles a slice of elements into one El, so a built slice composes inline alongside other elements — e.g. Screen(Title(t), Group(rows...)).

func HasMore added in v0.27.0

func HasMore(v bool) El

HasMore says this list is a page of something longer. It is the server's statement, not the client's inference: a page that happens to be full is not evidence there is another one, and a client guessing from the count asks for a page that does not exist.

func HasNext added in v0.16.0

func HasNext(v bool) El

HasNext enables a pagination's next control.

func HasPrev added in v0.16.0

func HasPrev(v bool) El

HasPrev enables a pagination's previous control.

func Header(els ...El) El

Header fills a screen's "header" slot.

func Heading added in v0.16.0

func Heading(v string) El

Heading titles a frame's panel.

func HeadingLevel added in v0.25.0

func HeadingLevel(v int) El

HeadingLevel is 1-6, the depth of a heading in the screen's outline. Stated rather than inferred from text size, because size is a design decision and outline depth is a structural one — and a screen reader navigates the second.

func Help added in v0.16.0

func Help(v string) El

Help is the note under a field.

func ID

func ID(id string) El

ID sets a stable node id.

func IconName added in v0.17.0

func IconName(v string) El

IconName names the glyph a control or row shows. It is not called Icon because Icon is the primitive that renders a glyph as a node of its own; this sets the `icon` prop of something that draws one.

func Index added in v0.16.0

func Index(v int) El

Index is an episode's number within its season.

func InitialFocus added in v0.26.0

func InitialFocus(v bool) El

InitialFocus asks for focus when this node first appears. At most one per region wins; a screen naming two is stating a preference it does not have.

func InputType added in v0.16.0

func InputType(v string) El

InputType selects the keyboard/validation a field asks for.

func ItemWidth added in v0.16.0

func ItemWidth(v int) El

ItemWidth fixes a carousel's track width in px.

func Justify added in v0.16.0

func Justify(v string) El

Justify sets a stack's main-axis distribution.

func Kicker added in v0.16.0

func Kicker(v string) El

Kicker is the eyebrow line above a hero's title.

func Live added in v0.25.0

func Live(v string) El

Live marks a region whose changes should be announced: "polite" waits for a pause, "assertive" interrupts. Anything else is not announced.

func LoadMore added in v0.27.0

func LoadMore(v Action) El

LoadMore is what fetches the next page. It carries whatever cursor the server needs, because only the server knows what 'next' means for this list — a skip count here, a token elsewhere.

func Logo(v string) El

Logo sets a hero clearlogo/title-treatment image URL.

func Message added in v0.34.0

func Message(v string) El

Message sets the explanation beneath an empty or error state's title. Banner takes its message positionally; every other component that carries one needs this, and without it the emit-side sets the key by string — which is how a prop nothing renders gets shipped.

func Meta

func Meta(v ...string) El

Meta sets a hero's meta line (year, type, rating).

func MimeType

func MimeType(v string) El

MimeType sets the media type a Player should expect, so a client can pick a pipeline before it fetches.

func MinColumnWidth added in v0.16.0

func MinColumnWidth(v int) El

MinColumnWidth is a grid's smallest column before it reflows, in px.

func Name added in v0.22.0

func Name(v string) El

Name is a field's name in the enclosing State scope.

func NativeTitle added in v0.16.0

func NativeTitle(v string) El

NativeTitle is the original-language title shown beside the localised one.

func Nav(els ...El) El

Nav fills a frame's "nav" slot.

func NextAction added in v0.16.0

func NextAction(v Action) El

NextAction is what a pagination's next control emits.

func NextFocus added in v0.26.0

func NextFocus(v map[string]any) El

NextFocus overrides where focus goes from here, per direction — {up,down,left,right} to node ids. It is an override, not the mechanism: a client works out the rest geometrically, and this is for the cases geometry gets wrong.

func NodeID

func NodeID(v string) El

NodeID names the item a Player is playing, so the client can report its position back against it (ADR 0046).

func On added in v0.16.0

func On(v bool) El

On is a switch's state. Distinct from Value, which is a field's text: one prop key cannot be a string in one component and a boolean in another, and a switch that read \"true\" as text would render on for the string \"false\" too.

func OnAppear added in v0.24.0

func OnAppear(v Action) El

OnAppear is emitted the first time this node becomes visible on screen. The server decides what that means by choosing the action; a client never reports anything it was not asked to.

func OnDisappear added in v0.24.0

func OnDisappear(v Action) El

OnDisappear is emitted when this node leaves the screen, having been visible.

func OnTap

func OnTap(v Action) El

OnTap sets the node's primary action.

func Options added in v0.16.0

func Options(v []any) El

Options are a select's choices.

func Origin added in v0.16.0

func Origin(v string) El

Origin is where a thing came from — an extension's id, version and repository. Distinct from Meta, which is a hero's variadic meta line: the same key cannot be a string in one component and a list in another.

func OverlayTitle added in v0.35.0

func OverlayTitle(v bool) El

OverlayTitle lays a tile's title over its artwork instead of beneath it, for a card that is mostly image — the hero's up-next dock. Off by default, because a title on the picture is only legible when the tile is large enough to carry a scrim under it.

func Overview

func Overview(v string) El

Overview sets a synopsis/overview string.

func PartID

func PartID(v string) El

PartID names the release a Player is playing, recorded with the position so a resume returns to the same encode (ADR 0046).

func Placeholder added in v0.16.0

func Placeholder(v string) El

Placeholder is a field's empty-state hint.

func Poster

func Poster(v string) El

Poster sets a poster image URL.

func PrevAction added in v0.16.0

func PrevAction(v Action) El

PrevAction is what a pagination's previous control emits.

func Progress

func Progress(v float64) El

Progress sets a 0..1 watched fraction.

func ProgressLabel added in v0.16.0

func ProgressLabel(v string) El

ProgressLabel describes progress in words ("24m left").

func Prop

func Prop(key string, val any) El

Prop sets an arbitrary prop — the escape hatch for anything without sugar.

func Rail added in v0.16.0

func Rail(els ...El) El

Rail fills a hero's "rail" slot.

func Rating added in v0.16.0

func Rating(v string) El

Rating sets a displayed score.

func RatingLabel added in v0.16.0

func RatingLabel(v string) El

RatingLabel is the source a rating came from.

func ResumeAt

func ResumeAt(v float64) El

ResumeAt sets the position in seconds a Player starts from (ADR 0046).

func Retry added in v0.16.0

func Retry(v Action) El

Retry is what an error state's try-again control emits.

func Role added in v0.16.0

func Role(v string) El

Role is a person's part — a character, or a crew credit.

func Rows added in v0.16.0

func Rows(v []any) El

Rows are an info panel's label/value pairs.

func Runtime added in v0.16.0

func Runtime(v string) El

Runtime is a human-readable duration.

func Selected added in v0.16.0

func Selected(v bool) El

Selected says a section was asked for rather than defaulted to — what lets one payload drill down on a phone and show two panes on a desktop.

func ShowTags added in v0.16.0

func ShowTags(v bool) El

ShowTags reveals a hero's tag row.

func Slot

func Slot(name string, els ...El) El

Slot fills a named slot with the given elements' nodes.

func Sources added in v0.16.0

func Sources(v []any) El

Sources are the resolved streams a picker offers.

func SubmitAction added in v0.22.0

func SubmitAction(v Action) El

SubmitAction is what a Form emits when it is submitted, with the scope's values merged into its input.

func SubmitLabel added in v0.22.0

func SubmitLabel(v string) El

SubmitLabel is the text on a form's submit control.

func Subtitle

func Subtitle(v string) El

Subtitle sets a card/row subtitle.

func Summary added in v0.16.0

func Summary(v string) El

Summary is a card's one-line description.

func Tags added in v0.16.0

func Tags(els ...El) El

Tags fills a hero's "tags" slot.

func Thumbnail added in v0.16.0

func Thumbnail(v string) El

Thumbnail sets a row's still image.

func Title

func Title(v string) El

Title sets a screen or component title.

func TopBar added in v0.16.0

func TopBar(els ...El) El

TopBar fills the app frame's "topbar" slot.

func Value added in v0.16.0

func Value(v string) El

Value is a field's current value.

func Vars added in v0.21.0

func Vars(v []any) El

Vars declares a State scope's variables — each a name, a type ("string", "number" or "boolean") and an initial value. Declared rather than inferred: a client must know a name exists before anything writes to it, and must know what to coerce a written value to.

func Watched added in v0.16.0

func Watched(v bool) El

Watched marks an episode as already seen.

func When

func When(cond bool, el El) El

When includes el only if cond holds; otherwise it is a no-op. It lets a tree carry an element conditionally without breaking the declarative flow.

func Wrap added in v0.16.0

func Wrap(v bool) El

Wrap lets a stack run onto more than one line.

func Year added in v0.16.0

func Year(v string) El

Year sets a release year.

type Element

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

Element is a UI node under construction. It is itself an El — placing it in a parent adds it as a child — and Build() compiles it (and its subtree) to the protobuf Node.

func AppShell added in v0.16.0

func AppShell(title string, els ...El) *Element

AppShell is the application frame (ADR 0031): the brand bar, the nav and the region the current screen renders into.

func Badge

func Badge(label string, tone string, els ...El) *Element

Badge is a small pill; tone is one of the Tone values.

func Banner(message string, tone string, els ...El) *Element

Banner is an inline message; tone is one of the Tone values.

func Box added in v0.17.0

func Box(els ...El) *Element

Box is the layout container every composition is built from. Native: The irreducible layout leaf. A definition is a tree of primitives, so the base case cannot itself be a definition. It also resolves style.responsive against the live viewport, which is a render-time branch no static tree can carry.

func Button

func Button(label string, variant string, els ...El) *Element

Button carries an action; variant is primary/secondary/ghost/danger.

func Carousel(els ...El) *Element

Carousel is a horizontal snap-scrolling rail.

func Component

func Component(typ string, els ...El) *Element

Component is the generic constructor for a type without a helper (a standard component like SeasonSelector, or a module's own).

func DetailHeader

func DetailHeader(title string, els ...El) *Element

DetailHeader renders a node's metadata (title, meta, genres).

func DetailHero added in v0.16.0

func DetailHero(title string, els ...El) *Element

DetailHero is a title's cinematic header — backdrop, logo and the actions docked over it.

func Divider added in v0.16.0

func Divider(els ...El) *Element

Divider is a rule, optionally labelled.

func EmptyState

func EmptyState(icon string, title string, els ...El) *Element

EmptyState is a titled empty placeholder, with an optional explanation beneath it and a call to action.

func EpisodeRow

func EpisodeRow(title string, els ...El) *Element

EpisodeRow renders one episode under a season.

func ErrorState added in v0.16.0

func ErrorState(category string, els ...El) *Element

ErrorState renders a Platform error category as something a person can act on.

func ExtensionCard added in v0.16.0

func ExtensionCard(name string, els ...El) *Element

ExtensionCard is one extension module — what it is, what it can do, and where its bytes come from (ADR 0081).

func Form added in v0.17.0

func Form(els ...El) *Element

Form is a State scope with a submit control: it declares the fields' variables, hosts them, and emits its submit action with their values merged in. Composed rather than native — it is a State, an Outlet and a button, and nothing about it needs client code.

func Fragment added in v0.17.0

func Fragment(els ...El) *Element

Fragment renders its children with no wrapper of its own. Native: A transparent grouping node the expander needs in order to return several nodes where one is expected.

func GenreTag

func GenreTag(label string, els ...El) *Element

GenreTag is a genre chip.

func Grid

func Grid(els ...El) *Element

Grid is a responsive auto-fill grid.

func Hero

func Hero(title string, els ...El) *Element

Hero is a featured banner. Fill its call-to-action row with Actions.

func Icon added in v0.16.0

func Icon(els ...El) *Element

Icon renders one glyph from the client's bundled icon set. Native: Resolves a name to a vector the client ships. The glyph set is a client asset, not data.

func IconButton added in v0.16.0

func IconButton(icon string, label string, variant string, els ...El) *Element

IconButton is a Button reduced to its icon; the label stays for assistive tech.

func Image added in v0.17.0

func Image(els ...El) *Element

Image renders a remote or proxied image with a placeholder fallback. Native: Loading a resource, handling decode failure and falling back to a placeholder are client behaviours. It also feeds the art-light sampler, which reads decoded pixels.

func InfoPanel added in v0.16.0

func InfoPanel(els ...El) *Element

InfoPanel is a docked facts panel — a rating and a run of label/value rows.

func MediaTile added in v0.16.0

func MediaTile(title string, els ...El) *Element

MediaTile is a landscape card for episodes and continue-watching.

func Menu(els ...El) *Element

Menu is a click-to-open list of actions behind a trigger. Native: Owns its open/closed state.

func NavBar(els ...El) *Element

NavBar groups NavItems into the frame's responsive navigation. Native: Presents as an inline bar or a bottom tab strip depending on the viewport — a render-time branch, not data.

func NavItem(els ...El) *Element

NavItem is one entry in the app frame's navigation. Native: Owns active-route state: it compares the current screen against its own target, which only the client knows.

func Outlet added in v0.17.0

func Outlet(els ...El) *Element

Outlet marks the point in a definition's template where the caller's slot content is substituted. Native: It is the definition expander's own mechanism. A definition defined in terms of Outlet cannot itself be expanded without it, so it must be native.

func Pagination added in v0.16.0

func Pagination(els ...El) *Element

Pagination is a prev/next pair. The server supplies both targets; the client does no arithmetic.

func PersonChip

func PersonChip(name string, els ...El) *Element

PersonChip is a cast/crew chip.

func PlaybackBar added in v0.16.0

func PlaybackBar(title string, els ...El) *Element

PlaybackBar is the resume strip for something already started.

func Player

func Player(src string, els ...El) *Element

Player is the playback surface. Native: The client owns the decoding pipeline and the transport controls (ADR 0047, ADR 0070). A scrub bar cannot be driven over a network at frame rate.

func PosterCard

func PosterCard(title string, mediaType string, els ...El) *Element

PosterCard renders a work/item card.

func Pressable added in v0.17.0

func Pressable(els ...El) *Element

Pressable makes its subtree activate an Action. Native: Turning a pointer, key or remote-control event into an Action dispatch is client behaviour.

func ProgressBar added in v0.17.0

func ProgressBar(els ...El) *Element

ProgressBar shows a linear completion fraction. Native: Fill geometry is computed from the value at render.

func ProgressRing added in v0.17.0

func ProgressRing(els ...El) *Element

ProgressRing shows a circular completion fraction with the percentage inside. Native: Arc geometry is computed from the value at render.

func RatingControl added in v0.17.0

func RatingControl(els ...El) *Element

RatingControl selects a star rating. Native: Owns the selection.

func RelatedRail added in v0.16.0

func RelatedRail(title string, els ...El) *Element

RelatedRail is a titled rail that says so when it is empty.

func Rotator added in v0.17.0

func Rotator(els ...El) *Element

Rotator cross-fades through its children on a timer. Native: Owns a timer and derives the active index from it, and republishes the active slide's palette to the acrylic surfaces.

func Screen

func Screen(els ...El) *Element

Screen is the root of a server-defined page.

func SearchBar(els ...El) *Element

SearchBar is the frame's persistent search entry. Native: The submitted action must carry the live input value, and in a live session the value streams up debounced as it changes.

func SeasonSelector added in v0.17.0

func SeasonSelector(els ...El) *Element

SeasonSelector picks one season of a series. Native: Owns the selected season.

func Section

func Section(title string, els ...El) *Element

Section is a titled band.

func Select added in v0.16.0

func Select(label string, els ...El) *Element

Select is a labelled dropdown over server-supplied options.

func SelectInput added in v0.17.0

func SelectInput(els ...El) *Element

SelectInput is a bare dropdown. Native: Owns its selected value.

func SettingsFrame added in v0.16.0

func SettingsFrame(title string, els ...El) *Element

SettingsFrame is the Platform-owned settings chrome (ADR 0038): a nav beside the panel the open section fills.

func SettingsNavGroup added in v0.16.0

func SettingsNavGroup(label string, els ...El) *Element

SettingsNavGroup is one labelled run of settings nav rows.

func SettingsNavItem added in v0.16.0

func SettingsNavItem(label string, icon string, els ...El) *Element

SettingsNavItem is one settings nav row. The server marks the active one — it is the side that knows the params (ADR 0039).

func Skeleton added in v0.17.0

func Skeleton(els ...El) *Element

Skeleton is an animated loading placeholder. Native: Expands to a repeated animated shape; the animation is a client concern.

func Slider added in v0.17.0

func Slider(els ...El) *Element

Slider selects a number in a range. Native: Displays its own live value beside itself, so output couples to internal state.

func SourcePicker added in v0.16.0

func SourcePicker(els ...El) *Element

SourcePicker lists the resolved sources for a Part.

func Spacer added in v0.17.0

func Spacer(els ...El) *Element

Spacer occupies empty space in a stack, fixed or growing. Native: An irreducible layout leaf.

func Stack

func Stack(direction string, gap int, els ...El) *Element

Stack arranges children; direction is "horizontal" or "vertical".

func State added in v0.21.0

func State(els ...El) *Element

State declares named variables and scopes them to its subtree. Children bind to them by name, and a setValue action writes them. Native: It holds values across renders. A tree is a description of one moment; something has to remember what was typed between two of them, and no arrangement of static nodes can. It is also the scope boundary itself — which of two enclosing States a name resolves to is a question only the renderer, walking its own tree, can answer.

func StatusIndicator added in v0.16.0

func StatusIndicator(label string, tone string, els ...El) *Element

StatusIndicator is a coloured dot with a label.

func Switch added in v0.17.0

func Switch(els ...El) *Element

Switch is a bare on/off control. Native: Owns its on/off state.

func Tabs added in v0.17.0

func Tabs(els ...El) *Element

Tabs shows one panel at a time behind a tab strip. Each tab's content goes in the named slot matching its id, not in the ordered child list — an ordered child is dropped. Native: Owns the active tab index.

func Text added in v0.17.0

func Text(els ...El) *Element

Text renders a run of text in a token style. Children render after the text, for inline nesting. Native: The irreducible text leaf.

func TextField added in v0.16.0

func TextField(label string, els ...El) *Element

TextField is a labelled text input with optional help.

func TextInput added in v0.17.0

func TextInput(els ...El) *Element

TextInput is a bare text entry field. Native: Owns its input value between keystroke and submission.

func Toggle added in v0.16.0

func Toggle(label string, els ...El) *Element

Toggle is a switch with a label. It carries the value it moves TO — the client reports the flip, the server decides what it means.

func (*Element) Build

func (e *Element) Build() Node

Build compiles the element tree into the protobuf UINode.

func (*Element) BuildJSON

func (e *Element) BuildJSON() ([]byte, error)

BuildJSON compiles the element and marshals it to the canonical protojson UINode encoding — the bytes a client (or the Platform) decodes with protojson. It lets a producer that returns wire bytes (e.g. a module's settings UI, ADR 0038) emit them without importing protojson itself.

type Node

type Node = *sduiv1.UINode

Node is the compiled, protobuf UI node the transport carries.

type Surface added in v0.16.0

type Surface = sdui.Surface

Surface names where an overlay is presented — a modal, a sheet or a drawer. Re-exported with its values so an author does not reach past the ui layer for a constant.

Jump to

Keyboard shortcuts

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