UCloud logo UCloud logo UCloud
v2026.7.0-k8s.18
  1. UCloud/Core
  2. 1. Introduction
  3. 2. Projects
  4. 3. API Tokens
    1. 3.1. Platform API Tokens
    2. 3.2. Provider API Tokens
  5. 4. Accounting
  6. 5. Orchestration
  7. 6. Frontend
  8. UCloud/IM for Slurm-based HPC
  9. 7. Installation
  10. 8. Architecture and Networking
  11. 9. User and Project Management
  12. 10. Filesystem Integration
    1. 10.1. Inter-provider file transfers
  13. 11. Slurm Integration
    1. 11.1. Application Management
    2. 11.2. Built-in Applications
  14. 12. Reference
    1. 12.1. Configuration
    2. 12.2. CLI
  15. 13. Appendix
    1. 13.1. Built-in Application Index
  16. UCloud/IM for Kubernetes
  17. 14. Installation
  18. 15. Architecture and Networking
  19. 16. Filesystem Integration
  20. 17. Compute Jobs
    1. 17.1. Networks
    2. 17.2. Public Links
    3. 17.3. Public IPs
    4. 17.4. License Servers
    5. 17.5. SSH Servers
    6. 17.6. Job Audit Log
    7. 17.7. Virtual machines
  21. 18. AI Inference
    1. 18.1. Architecture
    2. 18.2. Chat Middleware
    3. 18.3. Chat Playground
    4. 18.4. Model Discovery and Catalog
    5. 18.5. Dynamo Deployments
    6. 18.6. Usage and Accounting
    7. 18.7. Audit
    8. 18.8. Metrics
    9. 18.9. Security
  22. 19. Integrated applications
    1. 19.1. Syncthing
    2. 19.2. Integrated terminal
    3. 19.3. Kubernetes clusters
      1. 19.3.1. Architecture
      2. 19.3.2. Stacks
      3. 19.3.3. Creating a cluster
      4. 19.3.4. Cluster dashboard
      5. 19.3.5. Networking and storage
      6. 19.3.6. Maintenance and upgrades
      7. 19.3.7. Backup and recovery
      8. 19.3.8. Reference
  23. 20. UCX applications
    1. 20.1. Hello world
    2. 20.2. Data binding
    3. 20.3. UI events
    4. 20.4. Component reference
    5. 20.5. API reference
  24. 21. Reference
    1. 21.1. Configuration
    2. 21.2. CLI
  25. Style guidelines
  26. 22. Branding and identity for UCloud
  27. 23. Documentation
  28. H: Procedures
  29. 24. H: Procedures
  30. 25. H: Introduction
  31. 26. H: Auditing
  32. 27. H: Auditing scenario
  33. 28. H: GitHub actions
  34. 29. H: Deployment
  35. 30. H: 3rd party dependencies (risk assesment)
  36. Glossary
  37. 31. Glossary
  1. Links
  2. Source Code
  3. Releases

Component reference

This page lists the most used UCX UI components with short examples.

Layout

Flex, Box

ucx.Flex(ucx.FlexProps{Direction: "column", Gap: 8}).
    Sx(ucx.SxP(4)).
    Children(
        ucx.Box().Children(
            ucx.Text("Inside a box"),
        ),
    )

Surface, Toolbar

Surface maps to a card-like container in the frontend. Toolbar provides a common “title on left, actions on right” layout.

ucx.Surface().Children(
    ucx.Toolbar().Children(
        ucx.H3("Machines"),
        ucx.Button("refresh", "Refresh", ucx.ColorPrimaryMain),
    ),
    ucx.Text("Machine list goes here"),
)

Tabs, Tab

ucx.Tabs().Children(
    ucx.Tab("Overview", ucx.IconHeroHome).Children(ucx.Text("Overview content")),
    ucx.Tab("Nodes", ucx.IconHeroServer).Children(ucx.Text("Nodes content")),
)

AccordionNode

ucx.AccordionNode("Advanced", false).Children(
    ucx.Text("Advanced settings..."),
)

Text and status

H1..H6, Text, TextBound

ucx.H2("Create stack")
ucx.Text("Fill out the form")
ucx.TextBound("validationMessage")

Code, CodeBound, Icon, Spinner, DividerNode

ucx.Icon(ucx.IconHeroCommandLine, ucx.ColorPrimaryMain, 20)
ucx.Code("kubectl get pods -A")
ucx.CodeBound("generatedScript")
ucx.Spinner(20)
ucx.DividerNode()

