This document lists the public package surface for ash_sdui.

Preferred authoring path

Prefer these layers in order:

  1. AshSDUI.LiveResource
  2. view/2, ui_field/2, ui_nested_form/2, ui_intent/2, ui_query/2, and ui_binding/2
  3. ash_sdui_view_opts/4
  4. recipe_overrides
  5. custom recipe modules
  6. custom render/1 or full custom LiveViews

Prefer these APIs:

Compatibility-only path:

Core modules

ModulePurpose
AshSDUI.LiveResourceGenerated and semi-generated runtime host
AshSDUI.ViewResolved screen metadata and normalized UI model
AshSDUI.BindingBinding planning, loading, subscriptions, and live updates
AshSDUI.IntentDeclarative action normalization and command envelopes
AshSDUI.LayoutPublic API for registered and stored layout trees
AshSDUI.Layout.BuilderPreferred builder for layout authoring
AshSDUI.LiveScreenHelper for assigning ephemeral runtime layouts
AshSDUI.FormMetadata-driven form field introspection
AshSDUI.Components.NestedFormRecursive renderer for generated nested relationship forms
AshSDUI.Components.SDUIRootRuntime bridge for layout-rendered components
AshSDUI.StorybookStorybook integration for generated views and SDUI trees

Main functions

AshSDUI.Layout

FunctionPurpose
fetch/2Return a named layout definition from registered or stored sources
register/2Register a code-authored layout by name
save/3Persist a layout tree through AshSDUI.UINode or a compatible resource
publish/2Mark stored layout nodes as published
load_nodes/2Return stored node records for a layout name

AshSDUI.Layout.Builder

FunctionPurpose
resource/2Build a node from a UI module or annotated resource
resources/3Build one node per record from a UI module or annotated resource
node/2Build a generic layout node
register/2Register a built layout and return the layout name
to_tree/1Convert a layout definition node into a renderable tree node

AshSDUI.LiveScreen

FunctionPurpose
assign_layout/3Register, evict, render, and assign an ephemeral layout

AshSDUI.Form

FunctionPurpose
fields/2Return ordered generated-form field metadata for an action
nested_forms/2Return ordered generated nested-form metadata for an action

Metadata sources

Use resource metadata as the source of truth:

  • view/2
  • ui_field/2
  • ui_nested_form/2
  • ui_intent/2
  • ui_query/2
  • ui_binding/2

Generated forms should use widget: when a field should render :textarea, :email, :select, :multiselect, or another non-default input. Relationship selectors may also declare relationship:, option_label:, option_value:, prompt:, read_action:, option_filter:, and option_sort:.

Generated nested relationship forms should use ui_nested_form/2. Supported metadata includes:

  • relationship
  • label / label_key
  • style
  • allow_add?
  • allow_remove?
  • allow_sort?
  • collapsed_by_default?
  • interaction_mode

Binding source families

Supported ui_binding source families:

  • {:resource, resource}
  • {:relationship, relationship}
  • {:assign, key}
  • {:context, key}
  • {:runtime, key}
  • {:selection}
  • {:subject}
  • {:event, key}
  • {:poll, source, interval: ms}
  • {:pubsub, topic, ...}
  • {:stream, source, ...}
  • {:actor}
  • {:tenant}

Refresh modes

Supported normalized refresh modes:

  • :manual
  • :params
  • :subscription
  • {:interval, ms}

Update strategies

Supported normalized update strategies:

  • :replace
  • :append
  • :prepend
  • :merge
  • :remove

Intent target families

Supported ui_intent target families:

  • {:navigate, path}
  • {:patch, path}
  • {:event, event}
  • {:ash_action, action}
  • {:refresh, binding_or_view}
  • {:select, operation}
  • {:workflow, event}
  • {:custom, module, function}

Supported behavioral metadata:

  • visible_when
  • enabled_when
  • loading_when
  • refreshes

Runtime contract fields

Shared runtime values:

  • view
  • bindings
  • state
  • context

Node-level runtime metadata:

  • binding
  • refresh
  • variant
  • state_key

AshSDUI.Components.SDUIRoot injects component-facing runtime assigns:

  • binding_name
  • bound_value
  • refresh_meta
  • state_key
  • state_slice
  • node_refresh
  • node_variant