On this page
Pydantic schemas for all 39 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 39 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 (5) -- Table, 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
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.
#BreadcrumbItem
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
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.
#to_node
def to_node(self) -> dict[str, Any]#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.
#Breadcrumb
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.
#Modal
Overlay modal dialog.
#Drawer
Slide-in panel.
#Popover
Popover tooltip / flyout.
#Confirm
Confirmation dialog before a destructive action.
#register_sdui_provider
def register_sdui_provider(name: str, provider: Callable[[], Awaitable[tuple[dict[str, Any], dict[str, Any]]]]) -> NoneRegister an SDUI provider by name.
A provider is an async callable that returns (ui_tree, initial_state).
#get_sdui_provider
def get_sdui_provider(name: str) -> Callable[[], Awaitable[tuple[dict[str, Any], dict[str, Any]]]] | NoneReturn the SDUI provider for name, or None if not registered.
#list_sdui_providers
def list_sdui_providers() -> list[str]Return a list of registered SDUI provider names.