Inputs

All interactive components require explicit id. This ID must be unique for the entire mounted UI, similar to how HTML works.

InputText, InputNumber, TextArea

ucx.InputText("jobName", "Job name", "Name your job", "jobName")
ucx.InputNumber("cpu", "CPU", "cpu", 1, 128)
ucx.TextArea("notes", "Notes", "Optional notes", "notes", 4)

InputSecret, InputSecretEx

A read-only masked input that reveals its value while focused. Reads from a bind path, or renders a static value passed to InputSecretEx.

ucx.InputSecretEx("apiToken", "", token, "")

Dialog, DialogEx

A modal overlay rendered above the app view. Renders nothing while open is false. Children use normal components and event handlers; pressing Escape fires UiEventClose.

ucx.DialogEx("confirm", "Confirm action", app.showDialog).Children(
    ucx.Text("Are you sure?"),
    ucx.Button("Yes").On(ucx.UiEventClick, func(ev ucx.UiEvent) {
        app.showDialog = false
        ucx.AppUpdateUi(app)
    }),
).On(ucx.UiEventClose, func(ev ucx.UiEvent) {
    app.showDialog = false
    ucx.AppUpdateUi(app)
})

Checkbox, ToggleInput

ucx.Checkbox("notify", "Notify when ready", "notify", true)
ucx.ToggleInput("debug", "Enable debug mode", "debug", true)

Select, RadioGroup

machineOptions := []ucx.Option{
    {Key: "u1-standard-4", Value: "4 vCPU"},
    {Key: "u1-standard-8", Value: "8 vCPU"},
}

ucx.Select("machine", "Machine", "machine", machineOptions)
ucx.RadioGroup("network", "Network mode", "network", []ucx.Option{
    {Key: "public", Value: "Public"},
    {Key: "private", Value: "Private"},
})

Data views

List

ucx.List("todos", "No items yet.").Children(
    ucx.Flex(ucx.FlexProps{Gap: 8}).Children(
        ucx.TextBoundEx("todoText", "./text"),
        ucx.ButtonEx("removeTodo", "Remove", ucx.ColorErrorMain, ucx.IconHeroTrash, "", "./id"),
    ),
)

StackResources, StackMachines

These are stack-aware components rendered by the stack page frontend.

ucx.StackResources()

ucx.StackMachines(ucx.StackMachinesProps{
    Plain: true,
    LabelFilter: util.OptValue(ucx.StackMachinesLabelFilter{
        Label: "ucloud.dk/k8s-node-group",
        Value: "worker",
    }),
})

TableNode

ucx.TableNode("nodes", []ucx.Option{
    {Key: "hostname", Value: "Hostname"},
    {Key: "status", Value: "Status"},
})

Actions

Button, ButtonEx, SubmitButton, Form

ucx.Form("createForm").Children(
    ucx.InputText("name", "Name", "", "name"),
    ucx.SubmitButton("create", "Create", ucx.ColorPrimaryMain),
)

ucx.Button("refresh", "Refresh", ucx.ColorInfoMain)
ucx.ButtonEx("delete", "Delete", ucx.ColorErrorMain, ucx.IconHeroTrash, "", "./id")

Router, Link

Router(bindPath) binds the current UCX-internal path (query parameter p) to model state. Link(to) updates only p on the current page and preserves all other query parameters.

Only one active router is used; later router nodes overwrite earlier ones.

ucx.Router("routePath")

ucx.Toolbar().Children(
    ucx.H2("Stack overview"),
    ucx.Link("control").Children(ucx.Text("Open control plane")),
)

SettingsAction

Renders a settings-style row with a bold title and secondary description on the left and a control on the right. Well suited for action panels such as downloads, external tools and destructive operations.

ucx.SettingsAction("deleteAction", "Delete stack", "Permanently deletes the stack. This cannot be undone.").
    Children(ucx.ButtonEx("delete", "Delete", ucx.ColorErrorMain, "", "", ""))

ExternalLinkButton

A button-styled link that opens an external URL in a new tab.

ucx.ExternalLinkButton("openDocs", "Open documentation", "https://example.com", ucx.ColorPrimaryMain, ucx.IconHeroArrowTopRightOnSquare)

LinkButton

A link-styled clickable label. Fires a normal UiEventClick like Button, but renders inline as a link.

ucx.LinkButton("showResources", "12", ucx.ColorLinkColor).On(ucx.UiEventClick, func(ev ucx.UiEvent) {
    // handle click
})

