Skip to content
src.wesktop.sdui
Edit
On this page

Pydantic schemas for all 40 SDUI (Server-Driven UI) primitives: layout containers, text, buttons, forms, tables, charts, and status indicators.

#src.wesktop.sdui

#src.wesktop.sdui

Pydantic schemas for all 40 SDUI (Server-Driven UI) primitives: layout containers, text, buttons, forms, tables, charts, and status indicators.

Each model validates and types the raw dict trees that apps build for the dashboard's SDUIRenderer. Each model serialises to the exact dict shape the renderer expects (type, props, children, optional if).

Usage::

from wesktop.sdui import Stack, Button, Alert, node

btn = Button(label="Deploy", variant="primary", command="deploy") print(btn.to_node()) # {"type": "button", "props": {"label": ...}}

tree = node("stack", [node("heading", text="Hello", level=2)])

Grouping: Layout (9) -- Stack, ZStack, Spacer, Divider, Grid, Card, Tabs, Breadcrumb, Empty Display (10) -- Heading, Text, Code, Status, Badge, ProgressBar, Spinner, Timeline, Diff, Markdown Data (6) -- Table, DataGrid, List, KeyValue, JsonView, Tree Input (8) -- Button, Input, TextArea, Select, Checkbox, Switch, Radio, Slider Feedback (3) -- Alert, Toast, Logs Overlay (4) -- Modal, Drawer, Popover, Confirm

#SDUINode

Base class for all SDUI nodes.

Every node serialises to {"type": ..., "props": ..., "children": [...]} with an optional "if" key for conditional rendering.

#node

python
def node(node_type: str, children: list[dict[str, Any]] | None=None, **props: Any) -> dict[str, Any]

Build an SDUI node dict for use in providers.

Quick, untyped helper -- no Pydantic validation, just dict construction matching the shape SDUIRenderer expects::

node("heading", content="Hello", level=2) node("column", [node("text", content="A"), node("text", content="B")], gap=16)

#TabItem

A single tab definition for Tabs.

A single breadcrumb segment.

#TimelineItem

A single entry in a Timeline.

#ColumnDef

A column definition for Table.

#KVEntry

A key-value entry for KeyValue.

#OptionItem

An option for Select, Radio, etc.

#DataGridColumnDef

A column definition for DataGrid.

#_PrimitiveBase

Internal base for individual primitive props.

Subclasses define typed props. to_node() serialises the primitive into the raw dict tree the renderer consumes. if_condition is lifted to the node-level "if" key.

#to_node

python
def to_node(self) -> dict[str, Any]

Serialise to the dict shape SDUIRenderer expects.

#Stack

Layout container -- renders as column or row depending on direction.

#ZStack

Z-axis overlay container (position-absolute children).

#Spacer

Empty space with optional fixed height.

#Divider

Horizontal line separator.

#Grid

CSS-grid layout.

#Card

Elevated card container.

#Tabs

Tab switcher.

Navigation breadcrumb trail.

#Empty

Empty-state placeholder.

#Heading

Section heading (h1-h6).

#Text

Inline text span.

#Code

Syntax-highlighted code block.

#Status

Status badge / indicator.

#Badge

Small label / tag displayed as a rounded pill.

#ProgressBar

Horizontal progress bar.

#Spinner

Loading spinner.

#Timeline

Vertical timeline of events.

#Diff

Side-by-side or unified diff view.

#Markdown

Rendered Markdown content.

#Table

Data table with typed columns.

#DataGrid

Interactive data grid with sorting, filtering, and pagination.

#List

Iterable list whose children are stamped per item.

#KeyValue

Key-value display (definition list).

#JsonView

Interactive JSON tree viewer.

#Tree

Hierarchical tree view.

#Button

Clickable button that dispatches a command.

#Input

Single-line text input.

#TextArea

Multi-line text input.

#Select

Dropdown select.

#Checkbox

Boolean checkbox.

#Switch

Toggle switch.

#Radio

Radio button group.

#Slider

Numeric slider.

#Alert

Inline alert banner.

#Toast

Ephemeral toast notification.

#Logs

Streaming log viewer.

Overlay modal dialog.

#Drawer

Slide-in panel.

#Popover

Popover tooltip / flyout.

#Confirm

Confirmation dialog before a destructive action.

#register_sdui_provider

python
def register_sdui_provider(name: str, provider: Callable[[], Awaitable[tuple[dict[str, Any], dict[str, Any]]]]) -> None

Register an SDUI provider by name.

A provider is an async callable that returns (ui_tree, initial_state).

#get_sdui_provider

python
def get_sdui_provider(name: str) -> Callable[[], Awaitable[tuple[dict[str, Any], dict[str, Any]]]] | None

Return the SDUI provider for name, or None if not registered.

#list_sdui_providers

python
def list_sdui_providers() -> list[str]

Return a list of registered SDUI provider names.

More tools from this site

  • claudestream Drive Claude Code from Python: run it as a subprocess and read its output as typed events, with async and sync sessions, sandbox policies, and tools you define in Python
  • claudewheel A TUI Claude Code Launcher that lets you have more than one profile, manage sessions lifecycle, pick the exact CC version, model to use (even older unlisted ones), pick which GitHub account to use, etc.
  • dirstat Fast, single-binary directory statistics CLI: every file under a tree grouped by format, with counts, sizes, and lines of code, as a colored terminal table or as JSON
  • fastware A batteries-included ASGI framework: msgspec JSON, a managed Granian server, dependency injection, SSE, WebSockets, auth, and a test client
  • go-toml-edit Zero-dep TOML editing library for Go with comment preservation
  • howmuchleft The fastest Claude Code statusline: context window, 5-hour, and weekly limit usage as three customizable gradient bars, rendering in about 6 ms
  • orxtra
  • pgdesign
  • predraw Declarative rendering pipeline: describe a scene in JSON and get SVG, PNG and WebP out, with light and dark style tokens, reusable components and text converted to path outlines
  • reposummary Turn a git repository's history into a Markdown journal: pick a time window or revision range and get a readable digest of what changed, optionally narrated by an LLM
  • rlsbl Release orchestration and project scaffolding CLI that bumps versions, validates a structured JSONL changelog, tags only the commit CI verified, and publishes to npm, PyPI, Go and more
  • safegit git wrapper CLI that gives each commit its own temporary index and retries ref updates on conflict, so concurrent agents share one repository
  • saferm Command-line replacement for rm that archives every deletion with a mandatory reason and the context it ran in, so deleted files can be listed, inspected and restored
  • selfdoc Static Site Generator that builds a project's documentation site directly from its source code, so the docs can never drift from the code they describe, with SEO/AEO, first-class blog, search, and cross-project linking built in
  • strictcli
  • stricttest An always-on test-isolation floor: a pytest plugin and a Go env-hygiene module that make a test suite structurally unable to reach real credentials, the real HOME, the network, or the development repository.
Search