CopyButton, CopyButtonEx, CopyButtonBound

An icon button that copies static or bound text to the clipboard and briefly confirms with a check mark.

ucx.CopyButtonEx("copyId", "1234567890").WithTooltip("Copy ID")

ProviderTitle

Renders the display title of a provider, resolved from the provider id. With short set, renders the abbreviated title (for example “UCLOUD” instead of “UCloud Provider”).

ucx.ProviderTitleEx("providerTitle", "ucloud_provider", true)

Navigation

NavTree, NavTreeEx

The sidebar tree of a browser layout. Each NavItem may set SeparatorBefore to render a horizontal separator between it and the item above.

items := []ucx.NavItem{
    {Id: "home", Label: "Home"},
    {Id: "group:Cluster", Label: "Cluster", SeparatorBefore: true, Children: []ucx.NavItemChild{
        {Id: "nodes", Label: "Nodes"},
    }},
}
ucx.NavTreeEx("nav", "activeType", items)

Call NavTreeActivateOnSingleClick(true) on the returned node to open leaf items with a single click. By default, leaf items require a double click.

Styling (Sx)

Attach style tokens with .Sx(...). You can combine multiple style options in a single call:

ucx.Text("Cluster status").Sx(
    ucx.SxColor(ucx.ColorTextSecondary),
    ucx.SxFontSize(13),
)

The most common pattern is to style containers and keep children mostly semantic:

ucx.Flex(ucx.FlexProps{Direction: "row", Gap: 8}).Sx(
    ucx.SxP(3),
    ucx.SxBorderWidth(1),
    ucx.SxBorderSolid,
    ucx.SxBorderColor(ucx.ColorBorderColor),
    ucx.SxBorderRadius(8),
    ucx.SxBg(ucx.ColorBackgroundCard),
).Children(
    ucx.Icon(ucx.IconHeroServer, ucx.ColorInfoMain, 18),
    ucx.Text("Control plane").Sx(ucx.SxFontWeight("600")),
)

Spacing and sizing

ucx.Box().Sx(
    ucx.SxP(4),
    ucx.SxMt(2),
    ucx.SxWidthPercent(100),
    ucx.SxMaxWidth(960),
)

Layout and alignment

ucx.Flex(ucx.FlexProps{Gap: 8}).Sx(
    ucx.SxDisplayFlex,
    ucx.SxAlignItemsCenter,
    ucx.SxJustifySpaceBetween,
    ucx.SxFlexWrapWrap,
)

Typography

ucx.Text("kube-system").Sx(
    ucx.SxFontSize(12),
    ucx.SxFontWeight("700"),
    ucx.SxLetterSpacing(1),
    ucx.SxTextTransform("uppercase"),
    ucx.SxColor(ucx.ColorTextSecondary),
)

Borders and emphasis

ucx.Box().Sx(
    ucx.SxBorderLeftWidth(3),
    ucx.SxBorderSolid,
    ucx.SxBorderLeftColor(ucx.ColorWarningMain),
    ucx.SxPl(3),
).Children(
    ucx.Text("Pending node upgrade"),
)

Overflow and code blocks

ucx.CodeBound("generatedScript").Sx(
    ucx.SxDisplayBlock,
    ucx.SxMaxHeight(280),
    ucx.SxOverflowY("auto"),
    ucx.SxWhiteSpace("pre"),
)

Responsive-friendly row wrapping

ucx.Flex(ucx.FlexProps{Gap: 8}).Sx(
    ucx.SxFlexWrapWrap,
).Children(
    ucx.Box().Sx(ucx.SxMinWidth(240), ucx.SxFlex("1 1 240px")).Children(
        ucx.Text("Section A"),
    ),
    ucx.Box().Sx(ucx.SxMinWidth(240), ucx.SxFlex("1 1 240px")).Children(
        ucx.Text("Section B"),
    ),
)

Common options (non-exhaustive):

  • spacing: SxP, SxPx, SxPy, SxMt, …
  • layout: SxDisplayFlex, SxAlignItemsCenter, SxJustifySpaceBetween, …
  • flex/grid: SxFlex, SxFlexGrow, SxFlexBasis, SxGridTemplateColumns, …
  • color: SxColor, SxBg, SxBorderColor
  • sizing: SxWidth, SxHeight, SxWidthPercent, SxHeightPercent
  • text/overflow: SxWhiteSpace, SxWordBreak, SxOverflowX, SxOverflowY
Previous UI events
Next API reference